Commit 1e46c374 by liulongfei

布局逻辑

parent 2f803579
...@@ -13,6 +13,11 @@ namespace VIZ.Package.Domain ...@@ -13,6 +13,11 @@ namespace VIZ.Package.Domain
public static class ApplicationConstants public static class ApplicationConstants
{ {
/// <summary> /// <summary>
/// 系统分组
/// </summary>
public const string APPLICATION_GROUP_NAME = "APPLICATION_GROUP";
/// <summary>
/// Viz 层集合 /// Viz 层集合
/// </summary> /// </summary>
public readonly static List<VizLayer> VIZ_LAYERS = new List<VizLayer> { VizLayer.FRONT_LAYER, VizLayer.MAIN_LAYER, VizLayer.BACK_LAYER }; public readonly static List<VizLayer> VIZ_LAYERS = new List<VizLayer> { VizLayer.FRONT_LAYER, VizLayer.MAIN_LAYER, VizLayer.BACK_LAYER };
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 系统关闭消息
/// </summary>
public class ApplicationCloseMessage
{
}
}
...@@ -3,6 +3,7 @@ using System.Collections.Generic; ...@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Storage; using VIZ.Package.Storage;
namespace VIZ.Package.Domain namespace VIZ.Package.Domain
...@@ -10,41 +11,105 @@ namespace VIZ.Package.Domain ...@@ -10,41 +11,105 @@ namespace VIZ.Package.Domain
/// <summary> /// <summary>
/// 插件信息 /// 插件信息
/// </summary> /// </summary>
public class PluginInfo public class PluginInfo : ModelBase
{ {
#region ID -- 插件ID
private string id;
/// <summary> /// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
public string ID { get; set; } public string ID
{
get { return id; }
set { id = value; this.RaisePropertyChanged(nameof(ID)); }
}
#endregion
#region Group -- 分组
private string group;
/// <summary> /// <summary>
/// 分组 /// 分组
/// </summary> /// </summary>
public string Group { get; set; } public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
#region Name -- 名称
private string name;
/// <summary> /// <summary>
/// 名称 /// 名称
/// </summary> /// </summary>
public string Name { get; set; } public string Name
{
get { return name; }
set { name = value; this.RaisePropertyChanged(nameof(Name)); }
}
#endregion
#region Remark -- 备注
private string remark;
/// <summary> /// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark
{
get { return remark; }
set { remark = value; this.RaisePropertyChanged(nameof(Remark)); }
}
#endregion
#region ViewType -- 视图类型
private Type viewType;
/// <summary> /// <summary>
/// 视图类型 /// 视图类型
/// </summary> /// </summary>
public Type ViewType { get; set; } public Type ViewType
{
get { return viewType; }
set { viewType = value; this.RaisePropertyChanged(nameof(ViewType)); }
}
#endregion
#region PluginType -- 插件类型
private PluginType pluginType;
/// <summary> /// <summary>
/// 插件类型 /// 插件类型
/// </summary> /// </summary>
public PluginType PluginType { get; set; } public PluginType PluginType
{
get { return pluginType; }
set { pluginType = value; this.RaisePropertyChanged(nameof(PluginType)); }
}
#endregion
#region IsClosed -- 是否关闭
private bool isClosed;
/// <summary> /// <summary>
/// 生命周期 /// 是否显示
/// </summary> /// </summary>
public IPluginLifeCycle LifeCycle { get; set; } public bool IsClosed
{
get { return isClosed; }
set { isClosed = value; this.RaisePropertyChanged(nameof(IsClosed)); }
}
#endregion
} }
} }
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
<Compile Include="Enum\ModulePluginIds.cs" /> <Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" /> <Compile Include="Enum\ViewServiceKeys.cs" />
<Compile Include="Info\VizTreeNodeInfo.cs" /> <Compile Include="Info\VizTreeNodeInfo.cs" />
<Compile Include="Message\Application\ApplicationCloseMessage.cs" />
<Compile Include="Message\Conn\ConnChangedMessage.cs" /> <Compile Include="Message\Conn\ConnChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" /> <Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" /> <Compile Include="Message\Page\PageOpenMessage.cs" />
......
<dx:ThemedWindow x:Class="VIZ.Package.Module.AboutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
Title="咪咕播控系统" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 系统名称 -->
<TextBlock Text="系统名称:" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Row="0" Grid.Column="0" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="咪咕播控系统" VerticalAlignment="Center" HorizontalAlignment="Left"
Grid.Row="0" Grid.Column="1"></TextBlock>
<!-- 系统版本 -->
<TextBlock Text="系统版本:" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Row="1" Grid.Column="0" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="V1.0.0.0" VerticalAlignment="Center" HorizontalAlignment="Left"
Grid.Row="1" Grid.Column="1"></TextBlock>
</Grid>
</dx:ThemedWindow>
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class ControlPluginLifeCycle : IPluginLifeCycle public class ControlPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(ControlView); info.ViewType = typeof(ControlView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class CommandPluginLifeCycle : IPluginLifeCycle public class CommandPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(CommandView); info.ViewType = typeof(CommandView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class FieldEditPluginLifeCycle : IPluginLifeCycle public class FieldEditPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(FieldEditView); info.ViewType = typeof(FieldEditView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class FieldTreePluginLifeCycle : IPluginLifeCycle public class FieldTreePluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(FieldTreeView); info.ViewType = typeof(FieldTreeView);
......
<dx:ThemedWindow x:Class="VIZ.Package.Module.AboutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
WindowStartupLocation="CenterScreen"
Title="咪咕播控系统" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 系统名称 -->
<TextBlock Text="系统名称:" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Row="0" Grid.Column="0" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="咪咕播控系统" VerticalAlignment="Center" HorizontalAlignment="Left"
Grid.Row="0" Grid.Column="1"></TextBlock>
<!-- 系统版本 -->
<TextBlock Text="系统版本:" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Row="1" Grid.Column="0" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="V1.0.0.0" VerticalAlignment="Center" HorizontalAlignment="Left"
Grid.Row="1" Grid.Column="1"></TextBlock>
</Grid>
</dx:ThemedWindow>
using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// Interaction logic for AboutWindow.xaml
/// </summary>
public partial class AboutWindow : ThemedWindow
{
public AboutWindow()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new AboutWindowModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// 关于窗口模型
/// </summary>
public class AboutWindowModel : ViewModelBase
{
}
}
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class LogPluginLifeCycle : IPluginLifeCycle public class LogPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(LogView); info.ViewType = typeof(LogView);
......
...@@ -262,7 +262,12 @@ namespace VIZ.Package.Module ...@@ -262,7 +262,12 @@ namespace VIZ.Package.Module
{ {
WPFHelper.Invoke(() => WPFHelper.Invoke(() =>
{ {
this.PluginGroups = ApplicationDomainEx.PluginInfos.GroupBy(p => p.Group).Select(p => p.Key).ToList(); this.PluginGroups = ApplicationDomainEx.PluginInfos
.Where(p => !string.IsNullOrWhiteSpace(p.Group) &&
p.Group != ApplicationConstants.APPLICATION_GROUP_NAME)
.GroupBy(p => p.Group)
.Select(p => p.Key)
.ToList();
this.SelectedPluginGroup = this.PluginGroups.FirstOrDefault(p => p == vizConfig.PluginGroup); this.SelectedPluginGroup = this.PluginGroups.FirstOrDefault(p => p == vizConfig.PluginGroup);
}); });
} }
......
...@@ -6,10 +6,27 @@ ...@@ -6,10 +6,27 @@
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
d:DataContext="{d:DesignInstance Type=local:MainTopViewModel}" d:DataContext="{d:DesignInstance Type=local:MainTopViewModel}"
xmlns:local="clr-namespace:VIZ.Package.Module" xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d" mc:Ignorable="d" x:Name="uc"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<fcore:Bool2BoolConverterSimple x:Key="Bool2BoolConverterSimple"></fcore:Bool2BoolConverterSimple>
<DataTemplate x:Key="ViewItemTemplate">
<ContentControl>
<dxb:BarCheckItem Content="{Binding Name}"
IsChecked="{Binding Path=IsClosed,Mode=TwoWay,Converter={StaticResource Bool2BoolConverterSimple}}"></dxb:BarCheckItem>
</ContentControl>
</DataTemplate>
</UserControl.Resources>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<dxb:MainMenuControl Caption="MainMenu" VerticalAlignment="Center"> <dxb:MainMenuControl Caption="MainMenu" VerticalAlignment="Center">
<dxb:BarSubItem Content="项目" IsEnabled="{Binding Path=IsVizPreviewReady}"> <dxb:BarSubItem Content="项目" IsEnabled="{Binding Path=IsVizPreviewReady}">
...@@ -20,9 +37,14 @@ ...@@ -20,9 +37,14 @@
</dxb:BarSubItem> </dxb:BarSubItem>
<dxb:BarSubItem Content="设置" Command="{Binding Path=SettingCommand}"> <dxb:BarSubItem Content="设置" Command="{Binding Path=SettingCommand}">
</dxb:BarSubItem> </dxb:BarSubItem>
<dxb:BarSubItem Content="视图" ItemLinksSource="{Binding Path=ItemsSource}" ItemTemplate="{StaticResource ViewItemTemplate}">
</dxb:BarSubItem>
<dxb:BarSubItem Content="布局">
<dxb:BarButtonItem Content="重置布局" Command="{Binding Path=ResetLayoutCommand}" />
</dxb:BarSubItem>
<dxb:BarSubItem Content="帮助"> <dxb:BarSubItem Content="帮助">
<dxb:BarButtonItem Content="关于" /> <dxb:BarButtonItem Content="关于" Command="{Binding Path=AboutCommand}"/>
</dxb:BarSubItem> </dxb:BarSubItem>
</dxb:MainMenuControl> </dxb:MainMenuControl>
</StackPanel> </StackPanel>
</UserControl> </UserControl>
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking" xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:plugin="clr-namespace:VIZ.Package.Plugin;assembly=VIZ.Package.Plugin" xmlns:plugin="clr-namespace:VIZ.Package.Plugin;assembly=VIZ.Package.Plugin"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain" xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
xmlns:local="clr-namespace:VIZ.Package.Module" xmlns:local="clr-namespace:VIZ.Package.Module"
...@@ -15,18 +16,21 @@ ...@@ -15,18 +16,21 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources> <UserControl.Resources>
<DataTemplate DataType="{x:Type domain:PluginInfo}"> <DataTemplate DataType="{x:Type domain:PluginInfo}">
<plugin:PluginLoader ViewType="{Binding ViewType,Mode=OneWay}"></plugin:PluginLoader> <plugin:PluginLoader ViewType="{Binding ViewType,Mode=OneWay}"></plugin:PluginLoader>
</DataTemplate> </DataTemplate>
<Style TargetType="{x:Type dxdo:LayoutPanel}"> <Style TargetType="{x:Type dxdo:LayoutPanel}">
<Setter Property="BindableName" Value="{Binding ID}" /> <Setter Property="BindableName" Value="{Binding ID}" />
<Setter Property="Caption" Value="{Binding Name}" /> <Setter Property="Caption" Value="{Binding Name}" />
<Setter Property="ShowCloseButton" Value="False"></Setter> <Setter Property="ShowCloseButton" Value="True"></Setter>
<Setter Property="Closed" Value="{Binding Path=IsClosed,Mode=TwoWay}"></Setter>
</Style> </Style>
<Style TargetType="{x:Type dxdo:DocumentPanel}"> <Style TargetType="{x:Type dxdo:DocumentPanel}">
<Setter Property="BindableName" Value="{Binding ID}" /> <Setter Property="BindableName" Value="{Binding ID}" />
<Setter Property="Caption" Value="{Binding Name}" /> <Setter Property="Caption" Value="{Binding Name}" />
<Setter Property="ShowCloseButton" Value="False"></Setter> <Setter Property="ShowCloseButton" Value="True"></Setter>
<Setter Property="Closed" Value="{Binding Path=IsClosed,Mode=TwoWay}"></Setter>
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
......
using DevExpress.Xpf.Core; using DevExpress.Xpf.Bars;
using DevExpress.Xpf.Core;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -8,6 +10,7 @@ using System.Windows.Forms; ...@@ -8,6 +10,7 @@ using System.Windows.Forms;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Storage; using VIZ.Package.Storage;
using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -30,12 +33,16 @@ namespace VIZ.Package.Module ...@@ -30,12 +33,16 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void InitCommand() private void InitCommand()
{ {
this.LoadedCommand = new VCommand(this.Loaded);
this.CreateProjectCommand = new VCommand(this.CreateProject); this.CreateProjectCommand = new VCommand(this.CreateProject);
this.OpenProjectCommand = new VCommand(this.OpenProject); this.OpenProjectCommand = new VCommand(this.OpenProject);
this.SaveProjectCommand = new VCommand(this.SaveProject, this.CanSaveProject); this.SaveProjectCommand = new VCommand(this.SaveProject, this.CanSaveProject);
this.CloseProjectCommand = new VCommand(this.CloseProject, this.CanCloseProject); this.CloseProjectCommand = new VCommand(this.CloseProject, this.CanCloseProject);
this.SettingCommand = new VCommand(this.Setting); this.SettingCommand = new VCommand(this.Setting);
this.ResetLayoutCommand = new VCommand(this.ResetLayout);
this.AboutCommand = new VCommand(this.About);
} }
/// <summary> /// <summary>
...@@ -78,10 +85,48 @@ namespace VIZ.Package.Module ...@@ -78,10 +85,48 @@ namespace VIZ.Package.Module
#endregion #endregion
#region ItemsSource -- 视图项
private ObservableCollection<PluginInfo> itemsSource;
/// <summary>
/// 视图项
/// </summary>
public ObservableCollection<PluginInfo> ItemsSource
{
get { return itemsSource; }
set { itemsSource = value; this.RaisePropertyChanged(nameof(ItemsSource)); }
}
#endregion
// ===================================================================== // =====================================================================
// Command // Command
// ===================================================================== // =====================================================================
#region LoadedCommand -- 加载命令
/// <summary>
/// 加载命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载
/// </summary>
private void Loaded()
{
if (this.IsAlreadyLoaded)
return;
this.IsAlreadyLoaded = true;
this.ItemsSource = ApplicationDomainEx.PluginInfos.Where(p => (p.Group == ApplicationConstants.APPLICATION_GROUP_NAME ||
p.Group == ApplicationDomainEx.VizConfig.PluginGroup) &&
p.PluginType == PluginType.Module).ToObservableCollection();
}
#endregion
#region CreateProjectCommand -- 创建项目命令 #region CreateProjectCommand -- 创建项目命令
/// <summary> /// <summary>
...@@ -260,6 +305,46 @@ namespace VIZ.Package.Module ...@@ -260,6 +305,46 @@ namespace VIZ.Package.Module
#endregion #endregion
#region ResetLayoutCommand -- 重置布局命令
/// <summary>
/// 重置布局命令
/// </summary>
public VCommand ResetLayoutCommand { get; set; }
/// <summary>
/// 重置布局
/// </summary>
private void ResetLayout()
{
IMainViewService service = ApplicationDomainEx.ServiceManager.GetService<IMainViewService>(ViewServiceKeys.MAIN_VIEW_SERVICE);
if (service == null)
return;
service.LoadLayout();
}
#endregion
#region AboutCommand -- 关于命令
/// <summary>
/// 关于命令
/// </summary>
public VCommand AboutCommand { get; set; }
/// <summary>
/// 关于
/// </summary>
private void About()
{
AboutWindow window = new AboutWindow();
window.Owner = ApplicationDomainEx.MainWindow;
window.ShowDialog();
}
#endregion
// ===================================================================== // =====================================================================
// Message // Message
// ===================================================================== // =====================================================================
......
...@@ -7,6 +7,7 @@ using System.Threading.Tasks; ...@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Plugin; using VIZ.Package.Plugin;
using VIZ.Package.Storage;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -17,10 +18,14 @@ namespace VIZ.Package.Module ...@@ -17,10 +18,14 @@ namespace VIZ.Package.Module
{ {
public MainViewModel() public MainViewModel()
{ {
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.MAIN_VIEW_SERVICE, this);
// 初始化命令 // 初始化命令
this.InitCommand(); this.InitCommand();
// 初始化消息
this.InitMessage();
// 注册服务
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.MAIN_VIEW_SERVICE, this);
} }
/// <summary> /// <summary>
...@@ -31,6 +36,14 @@ namespace VIZ.Package.Module ...@@ -31,6 +36,14 @@ namespace VIZ.Package.Module
this.LoadedCommand = new VCommand(this.Loaded); this.LoadedCommand = new VCommand(this.Loaded);
} }
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage);
}
// ============================================================ // ============================================================
// Service & Controller // Service & Controller
// ============================================================ // ============================================================
...@@ -41,7 +54,7 @@ namespace VIZ.Package.Module ...@@ -41,7 +54,7 @@ namespace VIZ.Package.Module
#region ItemsSource -- 视图项 #region ItemsSource -- 视图项
private ObservableCollection<PluginInfo> itemsSource = ApplicationDomainEx.PluginInfos.Where(p => p.PluginType == PluginType.Module).ToObservableCollection(); private ObservableCollection<PluginInfo> itemsSource;
/// <summary> /// <summary>
/// 视图项 /// 视图项
/// </summary> /// </summary>
...@@ -74,12 +87,34 @@ namespace VIZ.Package.Module ...@@ -74,12 +87,34 @@ namespace VIZ.Package.Module
this.IsAlreadyLoaded = true; this.IsAlreadyLoaded = true;
this.ItemsSource = ApplicationDomainEx.PluginInfos.Where(p => (p.Group == ApplicationConstants.APPLICATION_GROUP_NAME ||
p.Group == ApplicationDomainEx.VizConfig.PluginGroup) &&
p.PluginType == PluginType.Module).ToObservableCollection();
// 加载布局
this.LoadLayout(); this.LoadLayout();
//
} }
#endregion #endregion
// ============================================================ // ============================================================
// Message
// ============================================================
/// <summary>
/// 系统关闭消息
/// </summary>
/// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg)
{
// 保存布局
this.SaveLayout();
}
// ============================================================
// Public Function // Public Function
// ============================================================ // ============================================================
...@@ -92,7 +127,15 @@ namespace VIZ.Package.Module ...@@ -92,7 +127,15 @@ namespace VIZ.Package.Module
if (view == null) if (view == null)
return; return;
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout.xml"); string path = this.GetLayoutPath();
// 创建布局文件文件夹
string dir = System.IO.Path.GetDirectoryName(path);
if (!System.IO.Directory.Exists(dir))
{
System.IO.Directory.CreateDirectory(dir);
}
view.dockLayoutManager.SaveLayoutToXml(path); view.dockLayoutManager.SaveLayoutToXml(path);
} }
...@@ -105,8 +148,74 @@ namespace VIZ.Package.Module ...@@ -105,8 +148,74 @@ namespace VIZ.Package.Module
if (view == null) if (view == null)
return; return;
string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout.xml"); // 获取当前布局文件路径
string path = this.GetLayoutPath();
// 如果没有布局文件,那么尝试使用默认布局文件
if (string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path))
{
path = this.GetDefaultLayoutPath();
}
// 如果没有对应插件布局文件,那么尝试使用系统默认布局文件
if (string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path))
{
path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout", "default_layout.xml");
}
// 如果布局文件不存在,那么不加载布局
if (!System.IO.File.Exists(path))
{
return;
}
view.dockLayoutManager.RestoreLayoutFromXml(path); view.dockLayoutManager.RestoreLayoutFromXml(path);
} }
// ============================================================
// Private Function
// ============================================================
/// <summary>
/// 获取布局文件路径
/// </summary>
/// <returns>布局文件路径</returns>
private string GetLayoutPath()
{
string path;
if (string.IsNullOrWhiteSpace(ApplicationDomainEx.VizConfig.PluginGroup))
{
path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout", "layout.xml");
}
else
{
path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout", ApplicationDomainEx.VizConfig.PluginGroup, "layout.xml");
}
return path;
}
/// <summary>
/// 获取默认布局文件路径
/// </summary>
/// <returns>默认布局文件路径</returns>
private string GetDefaultLayoutPath()
{
string path;
if (string.IsNullOrWhiteSpace(ApplicationDomainEx.VizConfig.PluginGroup))
{
path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout", "default_layout.xml");
}
else
{
path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "layout", ApplicationDomainEx.VizConfig.PluginGroup, "default_layout.xml");
}
return path;
}
} }
} }
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class PageGroupPluginLifeCycle : IPluginLifeCycle public class PageGroupPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(PageGroupView); info.ViewType = typeof(PageGroupView);
......
...@@ -124,6 +124,7 @@ namespace VIZ.Package.Module ...@@ -124,6 +124,7 @@ namespace VIZ.Package.Module
{ {
this.TemplatePlugins = ApplicationDomainEx.PluginInfos.Where( this.TemplatePlugins = ApplicationDomainEx.PluginInfos.Where(
p => !string.IsNullOrWhiteSpace(p.Group) && p => !string.IsNullOrWhiteSpace(p.Group) &&
p.Group != ApplicationConstants.APPLICATION_GROUP_NAME &&
p.Group == ApplicationDomainEx.VizConfig.PluginGroup && p.Group == ApplicationDomainEx.VizConfig.PluginGroup &&
p.PluginType == PluginType.Page).ToList(); p.PluginType == PluginType.Page).ToList();
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class PageTemplatePluginLifeCycle : IPluginLifeCycle public class PageTemplatePluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(PageTemplateView); info.ViewType = typeof(PageTemplateView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class PluginPluginLifeCycle : IPluginLifeCycle public class PluginPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(PluginView); info.ViewType = typeof(PluginView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class VizPreviewPluginLifeCycle : IPluginLifeCycle public class VizPreviewPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(VizPreviewView); info.ViewType = typeof(VizPreviewView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class GHScenePluginLifeCycle : IPluginLifeCycle public class GHScenePluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(GHSceneView); info.ViewType = typeof(GHSceneView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class MediaResourcePluginLifeCycle : IPluginLifeCycle public class MediaResourcePluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(MediaResourceView); info.ViewType = typeof(MediaResourceView);
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class ConnPluginLifeCycle : IPluginLifeCycle public class ConnPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Setting; info.PluginType = PluginType.Setting;
......
...@@ -94,7 +94,8 @@ namespace VIZ.Package.Module ...@@ -94,7 +94,8 @@ namespace VIZ.Package.Module
this.IsAlreadyLoaded = true; this.IsAlreadyLoaded = true;
var settings = ApplicationDomainEx.PluginInfos.Where(p => p.PluginType == PluginType.Setting); var settings = ApplicationDomainEx.PluginInfos.Where(p => p.PluginType == PluginType.Setting &&
!string.IsNullOrWhiteSpace(p.Group));
foreach (var item in settings) foreach (var item in settings)
{ {
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class MediaSettingPluginLifeCycle : IPluginLifeCycle public class MediaSettingPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module ...@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Setting; info.PluginType = PluginType.Setting;
......
...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class VizConfigSettingPluginLifeCycle : IPluginLifeCycle public class VizConfigSettingPluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID /// 插件ID
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -33,11 +38,12 @@ namespace VIZ.Package.Module ...@@ -33,11 +38,12 @@ namespace VIZ.Package.Module
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Setting; info.PluginType = PluginType.Setting;
info.ViewType = typeof(VizConfigSettingView); info.ViewType = typeof(VizConfigSettingView);
return info; return info;
} }
......
...@@ -90,6 +90,10 @@ ...@@ -90,6 +90,10 @@
<Reference Include="WindowsFormsIntegration" /> <Reference Include="WindowsFormsIntegration" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Help\About\View\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Help\About\ViewModel\AboutWindowModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ResourceEdit\MHResourceEditPartModel.cs" /> <Compile Include="ControlObject\FieldEdit\Edit\ResourceEdit\MHResourceEditPartModel.cs" />
<Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" /> <Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" /> <Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
...@@ -330,6 +334,10 @@ ...@@ -330,6 +334,10 @@
<Folder Include="Main\Controller\" /> <Folder Include="Main\Controller\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="Help\About\View\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Main\View\MainConnView.xaml"> <Page Include="Main\View\MainConnView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
using VIZ.Package.Plugin;
namespace VIZ.Package.TestPlugin
{
/// <summary>
/// 测试模块插件生命周期
/// </summary>
public class TestModulePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.ID = "TestModulePlugin";
info.Name = "测试模块插件";
info.Group = "测试";
info.PluginType = PluginType.Module;
info.ViewType = typeof(TestModuleView);
return info;
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
}
}
}
<UserControl x:Class="VIZ.Package.TestPlugin.TestView" <UserControl x:Class="VIZ.Package.TestPlugin.TestModuleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<TextBlock Text="TestPlugin" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red" <TextBlock Text="TestModulePlugin" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red"
FontSize="36"></TextBlock> FontSize="36"></TextBlock>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -17,15 +17,15 @@ using VIZ.Framework.Core; ...@@ -17,15 +17,15 @@ using VIZ.Framework.Core;
namespace VIZ.Package.TestPlugin namespace VIZ.Package.TestPlugin
{ {
/// <summary> /// <summary>
/// TestView.xaml 的交互逻辑 /// TestModuleView.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class TestView : UserControl public partial class TestModuleView : UserControl
{ {
public TestView() public TestModuleView()
{ {
InitializeComponent(); InitializeComponent();
WPFHelper.BindingViewModel(this, new TestViewModel()); WPFHelper.BindingViewModel(this, new TestModuleViewModel());
} }
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.TestPlugin
{
/// <summary>
/// 测试模块视图模型
/// </summary>
public class TestModuleViewModel : ViewModelBase
{
}
}
...@@ -9,9 +9,9 @@ using VIZ.Package.Plugin; ...@@ -9,9 +9,9 @@ using VIZ.Package.Plugin;
namespace VIZ.Package.TestPlugin namespace VIZ.Package.TestPlugin
{ {
/// <summary> /// <summary>
/// 日志插件生命周期 /// 测试页插件生命周期
/// </summary> /// </summary>
public class TestPluginLifeCycle : IPluginLifeCycle public class TestPagePluginLifeCycle : IPluginLifeCycle
{ {
/// <summary> /// <summary>
/// 注册 /// 注册
...@@ -20,11 +20,11 @@ namespace VIZ.Package.TestPlugin ...@@ -20,11 +20,11 @@ namespace VIZ.Package.TestPlugin
public PluginInfo Register() public PluginInfo Register()
{ {
PluginInfo info = new PluginInfo(); PluginInfo info = new PluginInfo();
info.ID = "TestPlugin"; info.ID = "TestPagePlugin";
info.Name = "测试插件"; info.Name = "测试插件";
info.Group = "测试"; info.Group = "测试";
info.PluginType = PluginType.Page; info.PluginType = PluginType.Page;
info.ViewType = typeof(TestView); info.ViewType = typeof(TestPageView);
return info; return info;
} }
......
<UserControl x:Class="VIZ.Package.TestPlugin.TestPageView"
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:local="clr-namespace:VIZ.Package.TestPlugin"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="TestPagePlugin" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red"
FontSize="36"></TextBlock>
</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.Package.TestPlugin
{
/// <summary>
/// TestPageView.xaml 的交互逻辑
/// </summary>
public partial class TestPageView : UserControl
{
public TestPageView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new TestPageViewModel());
}
}
}
...@@ -7,7 +7,7 @@ using VIZ.Framework.Core; ...@@ -7,7 +7,7 @@ using VIZ.Framework.Core;
namespace VIZ.Package.TestPlugin namespace VIZ.Package.TestPlugin
{ {
public class TestViewModel : ViewModelBase public class TestPageViewModel : ViewModelBase
{ {
} }
} }
...@@ -66,7 +66,9 @@ ...@@ -66,7 +66,9 @@
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="TestPluginLifeCycle.cs" /> <Compile Include="Module\TestModuleViewModel.cs" />
<Compile Include="Module\TestModulePluginLifeCycle.cs" />
<Compile Include="Page\TestPagePluginLifeCycle.cs" />
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
...@@ -80,10 +82,13 @@ ...@@ -80,10 +82,13 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Include="TestView.xaml.cs"> <Compile Include="Page\TestPageView.xaml.cs">
<DependentUpon>TestView.xaml</DependentUpon> <DependentUpon>TestPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Page\TestPageViewModel.cs" />
<Compile Include="Module\TestModuleView.xaml.cs">
<DependentUpon>TestModuleView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="TestViewModel.cs" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
...@@ -94,7 +99,11 @@ ...@@ -94,7 +99,11 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="TestView.xaml"> <Page Include="Page\TestPageView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Module\TestModuleView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
......
using DevExpress.Xpf.Core; using DevExpress.Xpf.Core;
using log4net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -21,6 +22,11 @@ namespace VIZ.Package ...@@ -21,6 +22,11 @@ namespace VIZ.Package
/// </summary> /// </summary>
public partial class MainWindow : ThemedWindow public partial class MainWindow : ThemedWindow
{ {
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(MainWindow));
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
...@@ -33,8 +39,21 @@ namespace VIZ.Package ...@@ -33,8 +39,21 @@ namespace VIZ.Package
/// </summary> /// </summary>
private void MainWindow_Closed(object sender, EventArgs e) private void MainWindow_Closed(object sender, EventArgs e)
{ {
// 发送系统关闭消息
try
{
ApplicationCloseMessage msg = new ApplicationCloseMessage();
ApplicationDomainEx.MessageManager.Send(msg);
}
catch (Exception ex)
{
log.Error(ex);
}
// 启动结束流程
AppSetup.ShutDown(); AppSetup.ShutDown();
// 结束进程
Environment.Exit(0); Environment.Exit(0);
} }
} }
......
...@@ -201,6 +201,11 @@ ...@@ -201,6 +201,11 @@
<Name>VIZ.Package.Storage</Name> <Name>VIZ.Package.Storage</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="layout\default_layout.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>echo ========================================================== <PostBuildEvent>echo ==========================================================
......
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