Commit ff4e2d8b by liulongfei

本机渲染引擎设置

parent 96456dd2
......@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Domain;
using VIZ.Framework.Plugin;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Domain
{
......
......@@ -13,6 +13,11 @@ namespace VIZ.TVP.Domain
public class DataBaseManager : IDisposable
{
/// <summary>
/// 本地信息
/// </summary>
public LocalInfoEntity LocalInfo { get; set; }
/// <summary>
/// 缓存数据库
/// </summary>
public LiteDbContext LiteDbContext { get; set; }
......
using System;
using DevExpress.Mvvm.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Module
{
......@@ -11,6 +13,39 @@ namespace VIZ.TVP.Module
/// </summary>
public interface ILoginSupport
{
/// <summary>
/// GH_IP
/// </summary>
string GH_IP { get; set; }
/// <summary>
/// GH 端口
/// </summary>
int GH_Port { get; set; }
/// <summary>
/// GH 服务名
/// </summary>
string GH_ServerName { get; set; }
/// <summary>
/// VIZ 用户名
/// </summary>
string VIZ_UserName { get; set; }
/// <summary>
/// VIZ 密码
/// </summary>
string VIZ_Password { get; set; }
/// <summary>
/// 本机引擎类型集合
/// </summary>
List<EnumModel> LocalEngineTypes { get; set; }
/// <summary>
/// 当前选择的引擎类型
/// </summary>
EnumModel SelectedLocalEngineType { get; set; }
}
}
......@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
......@@ -27,11 +29,45 @@ namespace VIZ.TVP.Module
public ILoginSupport Support { get; private set; }
/// <summary>
/// 加载登录信息
/// </summary>
public void LoadedLoginInfo()
{
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.FindAll().FirstOrDefault();
if (info == null)
{
info = new LocalInfoEntity();
ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.Upsert(info);
}
this.Support.GH_IP = info.GH_IP;
this.Support.GH_Port = info.GH_Port;
this.Support.GH_ServerName = info.GH_ServerName;
this.Support.VIZ_UserName = info.VIZ_UserName;
this.Support.VIZ_Password = info.VIZ_Password;
this.Support.SelectedLocalEngineType = this.Support.LocalEngineTypes.FirstOrDefault(p => (LocalEngineType)p.Key == info.LocalEngineType) ?? this.Support.LocalEngineTypes.FirstOrDefault();
ApplicationDomainEx.DataBaseManager.LocalInfo = info;
}
/// <summary>
/// 登录
/// </summary>
/// <returns>是否成功执行登录</returns>
public bool Login()
{
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
info.GH_IP = this.Support.GH_IP;
info.GH_Port = this.Support.GH_Port;
info.GH_ServerName = this.Support.GH_ServerName;
info.VIZ_UserName = this.Support.VIZ_UserName;
info.VIZ_Password = this.Support.VIZ_Password;
info.LocalEngineType = (LocalEngineType)this.Support.SelectedLocalEngineType.Key;
ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.Update(info);
return true;
}
}
......
......@@ -28,7 +28,7 @@ namespace VIZ.TVP.Module
/// <summary>
/// 插件程序集前缀
/// </summary>
public const string PLUGIN_ASSEMBLY_PREFIX = "VIZ.TVP.Plugin";
public const string PLUGIN_ASSEMBLY_PREFIX = "VIZ.TVP.Plugin.";
/// <summary>
/// 插件控制器
......@@ -45,26 +45,15 @@ namespace VIZ.TVP.Module
public IPluginSupport Support { get; private set; }
/// <summary>
/// 开始异步加载插件
/// 加载插件
/// </summary>
public void BeginLoadPlugins()
public void LoadPlugins()
{
Task.Run(() =>
{
try
{
// 加载插件
this.executeLoadPlugins();
// 加载模板插件
this.executeLoadTemplatePlugins();
// 加载插件
this.executeLoadPlugins();
}
catch (Exception ex)
{
log.Error(ex);
}
});
// 加载模板插件
this.executeLoadTemplatePlugins();
}
/// <summary>
......@@ -80,7 +69,7 @@ namespace VIZ.TVP.Module
foreach (Type type in types)
{
if (!lifeCycleType.IsAssignableFrom(type))
if (!type.IsClass || !lifeCycleType.IsAssignableFrom(type))
continue;
IPluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as IPluginLifeCycle;
......@@ -109,7 +98,7 @@ namespace VIZ.TVP.Module
{
string fileName = System.IO.Path.GetFileName(file);
if (!fileName.StartsWith(PLUGIN_ASSEMBLY_PREFIX))
if (!fileName.StartsWith(PLUGIN_ASSEMBLY_PREFIX) || !fileName.EndsWith(".dll"))
continue;
Assembly assembly = Assembly.LoadFile(file);
......@@ -120,7 +109,7 @@ namespace VIZ.TVP.Module
foreach (Type type in types)
{
if (!lifeCycleType.IsAssignableFrom(type))
if (!type.IsClass || !lifeCycleType.IsAssignableFrom(type))
continue;
ITemplatePluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as ITemplatePluginLifeCycle;
......
......@@ -3,27 +3,69 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:VIZ.TVP.Module"
d:DataContext="{d:DesignInstance Type=local:LoginViewModel}"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="400" d:DesignWidth="600">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Row="4" Content="登录" Command="{Binding Path=LoginCommand}"></Button>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 引擎 -->
<TextBlock Text="引擎:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Column="1" Height="30" ItemsSource="{Binding Path=LocalEngineTypes}"
SelectedItem="{Binding Path=SelectedLocalEngineType,Mode=TwoWay}"
DisplayMember="Description">
</dxe:ComboBoxEdit>
<!-- IP -->
<TextBlock Text="IP:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="1" Grid.Column="1" Height="30"
EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit>
<!-- 端口 -->
<TextBlock Text="端口:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30" MaskType="RegEx"
Mask="[0-9]{0,7}"
EditValue="{Binding GH_Port,Mode=TwoWay}"></dxe:TextEdit>
<!-- ServerName -->
<TextBlock Text="服务名:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30"
EditValue="{Binding GH_ServerName,Mode=TwoWay}"></dxe:TextEdit>
<!-- UserName -->
<TextBlock Text="用户名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="4" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_UserName,Mode=TwoWay}"></dxe:TextEdit>
<!-- Password -->
<TextBlock Text="密码:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="5" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit>
<!-- 按钮组 -->
<Button Grid.Row="6" Width="120" Height="40" Grid.Column="1" Content="登录" HorizontalAlignment="Right"
Command="{Binding Path=LoginCommand}"></Button>
</Grid>
<dx:WaitIndicator DeferedVisibility="{Binding IsLoading}" Content="Loading..." />
</Grid>
</UserControl>
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Core;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
......@@ -27,6 +29,9 @@ namespace VIZ.TVP.Module
// 初始化控制器
this.initController();
// 初始化属性
this.initProperty();
}
/// <summary>
......@@ -47,11 +52,130 @@ namespace VIZ.TVP.Module
this.pluginController = new PluginController(this);
}
/// <summary>
/// 初始化属性
/// </summary>
private void initProperty()
{
this.LocalEngineTypes = EnumHelper.GetEnumModels<LocalEngineType>();
}
// ==================================================================================
// Property
// ==================================================================================
#region GH_IP -- GH IP
private string gh_ip;
/// <summary>
/// GH_IP
/// </summary>
public string GH_IP
{
get { return gh_ip; }
set { gh_ip = value; this.RaisePropertyChanged(nameof(GH_IP)); }
}
#endregion
#region GH_Port -- GH 端口
private int gh_port;
/// <summary>
/// GH 端口
/// </summary>
public int GH_Port
{
get { return gh_port; }
set { gh_port = value; this.RaisePropertyChanged(nameof(GH_Port)); }
}
#endregion
#region GH_ServerName -- GH 服务名
private string gh_serverName;
/// <summary>
/// GH 服务名
/// </summary>
public string GH_ServerName
{
get { return gh_serverName; }
set { gh_serverName = value; this.RaisePropertyChanged(nameof(GH_ServerName)); }
}
#endregion
#region VIZ_UserName -- VIZ 用户名
private string viz_userName;
/// <summary>
/// VIZ 用户名
/// </summary>
public string VIZ_UserName
{
get { return viz_userName; }
set { viz_userName = value; this.RaisePropertyChanged(nameof(VIZ_UserName)); }
}
#endregion
#region VIZ_Password -- VIZ 密码
private string viz_password;
/// <summary>
/// VIZ 密码
/// </summary>
public string VIZ_Password
{
get { return viz_password; }
set { viz_password = value; this.RaisePropertyChanged(nameof(VIZ_Password)); }
}
#endregion
#region LocalEngineTypes -- 本机引擎类型集合
private List<EnumModel> localEngineTypes;
/// <summary>
/// 本机引擎类型集合
/// </summary>
public List<EnumModel> LocalEngineTypes
{
get { return localEngineTypes; }
set { localEngineTypes = value; this.RaisePropertyChanged(nameof(LocalEngineTypes)); }
}
#endregion
#region SelectedLocalEngineType -- 当前选择的引擎类型
private EnumModel selectedLocalEngineType;
/// <summary>
/// 当前选择的引擎类型
/// </summary>
public EnumModel SelectedLocalEngineType
{
get { return selectedLocalEngineType; }
set { selectedLocalEngineType = value; this.RaisePropertyChanged(nameof(SelectedLocalEngineType)); }
}
#endregion
#region IsLoading -- 是否正在等待
private bool isLoading;
/// <summary>
/// 是否正在等待
/// </summary>
public bool IsLoading
{
get { return isLoading; }
set { isLoading = value; this.RaisePropertyChanged(nameof(IsLoading)); }
}
#endregion
// ==================================================================================
// Controller
......@@ -83,7 +207,21 @@ namespace VIZ.TVP.Module
/// </summary>
private void Loaded()
{
this.pluginController.BeginLoadPlugins();
this.IsLoading = true;
ThreadHelper.SafeRun(() =>
{
// 加载登录信息
this.loginController.LoadedLoginInfo();
// 加载插件
this.pluginController.LoadPlugins();
WPFHelper.BeginInvoke(() =>
{
this.IsLoading = false;
});
});
}
#endregion
......
......@@ -90,6 +90,13 @@ namespace VIZ.TVP.Module
ObservableCollection<SettingModel> items = new ObservableCollection<SettingModel>();
// 加载内置设置页面
// Viz设置
SettingModel viz = new SettingModel();
viz.DisplayName = "Viz设置";
viz.ViewType = typeof(VizSettingView);
items.Add(viz);
// 控制设置
SettingModel control = new SettingModel();
control.DisplayName = "控制";
......@@ -124,6 +131,7 @@ namespace VIZ.TVP.Module
}
this.SettingItems = items;
this.SelectedSettingItem = items.FirstOrDefault();
}
#endregion
......
<UserControl x:Class="VIZ.TVP.Module.VizSettingView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:VIZ.TVP.Module"
d:DataContext="{d:DesignInstance Type=local:VizSettingViewModel}"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- GH 设置 -->
<GroupBox Header="GH设置" Margin="10" Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!-- IP地址 -->
<TextBlock Text="IP地址:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Column="1" Height="30"
EditValue="{Binding Path=GH_IP,Mode=TwoWay}"></dxe:TextEdit>
<!-- 端口 -->
<TextBlock Text="端口:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="1" Grid.Column="1" Height="30" MaskType="RegEx"
Mask="[0-9]{0,7}"
EditValue="{Binding Path=GH_Port,Mode=TwoWay}"></dxe:TextEdit>
<!-- 服务名 -->
<TextBlock Text="服务名:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30"
EditValue="{Binding Path=GH_ServerName,Mode=TwoWay}"></dxe:TextEdit>
<!-- 用户名 -->
<TextBlock Text="用户名:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30"
EditValue="{Binding Path=GH_UserName,Mode=TwoWay}"></dxe:TextEdit>
<!-- 密码 -->
<TextBlock Text="密码:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="4" Grid.Column="1" Height="30"
EditValue="{Binding Path=GH_Password,Mode=TwoWay}"></dxe:TextEdit>
</Grid>
</GroupBox>
<!-- 本机VIZ设置 -->
<GroupBox Header="VIZ设置" Grid.Row="1" Margin="10" Padding="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!-- IP地址 -->
<TextBlock Text="IP地址:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Column="1" Height="30"
EditValue="{Binding Path=VIZ_IP,Mode=TwoWay}"></dxe:TextEdit>
<!-- 端口 -->
<TextBlock Text="端口:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="1" Grid.Column="1" Height="30" MaskType="RegEx"
Mask="[0-9]{0,7}"
EditValue="{Binding Path=VIZ_Port,Mode=TwoWay}"></dxe:TextEdit>
<!-- 用户名 -->
<TextBlock Text="用户名:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30"
EditValue="{Binding Path=VIZ_UserName,Mode=TwoWay}"></dxe:TextEdit>
<!-- 密码 -->
<TextBlock Text="密码:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30"
EditValue="{Binding Path=VIZ_Password,Mode=TwoWay}"></dxe:TextEdit>
<!-- 本机Eng3路径 -->
<TextBlock Text="本机Eng3路径:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<Grid Grid.Row="4" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<dxe:TextEdit Height="30"
EditValue="{Binding Path=VIZ_Eng3Path,Mode=TwoWay}"></dxe:TextEdit>
<Button Grid.Column="1" HorizontalAlignment="Right" Height="30" Width="80"
Content="..." Command="{Binding Path=SelectEng3PathCommand}"></Button>
</Grid>
<!-- 本机Eng4路径 -->
<TextBlock Text="本机Eng4路径:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<Grid Grid.Row="5" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<dxe:TextEdit Height="30"
EditValue="{Binding Path=VIZ_Eng4Path,Mode=TwoWay}"></dxe:TextEdit>
<Button Grid.Column="1" HorizontalAlignment="Right" Height="30" Width="80"
Content="..." Command="{Binding SelectEng4PathCommand}"></Button>
</Grid>
</Grid>
</GroupBox>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.TVP.Module
{
/// <summary>
/// VizSettingView.xaml 的交互逻辑
/// </summary>
public partial class VizSettingView : UserControl
{
public VizSettingView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new VizSettingViewModel());
}
}
}
using DevExpress.Utils.About;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
/// <summary>
/// VIZ设置视图模型
/// </summary>
public class VizSettingViewModel : ViewModelBase, ISettingViewModel
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(VizSettingViewModel));
/// <summary>
/// VIZ设置视图模型
/// </summary>
public VizSettingViewModel()
{
// 初始化命令
this.initCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void initCommand()
{
this.LoadedCommand = new VCommand(this.Loaded);
this.SelectEng3PathCommand = new VCommand(this.SelectEng3Path);
this.SelectEng4PathCommand = new VCommand(this.SelectEng4Path);
}
// =========================================================================
// Property
// =========================================================================
#region GH_IP -- GH IP
private string gh_ip;
/// <summary>
/// GH_IP
/// </summary>
public string GH_IP
{
get { return gh_ip; }
set { gh_ip = value; this.RaisePropertyChanged(nameof(GH_IP)); }
}
#endregion
#region GH_Port -- GH 端口
private int gh_port;
/// <summary>
/// GH 端口
/// </summary>
public int GH_Port
{
get { return gh_port; }
set { gh_port = value; this.RaisePropertyChanged(nameof(GH_Port)); }
}
#endregion
#region GH_ServerName -- GH 服务名
private string gh_serverName;
/// <summary>
/// GH 服务名
/// </summary>
public string GH_ServerName
{
get { return gh_serverName; }
set { gh_serverName = value; this.RaisePropertyChanged(nameof(GH_ServerName)); }
}
#endregion
#region GH_UserName -- GH 用户名
private string gh_userName;
/// <summary>
/// GH 用户名
/// </summary>
public string GH_UserName
{
get { return gh_userName; }
set { gh_userName = value; this.RaisePropertyChanged(nameof(GH_UserName)); }
}
#endregion
#region GH_Password -- GH 密码
private string gh_password;
/// <summary>
/// GH 密码
/// </summary>
public string GH_Password
{
get { return gh_password; }
set { gh_password = value; this.RaisePropertyChanged(nameof(GH_Password)); }
}
#endregion
// -----------------------------------
#region VIZ_IP -- VIZ IP
private string viz_ip;
/// <summary>
/// VIZ_IP
/// </summary>
public string VIZ_IP
{
get { return viz_ip; }
set { viz_ip = value; this.RaisePropertyChanged(nameof(VIZ_IP)); }
}
#endregion
#region VIZ_Port -- VIZ 端口
private int viz_port;
/// <summary>
/// VIZ 端口
/// </summary>
public int VIZ_Port
{
get { return viz_port; }
set { viz_port = value; this.RaisePropertyChanged(nameof(VIZ_Port)); }
}
#endregion
#region VIZ_UserName -- VIZ 用户名
private string viz_userName;
/// <summary>
/// VIZ 用户名
/// </summary>
public string VIZ_UserName
{
get { return viz_userName; }
set { viz_userName = value; this.RaisePropertyChanged(nameof(VIZ_UserName)); }
}
#endregion
#region VIZ_Password -- VIZ 密码
private string viz_password;
/// <summary>
/// VIZ 密码
/// </summary>
public string VIZ_Password
{
get { return viz_password; }
set { viz_password = value; this.RaisePropertyChanged(nameof(VIZ_Password)); }
}
#endregion
#region VIZ_Eng3Path -- VIZ 引擎3路径
private string viz_eng3path;
/// <summary>
/// VIZ 引擎3路径
/// </summary>
public string VIZ_Eng3Path
{
get { return viz_eng3path; }
set { viz_eng3path = value; this.RaisePropertyChanged(nameof(VIZ_Eng3Path)); }
}
#endregion
#region VIZ_Eng4Path -- VIZ 引擎4路径
private string viz_eng4path;
/// <summary>
/// VIZ 引擎4路径
/// </summary>
public string VIZ_Eng4Path
{
get { return viz_eng4path; }
set { viz_eng4path = value; this.RaisePropertyChanged(nameof(VIZ_Eng4Path)); }
}
#endregion
// =========================================================================
// Command
// =========================================================================
#region LoadedCommand -- 加载命令
/// <summary>
/// 加载命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载
/// </summary>
private void Loaded()
{
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
this.GH_IP = info.GH_IP;
this.GH_Port = info.GH_Port;
this.GH_ServerName = info.GH_ServerName;
this.GH_UserName = info.GH_UserName;
this.GH_Password = info.GH_Password;
this.VIZ_IP = info.VIZ_IP;
this.VIZ_Port = info.VIZ_Port;
this.VIZ_UserName = info.VIZ_UserName;
this.VIZ_Password = info.VIZ_Password;
this.VIZ_Eng3Path = info.VIZ_Eng3Path;
this.VIZ_Eng4Path = info.VIZ_Eng4Path;
}
#endregion
#region SelectEng3PathCommand -- 选择引擎3路径命令
/// <summary>
/// 选择引擎3路径命令
/// </summary>
public VCommand SelectEng3PathCommand { get; set; }
/// <summary>
/// 选择引擎3路径
/// </summary>
private void SelectEng3Path()
{
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
ofd.Multiselect = false;
ofd.Filter = "应用程序|*.exe";
if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
this.VIZ_Eng3Path = ofd.FileName;
}
#endregion
#region SelectEng4PathCommand -- 选择引擎4路径命令
/// <summary>
/// 选择引擎4路径命令
/// </summary>
public VCommand SelectEng4PathCommand { get; set; }
/// <summary>
/// 选择引擎4
/// </summary>
private void SelectEng4Path()
{
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
ofd.Multiselect = false;
ofd.Filter = "应用程序|*.exe";
if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
this.VIZ_Eng4Path = ofd.FileName;
}
#endregion
// =========================================================================
// Public Function
// =========================================================================
/// <summary>
/// 保存
/// </summary>
public void Save()
{
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
info.GH_IP = this.GH_IP;
info.GH_Port = this.GH_Port;
info.GH_ServerName = this.GH_ServerName;
info.GH_UserName = this.GH_UserName;
info.GH_Password = this.GH_Password;
info.VIZ_IP = this.VIZ_IP;
info.VIZ_Port = this.VIZ_Port;
info.VIZ_UserName = this.VIZ_UserName;
info.VIZ_Password = this.VIZ_Password;
info.VIZ_Eng3Path = this.VIZ_Eng3Path;
info.VIZ_Eng4Path = this.VIZ_Eng4Path;
ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.Upsert(info);
}
}
}
......@@ -174,6 +174,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SettingInner\Viz\View\VizSettingView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="SettingInner\Control\ViewModel\ControlSettingViewModel.cs" />
......@@ -261,6 +265,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Resource\MediaResource\MediaResourcePluginLifeCycle.cs" />
<Compile Include="SettingInner\Viz\ViewModel\VizSettingViewModel.cs" />
<Compile Include="Setting\ISettingViewModel.cs" />
<Compile Include="Setting\View\SettingWindow.xaml.cs">
<DependentUpon>SettingWindow.xaml</DependentUpon>
......@@ -290,6 +295,9 @@
<Compile Include="VizRender\View\VizRenderView.xaml.cs">
<DependentUpon>VizRenderView.xaml</DependentUpon>
</Compile>
<Compile Include="SettingInner\Viz\View\VizSettingView.xaml.cs">
<DependentUpon>VizSettingView.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
using log4net;
using DevExpress.Mvvm.Native;
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -64,7 +65,9 @@ namespace VIZ.TVP.Module
this.VizProcess = new Process();
this.VizProcess.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(config.FullPath);
this.VizProcess.StartInfo.FileName = System.IO.Path.GetFileName(config.FullPath);
this.VizProcess.StartInfo.Arguments = " -o -P -db Guest:@localhost/VizDbServer:19396";
// " -o -P -db Guest:@localhost/VizDbServer:19396"
LocalInfoEntity loginInfo = ApplicationDomainEx.DataBaseManager.LocalInfo;
this.VizProcess.StartInfo.Arguments = $" -o -P -db {loginInfo.GH_UserName}:@{loginInfo.GH_IP}/{loginInfo.GH_ServerName}:{loginInfo.GH_Port}";
this.VizProcess.StartInfo.UseShellExecute = true;
this.VizProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
this.VizProcess.Start();
......
......@@ -33,6 +33,9 @@ namespace VIZ.TVP.Storage
this.Database = new LiteDatabase(path);
// 本地信息
this.LocalInfo = this.Database.GetCollection<LocalInfoEntity>();
// 包装连接
this.TVPConnectionGroup = this.Database.GetCollection<TVPConnectionGroupEntity>();
this.TVPConnection = this.Database.GetCollection<TVPConnectionEntity>();
......@@ -45,10 +48,15 @@ namespace VIZ.TVP.Storage
public string Path { get; private set; }
// -----------------------------------------------------------------------------------------------------------
// -- 包装 --
// -- --
// -----------------------------------------------------------------------------------------------------------
/// <summary>
/// 本地信息
/// </summary>
public ILiteCollection<LocalInfoEntity> LocalInfo { get; private set; }
/// <summary>
/// 连接分组
/// </summary>
public ILiteCollection<TVPConnectionGroupEntity> TVPConnectionGroup { get; private set; }
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 本级引擎类型
/// </summary>
public enum LocalEngineType
{
/// <summary>
/// Viz引擎3
/// </summary>
[Description("Viz引擎3")]
Eng3,
/// <summary>
/// Viz引擎4
/// </summary>
[Description("Viz引擎4")]
Eng4
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 本地信息实体
/// </summary>
public class LocalInfoEntity
{
/// <summary>
/// 编号
/// </summary>
[LiteDB.BsonId(true)]
public int Id { get; set; }
/// <summary>
/// 本地引擎类型
/// </summary>
public LocalEngineType LocalEngineType { get; set; } = LocalEngineType.Eng3;
/// <summary>
/// GH IP地址
/// </summary>
public string GH_IP { get; set; } = "localhost";
/// <summary>
/// GH 端口
/// </summary>
public int GH_Port { get; set; } = 19396;
/// <summary>
/// GH 服务名
/// </summary>
public string GH_ServerName { get; set; } = "VizDbServer";
/// <summary>
/// GH 用户名
/// </summary>
public string GH_UserName { get; set; } = "Admin";
/// <summary>
/// GH 密码
/// </summary>
public string GH_Password { get; set; } = "VizDb";
/// <summary>
/// VIZ_IP
/// </summary>
public string VIZ_IP { get; set; } = "localhost";
/// <summary>
/// VIZ 端口
/// </summary>
public int VIZ_Port { get; set; } = 6100;
/// <summary>
/// VIZ用户名
/// </summary>
public string VIZ_UserName { get; set; } = "Guest";
/// <summary>
/// VIZ密码
/// </summary>
public string VIZ_Password { get; set; }
/// <summary>
/// VIZ 引擎3路径
/// </summary>
public string VIZ_Eng3Path { get; set; } = @"D:\Program Files (x86)\Vizrt\Viz3\viz.exe";
/// <summary>
/// VIZ 引擎4路径
/// </summary>
public string VIZ_Eng4Path { get; set; } = @"D:\Program Files (x86)\Vizrt\Viz3\viz.exe";
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -14,6 +15,7 @@ namespace VIZ.TVP.Storage
/// <summary>
/// VIZ
/// </summary>
[Description("VIZ引擎")]
VIZ
}
}
......@@ -70,6 +70,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="LiteDB\Application\LocalInfo\Enum\LocalEngineType.cs" />
<Compile Include="LiteDB\Application\LocalInfo\LocalInfoEntity.cs" />
<Compile Include="LiteDB\Application\TVPConnection\Enum\TVPEngineType.cs" />
<Compile Include="LiteDB\Application\TVPConnection\TVPConnectionEntity.cs" />
<Compile Include="LiteDB\Application\LiteDbContext.cs" />
......
......@@ -3,10 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:module="clr-namespace:VIZ.TVP.Module;assembly=VIZ.TVP.Module"
Title="咪咕播控系统" Height="600" Width="600" WindowStartupLocation="CenterScreen"
Title="咪咕播控系统" Height="420" Width="500" WindowStartupLocation="CenterScreen"
WindowStyle="SingleBorderWindow">
<Grid>
<module:LoginView></module:LoginView>
<module:LoginView Margin="20"></module:LoginView>
</Grid>
</dx:ThemedWindow>
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