Commit 1e46c374 by liulongfei

布局逻辑

parent 2f803579
......@@ -13,6 +13,11 @@ namespace VIZ.Package.Domain
public static class ApplicationConstants
{
/// <summary>
/// 系统分组
/// </summary>
public const string APPLICATION_GROUP_NAME = "APPLICATION_GROUP";
/// <summary>
/// Viz 层集合
/// </summary>
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;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Storage;
namespace VIZ.Package.Domain
......@@ -10,41 +11,105 @@ namespace VIZ.Package.Domain
/// <summary>
/// 插件信息
/// </summary>
public class PluginInfo
public class PluginInfo : ModelBase
{
#region ID -- 插件ID
private string id;
/// <summary>
/// 插件ID
/// </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>
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>
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>
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>
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>
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>
public IPluginLifeCycle LifeCycle { get; set; }
public bool IsClosed
{
get { return isClosed; }
set { isClosed = value; this.RaisePropertyChanged(nameof(IsClosed)); }
}
#endregion
}
}
......@@ -78,6 +78,7 @@
<Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" />
<Compile Include="Info\VizTreeNodeInfo.cs" />
<Compile Include="Message\Application\ApplicationCloseMessage.cs" />
<Compile Include="Message\Conn\ConnChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlFieldChangedMessage.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
public class ControlPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(ControlView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class CommandPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(CommandView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class FieldEditPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(FieldEditView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class FieldTreePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
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
public class LogPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(LogView);
......
......@@ -262,7 +262,12 @@ namespace VIZ.Package.Module
{
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);
});
}
......
......@@ -6,10 +6,27 @@
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
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}"
xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d"
mc:Ignorable="d" x:Name="uc"
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">
<dxb:MainMenuControl Caption="MainMenu" VerticalAlignment="Center">
<dxb:BarSubItem Content="项目" IsEnabled="{Binding Path=IsVizPreviewReady}">
......@@ -20,8 +37,13 @@
</dxb:BarSubItem>
<dxb:BarSubItem Content="设置" Command="{Binding Path=SettingCommand}">
</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:BarButtonItem Content="关于" />
<dxb:BarButtonItem Content="关于" Command="{Binding Path=AboutCommand}"/>
</dxb:BarSubItem>
</dxb:MainMenuControl>
</StackPanel>
......
......@@ -8,6 +8,7 @@
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
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:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
xmlns:local="clr-namespace:VIZ.Package.Module"
......@@ -15,18 +16,21 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<DataTemplate DataType="{x:Type domain:PluginInfo}">
<plugin:PluginLoader ViewType="{Binding ViewType,Mode=OneWay}"></plugin:PluginLoader>
</DataTemplate>
<Style TargetType="{x:Type dxdo:LayoutPanel}">
<Setter Property="BindableName" Value="{Binding ID}" />
<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 TargetType="{x:Type dxdo:DocumentPanel}">
<Setter Property="BindableName" Value="{Binding ID}" />
<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>
</UserControl.Resources>
......
using DevExpress.Xpf.Core;
using DevExpress.Xpf.Bars;
using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -8,6 +10,7 @@ using System.Windows.Forms;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames;
namespace VIZ.Package.Module
{
......@@ -30,12 +33,16 @@ namespace VIZ.Package.Module
/// </summary>
private void InitCommand()
{
this.LoadedCommand = new VCommand(this.Loaded);
this.CreateProjectCommand = new VCommand(this.CreateProject);
this.OpenProjectCommand = new VCommand(this.OpenProject);
this.SaveProjectCommand = new VCommand(this.SaveProject, this.CanSaveProject);
this.CloseProjectCommand = new VCommand(this.CloseProject, this.CanCloseProject);
this.SettingCommand = new VCommand(this.Setting);
this.ResetLayoutCommand = new VCommand(this.ResetLayout);
this.AboutCommand = new VCommand(this.About);
}
/// <summary>
......@@ -78,10 +85,48 @@ namespace VIZ.Package.Module
#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
// =====================================================================
#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 -- 创建项目命令
/// <summary>
......@@ -260,6 +305,46 @@ namespace VIZ.Package.Module
#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
// =====================================================================
......
......@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Plugin;
using VIZ.Package.Storage;
namespace VIZ.Package.Module
{
......@@ -17,10 +18,14 @@ namespace VIZ.Package.Module
{
public MainViewModel()
{
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.MAIN_VIEW_SERVICE, this);
// 初始化命令
this.InitCommand();
// 初始化消息
this.InitMessage();
// 注册服务
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.MAIN_VIEW_SERVICE, this);
}
/// <summary>
......@@ -31,6 +36,14 @@ namespace VIZ.Package.Module
this.LoadedCommand = new VCommand(this.Loaded);
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage);
}
// ============================================================
// Service & Controller
// ============================================================
......@@ -41,7 +54,7 @@ namespace VIZ.Package.Module
#region ItemsSource -- 视图项
private ObservableCollection<PluginInfo> itemsSource = ApplicationDomainEx.PluginInfos.Where(p => p.PluginType == PluginType.Module).ToObservableCollection();
private ObservableCollection<PluginInfo> itemsSource;
/// <summary>
/// 视图项
/// </summary>
......@@ -74,12 +87,34 @@ namespace VIZ.Package.Module
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();
//
}
#endregion
// ============================================================
// Message
// ============================================================
/// <summary>
/// 系统关闭消息
/// </summary>
/// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg)
{
// 保存布局
this.SaveLayout();
}
// ============================================================
// Public Function
// ============================================================
......@@ -92,7 +127,15 @@ namespace VIZ.Package.Module
if (view == null)
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);
}
......@@ -105,8 +148,74 @@ namespace VIZ.Package.Module
if (view == null)
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);
}
// ============================================================
// 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
public class PageGroupPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(PageGroupView);
......
......@@ -124,6 +124,7 @@ namespace VIZ.Package.Module
{
this.TemplatePlugins = ApplicationDomainEx.PluginInfos.Where(
p => !string.IsNullOrWhiteSpace(p.Group) &&
p.Group != ApplicationConstants.APPLICATION_GROUP_NAME &&
p.Group == ApplicationDomainEx.VizConfig.PluginGroup &&
p.PluginType == PluginType.Page).ToList();
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class PageTemplatePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(PageTemplateView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class PluginPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(PluginView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class VizPreviewPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(VizPreviewView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class GHScenePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(GHSceneView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class MediaResourcePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(MediaResourceView);
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class ConnPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Setting;
......
......@@ -94,7 +94,8 @@ namespace VIZ.Package.Module
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)
{
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class MediaSettingPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Setting;
......
......@@ -14,6 +14,11 @@ namespace VIZ.Package.Module
public class VizConfigSettingPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
......@@ -33,6 +38,7 @@ namespace VIZ.Package.Module
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Setting;
......
......@@ -90,6 +90,10 @@
<Reference Include="WindowsFormsIntegration" />
</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\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
......@@ -330,6 +334,10 @@
<Folder Include="Main\Controller\" />
</ItemGroup>
<ItemGroup>
<Page Include="Help\About\View\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Main\View\MainConnView.xaml">
<SubType>Designer</SubType>
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
......@@ -7,7 +7,7 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="TestPlugin" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red"
<TextBlock Text="TestModulePlugin" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Red"
FontSize="36"></TextBlock>
</Grid>
</UserControl>
......@@ -17,15 +17,15 @@ using VIZ.Framework.Core;
namespace VIZ.Package.TestPlugin
{
/// <summary>
/// TestView.xaml 的交互逻辑
/// TestModuleView.xaml 的交互逻辑
/// </summary>
public partial class TestView : UserControl
public partial class TestModuleView : UserControl
{
public TestView()
public TestModuleView()
{
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;
namespace VIZ.Package.TestPlugin
{
/// <summary>
/// 日志插件生命周期
/// 测试页插件生命周期
/// </summary>
public class TestPluginLifeCycle : IPluginLifeCycle
public class TestPagePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 注册
......@@ -20,11 +20,11 @@ namespace VIZ.Package.TestPlugin
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.ID = "TestPlugin";
info.Name = "测试插件";
info.ID = "TestPagePlugin";
info.Name = "测试插件";
info.Group = "测试";
info.PluginType = PluginType.Page;
info.ViewType = typeof(TestView);
info.ViewType = typeof(TestPageView);
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;
namespace VIZ.Package.TestPlugin
{
public class TestViewModel : ViewModelBase
public class TestPageViewModel : ViewModelBase
{
}
}
......@@ -66,7 +66,9 @@
<Reference Include="PresentationFramework" />
</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">
<SubType>Code</SubType>
</Compile>
......@@ -80,10 +82,13 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="TestView.xaml.cs">
<DependentUpon>TestView.xaml</DependentUpon>
<Compile Include="Page\TestPageView.xaml.cs">
<DependentUpon>TestPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Page\TestPageViewModel.cs" />
<Compile Include="Module\TestModuleView.xaml.cs">
<DependentUpon>TestModuleView.xaml</DependentUpon>
</Compile>
<Compile Include="TestViewModel.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -94,7 +99,11 @@
</None>
</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>
<Generator>MSBuild:Compile</Generator>
</Page>
......
using DevExpress.Xpf.Core;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -21,6 +22,11 @@ namespace VIZ.Package
/// </summary>
public partial class MainWindow : ThemedWindow
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(MainWindow));
public MainWindow()
{
InitializeComponent();
......@@ -33,8 +39,21 @@ namespace VIZ.Package
/// </summary>
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();
// 结束进程
Environment.Exit(0);
}
}
......
......@@ -201,6 +201,11 @@
<Name>VIZ.Package.Storage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="layout\default_layout.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<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