Commit 0f4c4d27 by liulongfei

添加表格行固定,添加第一次读取时获取注册表路径

parent d4eceff8
......@@ -54,6 +54,8 @@
<Reference Include="DevExpress.Data.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v22.1.Core, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Core.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.1.Core, Version=22.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
......@@ -95,6 +97,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Widgets\GridColumnEx\GridColumnResizeMinHeight.cs" />
<Compile Include="Widgets\LeftRightTextEdit\LeftRightTextEdit.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
......@@ -107,6 +110,10 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common\VIZ.Framework.Common.csproj">
<Project>{92834c05-703e-4f05-9224-f36220939d8f}</Project>
<Name>VIZ.Framework.Common</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
......
using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Common;
namespace VIZ.Package.Common
{
/// <summary>
/// 列表列重置行行高
/// </summary>
public class GridColumnResizeMinHeight : GridColumn
{
#region AspectRatio -- 宽高比
/// <summary>
/// 宽高比
/// </summary>
public double AspectRatio
{
get { return (double)GetValue(AspectRatioProperty); }
set { SetValue(AspectRatioProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for AspectRatio. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty AspectRatioProperty =
DependencyProperty.Register("AspectRatio", typeof(double), typeof(GridColumnResizeMinHeight), new PropertyMetadata(16d / 9d));
#endregion
#region Offset -- 偏移量
/// <summary>
/// 偏移量
/// </summary>
public double Offset
{
get { return (double)GetValue(OffsetProperty); }
set { SetValue(OffsetProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for Offset. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty OffsetProperty =
DependencyProperty.Register("Offset", typeof(double), typeof(GridColumnResizeMinHeight), new PropertyMetadata(2d));
#endregion
protected override void OnWidthChanged(GridColumnWidth oldValue)
{
base.OnWidthChanged(oldValue);
this.ResizeMinHeight();
}
/// <summary>
/// 重置最小高度
/// </summary>
private void ResizeMinHeight()
{
if (this.View is TableView view)
{
double height = (this.Width.Value / this.AspectRatio) + this.Offset;
if (view.RowMinHeight != height)
{
view.RowMinHeight = height;
}
}
}
}
}
......@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Storage;
namespace VIZ.Package.Domain
{
......@@ -124,6 +125,20 @@ namespace VIZ.Package.Domain
#endregion
#region UpdateMessage -- 更新消息
private string updateMessage;
/// <summary>
/// 更新消息
/// </summary>
public string UpdateMessage
{
get { return updateMessage; }
set { updateMessage = value; this.RaisePropertyChanged(nameof(UpdateMessage)); }
}
#endregion
#region ErrorMessage -- 错误消息
private string errorMessage;
......@@ -202,6 +217,23 @@ namespace VIZ.Package.Domain
#endregion
#region IsCheckConnScene -- 是否校验场景
private bool isCheckConnScene = true;
/// <summary>
/// 是否校验场景
/// </summary>
/// <remarks>
/// 如果获取到当前连接的场景与页模型场景名不一致,那么不进行更新
/// </remarks>
public bool IsCheckConnScene
{
get { return isCheckConnScene; }
set { isCheckConnScene = value; this.RaisePropertyChanged(nameof(IsCheckConnScene)); }
}
#endregion
/// <summary>
/// 计时器信息
/// </summary>
......
......@@ -15,7 +15,7 @@ namespace VIZ.Package.Module.Resource
{
public VizThemeThemePalette() : base("VizTheme")
{
SetColor("HoverBackground", (Color)ColorConverter.ConvertFromString("#11FFFFFF"));
SetColor("HoverBackground", (Color)ColorConverter.ConvertFromString("#FF343434"));
SetColor("Backstage.Button.Background", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Backstage.Delimiter", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Backstage.HoverBackground", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
......
......@@ -43,6 +43,11 @@ namespace VIZ.Package.Module
/// </summary>
private PluginService pluginService = new PluginService();
/// <summary>
/// 注册表服务
/// </summary>
private RegistryService registryService = new RegistryService();
// ============================================================
// Property
// ============================================================
......@@ -215,7 +220,7 @@ namespace VIZ.Package.Module
{
// Step 1. 加载Viz配置信息
VizConfigEntity vizConfig = ApplicationDomainEx.LocalDbContext.VizConfig.FindAll().FirstOrDefault();
vizConfig = vizConfig ?? new VizConfigEntity();
vizConfig = vizConfig ?? this.CreateDefaultVizConfig();
ApplicationDomainEx.VizConfig = vizConfig;
this.UpdateVizConfig(vizConfig);
......@@ -238,6 +243,20 @@ namespace VIZ.Package.Module
}
/// <summary>
/// 创建默认的Viz配置文件
/// </summary>
/// <returns>默认的Viz配置文件</returns>
private VizConfigEntity CreateDefaultVizConfig()
{
VizConfigEntity config = new VizConfigEntity();
config.VIZ_Eng3Path = this.registryService.GetVizSetupPath();
config.VIZ_Eng4Path = config.VIZ_Eng3Path;
return config;
}
/// <summary>
/// 更新Viz配置
/// </summary>
/// <param name="vizConfig">Viz配置</param>
......
......@@ -10,6 +10,7 @@
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:common="clr-namespace:VIZ.Package.Common;assembly=VIZ.Package.Common"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
......@@ -78,15 +79,16 @@
</DataTemplate>
</dxg:GridColumn.CellEditTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True">
<dxg:GridColumn.CellTemplate>
<common:GridColumnResizeMinHeight Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True">
<common:GridColumnResizeMinHeight.CellTemplate>
<DataTemplate>
<fcommon:ResizeImageControl ImageSource="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"
IconSource="/VIZ.Package.Module.Resource;component/Icons/image_20x20.png"
ShowImageMinWidth="50" ShowImageMinHeight="50"></fcommon:ResizeImageControl>
ShowImageMinWidth="50" ShowImageMinHeight="50">
</fcommon:ResizeImageControl>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</common:GridColumnResizeMinHeight.CellTemplate>
</common:GridColumnResizeMinHeight>
<dxg:GridColumn Header="场景名" FieldName="Scene" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
<dxg:GridColumn Header="备注" FieldName="Remark" AllowSorting="False" AllowColumnFiltering="False">
<dxg:GridColumn.EditSettings>
......@@ -113,7 +115,7 @@
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView IsColumnMenuEnabled="False"
AllowEditing="True" ShowIndicator="False"
AllowEditing="True" ShowIndicator="False" RowMinHeight="69.5"
NavigationStyle="Cell" ShowVerticalLines="False"
ShowGroupPanel="False" EditorShowMode="MouseDown"
AllowDragDrop="True"
......
using System;
using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......
......@@ -489,6 +489,7 @@ namespace VIZ.Package.Module
page.ThumbnailBitmap = this.SelectedPageModel.ThumbnailBitmap;
page.PluginID = this.SelectedPageModel.PluginID;
page.PluginName = this.SelectedPageModel.PluginName;
page.ConnGroupID = this.SelectedPageModel.ConnGroupID;
page.PageNum = this.SelectedPageGroupModel.Pages.Max(p => p.PageNum) + 1;
this.SelectedPageGroupModel.Pages.Add(page);
......
......@@ -10,6 +10,7 @@
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:common="clr-namespace:VIZ.Package.Common;assembly=VIZ.Package.Common"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
......@@ -41,15 +42,15 @@
</ContextMenu>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.Columns>
<dxg:GridColumn Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True">
<dxg:GridColumn.CellTemplate>
<common:GridColumnResizeMinHeight Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True">
<common:GridColumnResizeMinHeight.CellTemplate>
<DataTemplate>
<fcommon:ResizeImageControl ImageSource="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"
IconSource="/VIZ.Package.Module.Resource;component/Icons/image_20x20.png"
ShowImageMinWidth="50" ShowImageMinHeight="50"></fcommon:ResizeImageControl>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</common:GridColumnResizeMinHeight.CellTemplate>
</common:GridColumnResizeMinHeight>
<dxg:GridColumn Header="场景名" FieldName="Scene" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
<dxg:GridColumn Header="备注" FieldName="Remark" AllowSorting="False" AllowColumnFiltering="False">
<dxg:GridColumn.EditSettings>
......@@ -65,7 +66,7 @@
<dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView IsColumnMenuEnabled="False"
<dxg:TableView IsColumnMenuEnabled="False" RowMinHeight="69.5"
AllowEditing="True" ShowIndicator="False"
NavigationStyle="Cell" ShowVerticalLines="False"
ShowGroupPanel="False" EditorShowMode="MouseDown"
......
......@@ -69,7 +69,7 @@
</Grid.ColumnDefinitions>
<!-- 资源文件夹 -->
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,10,0"
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,5,0"
SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}"
ContextMenu="{Binding Path=FolderContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
SelectionMode="Row"
......@@ -87,7 +87,7 @@
<!-- 文件夹等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Margin="0,0,6,0" />
<GridSplitter HorizontalAlignment="Right" Width="10" Style="{StaticResource GridSplitter_None}"></GridSplitter>
<GridSplitter HorizontalAlignment="Right" Width="5" Style="{StaticResource GridSplitter_None}"></GridSplitter>
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="True"
ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
......
......@@ -58,7 +58,21 @@
<dxe:TextEditSettings AcceptsReturn="False"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="更新间隔(秒)" FieldName="Interval" AllowResizing="False" Width="100">
<dxg:GridColumn Header="页编号" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"
Text="{Binding Row.PageModel.PageNum,StringFormat={}{0:D4}}"></TextBlock>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="场景" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
Binding="{Binding Path=PageModel.Scene,Mode=OneWay}"></dxg:GridColumn>
<dxg:GridColumn Header="层" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
Binding="{Binding Path=PageModel.Layer,Mode=OneWay}"></dxg:GridColumn>
<dxg:GridColumn Header="插件" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
Binding="{Binding Path=PageModel.PluginName,Mode=OneWay}"></dxg:GridColumn>
<dxg:GridColumn Header="更新间隔(秒)" FieldName="Interval" AllowResizing="False" AllowColumnFiltering="False" Width="100">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings MaskType="Numeric" HorizontalContentAlignment="Left"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings>
......@@ -93,7 +107,7 @@
<dxe:CheckEditSettings></dxe:CheckEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="任务信息" FieldName="Status" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
<dxg:GridColumn Header="错误信息" FieldName="Status" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
AllowResizing="False" Width="80" AllowEditing="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
......@@ -104,6 +118,17 @@
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="更新信息" FieldName="Status" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
AllowResizing="False" Width="80" AllowEditing="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Image Width="20" Height="20" Margin="0,3,0,3" HorizontalAlignment="Center" VerticalAlignment="Center"
Source="/VIZ.Package.Module.Resource;component/Icons/message_32x32.png"
ToolTip="{Binding Path=Row.UpdateMessage}"
Visibility="{Binding Path=Row.UpdateMessage,Converter={StaticResource StringNotNull2VisibilityConverter}}"></Image>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn AllowSorting="False" AllowColumnFiltering="False"
AllowResizing="False" Width="100" AllowEditing="False">
<dxg:GridColumn.CellTemplate>
......@@ -127,7 +152,7 @@
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView IsColumnMenuEnabled="False"
<dxg:TableView IsColumnMenuEnabled="False" RowMinHeight="30"
AllowEditing="True" ShowIndicator="False"
NavigationStyle="Cell" ShowVerticalLines="False"
ShowGroupPanel="False" EditorShowMode="MouseDown"
......
......@@ -188,84 +188,143 @@ namespace VIZ.Package.Module
}
string key = $"PackageTask_{task.ID}";
task.TimerInfo = ApplicationDomainEx.TimerManager.Register(key, task.Interval, () =>
{
// 任务没有在运行状态 || 任务不可以执行
if (!task.IsRunning || !task.CanExecute)
return;
task.TimerInfo = ApplicationDomainEx.TimerManager.Register(key, task.Interval, () => this.ExecuteTask(task));
}
// 上预览
if (task.IsPreviewEnabled && ApplicationDomainEx.PreviewConn != null && ApplicationDomainEx.PreviewConn.IsConnected)
/// <summary>
/// 取消任务
/// </summary>
/// <param name="task">任务</param>
public void Cancel(PackageTaskModel task)
{
lock (this.ItemsSource)
{
if (this.ItemsSource.Contains(task))
{
try
{
task.PreviewUpdateAction?.Invoke(ApplicationDomainEx.PreviewConn);
WPFHelper.Invoke(() =>
{
task.PreviewUpdateTime = DateTime.Now;
});
}
catch (Exception ex)
{
log.Error(ex);
WPFHelper.Invoke(() =>
{
task.ErrorMessage = ex.Message;
});
}
string key = $"PackageTask_{task.ID}";
ApplicationDomainEx.TimerManager.UnRegister(key);
this.ItemsSource.Remove(task);
task.TimerInfo?.Dispose();
}
}
}
// 上版
if (task.IsTakeEnabled)
{
ConnGroupModel group = ApplicationDomainEx.ConnGroups.FirstOrDefault(p => p.GroupID == task.PageModel.ConnGroupID);
if (group == null)
return;
// ==============================================================
// Private Function
// ==============================================================
/// <summary>
/// 执行任务
/// </summary>
/// <param name="task">任务</param>
private void ExecuteTask(PackageTaskModel task)
{
// 任务没有在运行状态 || 任务不可以执行
if (!task.IsRunning || !task.CanExecute)
return;
List<string> updateMessage = new List<string>();
// 更新预览
if (task.IsPreviewEnabled && ApplicationDomainEx.PreviewConn != null && ApplicationDomainEx.PreviewConn.IsConnected)
{
this.ExecuteTaskPreviewUpdate(task, updateMessage);
}
// 更新版子
if (task.IsTakeEnabled)
{
this.ExecuteTaskTakeUpdate(task, updateMessage);
}
}
foreach (var item in group.Items)
/// <summary>
/// 执行任务 -- 更新预览
/// </summary>
/// <param name="task">任务</param>
/// <param name="updateMessage">更新消息</param>
private void ExecuteTaskPreviewUpdate(PackageTaskModel task, List<string> updateMessage)
{
try
{
if (task.IsCheckConnScene)
{
string sceneName = this.vizCommandService.GetSceneName(ApplicationDomainEx.PreviewConn, task.PageModel.Layer);
if (sceneName != task.PageModel.Scene)
{
if (!item.IsEnabled || !item.IsConnected)
continue;
updateMessage.Add($"[预览] Viz引擎当前场景获取失败或与页场景{task.PageModel.Scene}不匹配");
try
{
task.TakeUpdateAction(item);
WPFHelper.Invoke(() =>
{
task.TakeUpdateTime = DateTime.Now;
});
}
catch (Exception ex)
{
log.Error(ex);
WPFHelper.Invoke(() =>
{
task.ErrorMessage = ex.Message;
});
}
return;
}
}
});
task.PreviewUpdateAction?.Invoke(ApplicationDomainEx.PreviewConn);
WPFHelper.Invoke(() =>
{
task.PreviewUpdateTime = DateTime.Now;
});
}
catch (Exception ex)
{
log.Error(ex);
WPFHelper.Invoke(() =>
{
task.ErrorMessage = ex.Message;
});
}
}
/// <summary>
/// 取消任务
/// 执行任务 -- 更新版子
/// </summary>
/// <param name="task">任务</param>
public void Cancel(PackageTaskModel task)
/// <param name="updateMessage">更新消息</param>
private void ExecuteTaskTakeUpdate(PackageTaskModel task, List<string> updateMessage)
{
lock (this.ItemsSource)
ConnGroupModel group = ApplicationDomainEx.ConnGroups.FirstOrDefault(p => p.GroupID == task.PageModel.ConnGroupID);
if (group == null)
return;
foreach (var item in group.Items)
{
if (this.ItemsSource.Contains(task))
if (!item.IsEnabled || !item.IsConnected)
continue;
try
{
string key = $"PackageTask_{task.ID}";
ApplicationDomainEx.TimerManager.UnRegister(key);
if (task.IsCheckConnScene)
{
string sceneName = this.vizCommandService.GetSceneName(ApplicationDomainEx.PreviewConn, task.PageModel.Layer);
if (sceneName != task.PageModel.Scene)
{
updateMessage.Add($"[{item.IP}] Viz引擎当前场景获取失败或与页场景{task.PageModel.Scene}不匹配");
continue;
}
}
this.ItemsSource.Remove(task);
task.TakeUpdateAction(item);
task.TimerInfo?.Dispose();
WPFHelper.Invoke(() =>
{
task.TakeUpdateTime = DateTime.Now;
});
}
catch (Exception ex)
{
log.Error(ex);
WPFHelper.Invoke(() =>
{
task.ErrorMessage = ex.Message;
});
}
}
WPFHelper.Invoke(() =>
{
task.UpdateMessage = string.Join("\r\n", updateMessage);
});
}
}
}
\ No newline at end of file
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Service
{
/// <summary>
/// 注册表服务
/// </summary>
public class RegistryService
{
/// <summary>
/// 获取Viz引擎路径
/// </summary>
/// <returns></returns>
public string GetVizSetupPath()
{
string path = this.GetVizrtEnginePath64();
if (!string.IsNullOrWhiteSpace(path) && System.IO.File.Exists(path))
{
return path;
}
path = this.GetVizrtEnginePath32();
if (!string.IsNullOrWhiteSpace(path) && System.IO.File.Exists(path))
{
return path;
}
return null;
}
/// <summary>
/// 获取64位Viz引擎路径
/// </summary>
/// <returns>64位Viz引擎路径</returns>
private string GetVizrtEnginePath64()
{
RegistryKey software = Registry.LocalMachine.OpenSubKey("SOFTWARE");
RegistryKey vizrt = software.OpenSubKey("[vizrt]");
if (vizrt == null)
return null;
RegistryKey viz3 = vizrt.OpenSubKey("Viz3");
if (viz3 == null)
return null;
object path = viz3.GetValue("Path");
return path?.ToString();
}
/// <summary>
/// 获取32位Viz引擎路径
/// </summary>
/// <returns>32位Viz引擎路径</returns>
private string GetVizrtEnginePath32()
{
RegistryKey software = Registry.LocalMachine.OpenSubKey("SOFTWARE");
RegistryKey wow = software.OpenSubKey("WOW6432Node");
RegistryKey vizrt = wow.OpenSubKey("[vizrt]");
if (vizrt == null)
return null;
RegistryKey viz3 = vizrt.OpenSubKey("Viz3");
if (viz3 == null)
return null;
object path = viz3.GetValue("Path");
return path?.ToString();
}
}
}
......@@ -71,6 +71,7 @@
<Compile Include="DB\Conn\ConnService.cs" />
<Compile Include="DB\ControlObject\ControlObjectService.cs" />
<Compile Include="DB\Page\PageService.cs" />
<Compile Include="DB\Registry\RegistryService.cs" />
<Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Viz\GHResourceService.cs" />
......
......@@ -271,5 +271,37 @@ namespace VIZ.Package.Service
conn.EndpointManager.Send($"RENDERER*UPDATE SET 1");
conn.EndpointManager.Send($"RENDERER*{layer} SET_OBJECT");
}
/// <summary>
/// 获取场景名
/// </summary>
/// <param name="conn">连接</param>
/// <param name="layer">层</param>
/// <returns>场景名</returns>
public string GetSceneName(ConnModel conn, VizLayer layer)
{
VizScene scene = VizScene.MAIN_SCENE;
switch (layer)
{
case VizLayer.FRONT_LAYER: scene = VizScene.FRONT_SCENE; break;
case VizLayer.MAIN_LAYER: scene = VizScene.MAIN_SCENE; break;
case VizLayer.BACK_LAYER: scene = VizScene.BACK_SCENE; break;
}
return this.GetSceneName(conn, scene);
}
/// <summary>
/// 获取场景名
/// </summary>
/// <param name="conn">连接</param>
/// <param name="scene">场景</param>
/// <returns>场景名</returns>
public string GetSceneName(ConnModel conn, VizScene scene)
{
string sceneName = conn.EndpointManager.Request($"{scene}*NAME GET");
return sceneName;
}
}
}
......@@ -66,12 +66,12 @@ namespace VIZ.Package.Storage
/// <summary>
/// VIZ 引擎3路径
/// </summary>
public string VIZ_Eng3Path { get; set; } = @"C:\Program Files\Vizrt\Viz3\viz.exe";
public string VIZ_Eng3Path { get; set; }
/// <summary>
/// VIZ 引擎4路径
/// </summary>
public string VIZ_Eng4Path { get; set; } = @"C:\Program Files\Vizrt\Viz3\viz.exe";
public string VIZ_Eng4Path { get; set; }
/// <summary>
/// 引擎完整类型
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -14,11 +15,13 @@ namespace VIZ.Package.Storage
/// <summary>
/// 场景
/// </summary>
[Description("场景")]
Scene,
/// <summary>
/// 命令
/// </summary>
[Description("命令")]
Command
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// Viz场景
/// </summary>
public enum VizScene
{
/// <summary>
/// 前场景
/// </summary>
[Description("前场景")]
FRONT_SCENE,
/// <summary>
/// 主场景
/// </summary>
[Description("主场景")]
MAIN_SCENE,
/// <summary>
/// 背景场景
/// </summary>
[Description("背景场景")]
BACK_SCENE
}
}
......@@ -83,6 +83,7 @@
<Compile Include="Enum\VizControlFieldType.cs" />
<Compile Include="Enum\VizControlObjectParameters.cs" />
<Compile Include="Enum\VizLayer.cs" />
<Compile Include="Enum\VizScene.cs" />
<Compile Include="Ini\VizConfig.cs" />
<Compile Include="LocalDbContext.cs" />
<Compile Include="ProjectDbContext.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment