Commit e8f8a419 by liulongfei

添加页编号

parent 331a29fb
...@@ -9,11 +9,8 @@ namespace VIZ.Package.Domain ...@@ -9,11 +9,8 @@ namespace VIZ.Package.Domain
/// <summary> /// <summary>
/// 系统关闭消息 /// 系统关闭消息
/// </summary> /// </summary>
public class ApplicationCloseMessage public class ApplicationClosedMessage
{ {
/// <summary>
/// 是否取消关闭
/// </summary>
public bool IsCancel { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 应用程序关闭之前消息
/// </summary>
public class ApplicationClosingMessage
{
/// <summary>
/// 是否取消
/// </summary>
public bool Cancel { get; set; }
}
}
...@@ -82,5 +82,19 @@ namespace VIZ.Package.Domain ...@@ -82,5 +82,19 @@ namespace VIZ.Package.Domain
} }
#endregion #endregion
#region PageNum -- 页号
private int pageNum;
/// <summary>
/// 页号
/// </summary>
public int PageNum
{
get { return pageNum; }
set { pageNum = value; this.RaisePropertyChanged(nameof(PageNum)); }
}
#endregion
} }
} }
...@@ -78,7 +78,8 @@ ...@@ -78,7 +78,8 @@
<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\Application\ApplicationClosedMessage.cs" />
<Compile Include="Message\Application\ApplicationClosingMessage.cs" />
<Compile Include="Message\Conn\ConnChangedMessage.cs" /> <Compile Include="Message\Conn\ConnChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlListFieldChangedMessage.cs" /> <Compile Include="Message\ControlObject\ControlListFieldChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" /> <Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" />
......
...@@ -28,11 +28,13 @@ ...@@ -28,11 +28,13 @@
<Border Background="#11FFFFFF" Grid.Row="0"> <Border Background="#11FFFFFF" Grid.Row="0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" > <StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
<TextBlock Text="页:" Margin="8,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock> <TextBlock Text="页:" Margin="8,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding PageID}" Margin="5,0,0,0" d:Foreground="White"></TextBlock> <TextBlock Text="{Binding PageID}" Margin="10,0,0,0" MinWidth="40" d:Foreground="White"></TextBlock>
<TextBlock Text="场景:" Margin="30,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock> <TextBlock Text="场景:" Margin="40,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding Scene}" Margin="5,0,0,0" d:Foreground="White"></TextBlock> <TextBlock Text="{Binding Scene}" Margin="10,0,0,0" MinWidth="80" d:Foreground="White"></TextBlock>
<TextBlock Text="字段:" Margin="30,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock> <TextBlock Text="字段:" Margin="40,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding Path=ControlField.FieldIdentifier}" Margin="5,0,0,0" d:Foreground="White"></TextBlock> <TextBlock Text="{Binding Path=ControlField.FieldIdentifier}" MinWidth="80" Margin="10,0,0,0" d:Foreground="White"></TextBlock>
<TextBlock Text="字段描述:" Margin="40,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding Path=ControlField.Description}" Margin="10,0,0,0" d:Foreground="White"></TextBlock>
</StackPanel> </StackPanel>
</Border> </Border>
<!-- 按钮组 --> <!-- 按钮组 -->
......
...@@ -92,11 +92,11 @@ namespace VIZ.Package.Module ...@@ -92,11 +92,11 @@ namespace VIZ.Package.Module
#region PageID -- ID #region PageID -- ID
private int? pageID; private string pageID;
/// <summary> /// <summary>
/// 页ID /// 页ID
/// </summary> /// </summary>
public int? PageID public string PageID
{ {
get { return pageID; } get { return pageID; }
set { pageID = value; this.RaisePropertyChanged(nameof(PageID)); } set { pageID = value; this.RaisePropertyChanged(nameof(PageID)); }
...@@ -219,8 +219,15 @@ namespace VIZ.Package.Module ...@@ -219,8 +219,15 @@ namespace VIZ.Package.Module
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
private void OnPageOpenMessage(PageOpenMessage msg) private void OnPageOpenMessage(PageOpenMessage msg)
{ {
this.PageID = 1000;
this.Scene = msg.Page?.Scene; this.Scene = msg.Page?.Scene;
if (msg.Page is PageModel page)
{
this.PageID = string.Format("{0:D4}", page.PageNum);
}
else
{
this.PageID = null;
}
} }
/// <summary> /// <summary>
......
...@@ -52,7 +52,7 @@ namespace VIZ.Package.Module ...@@ -52,7 +52,7 @@ namespace VIZ.Package.Module
private void InitMessage() private void InitMessage()
{ {
ApplicationDomainEx.MessageManager.Register<VizPreviewReadyMessage>(this, this.OnVizPreviewReadyMessage); ApplicationDomainEx.MessageManager.Register<VizPreviewReadyMessage>(this, this.OnVizPreviewReadyMessage);
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage); ApplicationDomainEx.MessageManager.Register<ApplicationClosingMessage>(this, this.OnApplicationClosingMessage);
} }
// ===================================================================== // =====================================================================
...@@ -361,17 +361,17 @@ namespace VIZ.Package.Module ...@@ -361,17 +361,17 @@ namespace VIZ.Package.Module
} }
/// <summary> /// <summary>
/// 应用程序关闭消息 /// 应用程序关闭消息
/// </summary> /// </summary>
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg) private void OnApplicationClosingMessage(ApplicationClosingMessage msg)
{ {
// 项目未打开 // 项目未打开
if (ApplicationDomainEx.ProjectDbContext == null) if (ApplicationDomainEx.ProjectDbContext == null)
{ {
var result = DXMessageBox.Show("确定关闭系统?", "提示", MessageBoxButton.YesNo); var result = DXMessageBox.Show("确定关闭系统?", "提示", MessageBoxButton.YesNo);
msg.IsCancel = result == MessageBoxResult.No; msg.Cancel = result == MessageBoxResult.No;
} }
// 项目已经打开 // 项目已经打开
else else
...@@ -389,7 +389,7 @@ namespace VIZ.Package.Module ...@@ -389,7 +389,7 @@ namespace VIZ.Package.Module
// 取消关闭 // 取消关闭
if (result == MessageBoxResult.Cancel) if (result == MessageBoxResult.Cancel)
{ {
msg.IsCancel = true; msg.Cancel = true;
} }
} }
} }
......
...@@ -41,7 +41,7 @@ namespace VIZ.Package.Module ...@@ -41,7 +41,7 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void InitMessage() private void InitMessage()
{ {
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage); ApplicationDomainEx.MessageManager.Register<ApplicationClosedMessage>(this, this.OnApplicationClosedMessage);
} }
// ============================================================ // ============================================================
...@@ -113,7 +113,7 @@ namespace VIZ.Package.Module ...@@ -113,7 +113,7 @@ namespace VIZ.Package.Module
/// 系统关闭消息 /// 系统关闭消息
/// </summary> /// </summary>
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg) private void OnApplicationClosedMessage(ApplicationClosedMessage msg)
{ {
// 保存布局 // 保存布局
this.SaveLayout(); this.SaveLayout();
......
...@@ -31,5 +31,13 @@ namespace VIZ.Package.Module ...@@ -31,5 +31,13 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
/// <param name="page">页</param> /// <param name="page">页</param>
void OpenPage(PageModel page); void OpenPage(PageModel page);
/// <summary>
/// 尝试改变页号
/// </summary>
/// <param name="page">页</param>
/// <param name="pageNum">页号</param>
/// <returns>是否成功改变</returns>
bool TryChangePageNum(PageModel page, int pageNum);
} }
} }
...@@ -64,12 +64,19 @@ ...@@ -64,12 +64,19 @@
<dxg:GridControl ItemsSource="{Binding Pages}" ShowBorder="False" IsFilterEnabled="False" <dxg:GridControl ItemsSource="{Binding Pages}" ShowBorder="False" IsFilterEnabled="False"
SelectedItem="{Binding ElementName=uc, Path=DataContext.SelectedPageModel,Mode=TwoWay}"> SelectedItem="{Binding ElementName=uc, Path=DataContext.SelectedPageModel,Mode=TwoWay}">
<dxg:GridControl.Columns> <dxg:GridControl.Columns>
<dxg:GridColumn Header="序号" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="40" AllowResizing="False"> <dxg:GridColumn Header="编号" AllowSorting="False" AllowColumnFiltering="False" AllowResizing="True"
FieldName="PageNum">
<dxg:GridColumn.CellTemplate> <dxg:GridColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding RowData.RowHandle,Converter={StaticResource RowHandleConverter}}"></TextBlock> <TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"
Text="{Binding Row.PageNum,StringFormat={}{0:D4}}"></TextBlock>
</DataTemplate> </DataTemplate>
</dxg:GridColumn.CellTemplate> </dxg:GridColumn.CellTemplate>
<dxg:GridColumn.CellEditTemplate>
<DataTemplate>
<local:PageNumberEdit></local:PageNumberEdit>
</DataTemplate>
</dxg:GridColumn.CellEditTemplate>
</dxg:GridColumn> </dxg:GridColumn>
<dxg:GridColumn Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True"> <dxg:GridColumn Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True">
<dxg:GridColumn.CellTemplate> <dxg:GridColumn.CellTemplate>
......
...@@ -407,6 +407,7 @@ namespace VIZ.Package.Module ...@@ -407,6 +407,7 @@ namespace VIZ.Package.Module
page.ThumbnailBitmap = template.ThumbnailBitmap; page.ThumbnailBitmap = template.ThumbnailBitmap;
page.PluginID = vm.SelectedTemplatePlugin?.ID; page.PluginID = vm.SelectedTemplatePlugin?.ID;
page.PluginName = vm.SelectedTemplatePlugin?.Name; page.PluginName = vm.SelectedTemplatePlugin?.Name;
page.PageNum = this.SelectedPageGroupModel.Pages.Max(p => p.PageNum) + 1;
this.SelectedPageGroupModel.Pages.Add(page); this.SelectedPageGroupModel.Pages.Add(page);
...@@ -453,6 +454,7 @@ namespace VIZ.Package.Module ...@@ -453,6 +454,7 @@ namespace VIZ.Package.Module
page.ThumbnailBitmap = this.SelectedPageModel.ThumbnailBitmap; page.ThumbnailBitmap = this.SelectedPageModel.ThumbnailBitmap;
page.PluginID = this.SelectedPageModel.PluginID; page.PluginID = this.SelectedPageModel.PluginID;
page.PluginName = this.SelectedPageModel.PluginName; page.PluginName = this.SelectedPageModel.PluginName;
page.PageNum = this.SelectedPageGroupModel.Pages.Max(p => p.PageNum) + 1;
this.SelectedPageGroupModel.Pages.Add(page); this.SelectedPageGroupModel.Pages.Add(page);
...@@ -487,5 +489,25 @@ namespace VIZ.Package.Module ...@@ -487,5 +489,25 @@ namespace VIZ.Package.Module
this.OpenPage(); this.OpenPage();
} }
/// <summary>
/// 尝试改变页号
/// </summary>
/// <param name="page">页</param>
/// <param name="pageNum">页号</param>
/// <returns>是否成功改变</returns>
public bool TryChangePageNum(PageModel page, int pageNum)
{
if (this.SelectedPageGroupModel == null)
return false;
PageModel same = this.SelectedPageGroupModel.Pages.FirstOrDefault(p => p != page && p.PageNum == pageNum);
if (same == null)
return true;
DXMessageBox.Show($"页 {pageNum} 已经存在!", "提示");
return false;
}
} }
} }
<UserControl x:Class="VIZ.Package.Module.PageNumberEdit"
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:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="200">
<dxe:TextEdit x:Name="PART_Text" MaskType="RegEx" Mask="[0-9]{4}" ShowBorder="False"
EditValuePostMode="Delayed" EditValueChanged="EditValueChanged"></dxe:TextEdit>
</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.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// PageNumberEdit.xaml 的交互逻辑
/// </summary>
public partial class PageNumberEdit : UserControl
{
public PageNumberEdit()
{
InitializeComponent();
this.DataContextChanged += OnDataContextChanged;
}
/// <summary>
/// 是否处于初始化中
/// </summary>
private bool isInInited;
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
DevExpress.Xpf.Grid.EditGridCellData cellData = e.NewValue as DevExpress.Xpf.Grid.EditGridCellData;
int.TryParse(cellData?.Value?.ToString(), out int value);
this.isInInited = true;
this.PART_Text.EditValue = string.Format("{0:d4}", value);
this.isInInited = false;
}
/// <summary>
/// 值改变
/// </summary>
private void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{
if (this.isInInited)
return;
DevExpress.Xpf.Grid.EditGridCellData cellData = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
PageModel page = cellData.Row as PageModel;
if (page == null)
return;
int.TryParse(e.NewValue?.ToString(), out int newNum);
if (page.PageNum == newNum)
return;
IPageGroupService service = ApplicationDomainEx.ServiceManager.GetService<IPageGroupService>(ViewServiceKeys.PAGE_GROUP_SERVICE);
if (service == null)
return;
if (service.TryChangePageNum(page, newNum))
{
page.PageNum = newNum;
}
}
}
}
...@@ -41,13 +41,6 @@ ...@@ -41,13 +41,6 @@
</ContextMenu> </ContextMenu>
</dxg:GridControl.ContextMenu> </dxg:GridControl.ContextMenu>
<dxg:GridControl.Columns> <dxg:GridControl.Columns>
<dxg:GridColumn Header="序号" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="40" AllowResizing="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding RowData.RowHandle,Converter={StaticResource RowHandleConverter}}"></TextBlock>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True"> <dxg:GridColumn Header="缩略图" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="120" MinWidth="40" MaxWidth="300" AllowResizing="True">
<dxg:GridColumn.CellTemplate> <dxg:GridColumn.CellTemplate>
<DataTemplate> <DataTemplate>
......
...@@ -65,7 +65,7 @@ namespace VIZ.Package.Module ...@@ -65,7 +65,7 @@ namespace VIZ.Package.Module
private void initMessage() private void initMessage()
{ {
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage); ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage); ApplicationDomainEx.MessageManager.Register<ApplicationClosedMessage>(this, this.OnApplicationClosedMessage);
ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage); ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage);
ApplicationDomainEx.MessageManager.Register<ControlListFieldChangedMessage>(this, this.OnControlListFieldChangedMessage); ApplicationDomainEx.MessageManager.Register<ControlListFieldChangedMessage>(this, this.OnControlListFieldChangedMessage);
} }
...@@ -418,7 +418,7 @@ namespace VIZ.Package.Module ...@@ -418,7 +418,7 @@ namespace VIZ.Package.Module
/// 应用程序关闭消息 /// 应用程序关闭消息
/// </summary> /// </summary>
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg) private void OnApplicationClosedMessage(ApplicationClosedMessage msg)
{ {
if (ApplicationDomainEx.VizPreviewProcess == null || ApplicationDomainEx.VizPreviewProcess.HasExited) if (ApplicationDomainEx.VizPreviewProcess == null || ApplicationDomainEx.VizPreviewProcess.HasExited)
return; return;
......
...@@ -125,6 +125,9 @@ ...@@ -125,6 +125,9 @@
<Compile Include="Main\View\MainStatusView.xaml.cs"> <Compile Include="Main\View\MainStatusView.xaml.cs">
<DependentUpon>MainStatusView.xaml</DependentUpon> <DependentUpon>MainStatusView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Page\Group\Widgets\PageNumberEdit.xaml.cs">
<DependentUpon>PageNumberEdit.xaml</DependentUpon>
</Compile>
<Compile Include="Plugin\Service\IPluginService.cs" /> <Compile Include="Plugin\Service\IPluginService.cs" />
<Compile Include="Resource\MediaResource\Controller\Model\ms.cs" /> <Compile Include="Resource\MediaResource\Controller\Model\ms.cs" />
<Compile Include="Resource\MediaResource\Core\MHResourceFileDoubleClickEventArgs.cs" /> <Compile Include="Resource\MediaResource\Core\MHResourceFileDoubleClickEventArgs.cs" />
...@@ -382,6 +385,10 @@ ...@@ -382,6 +385,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Page\Group\Widgets\PageNumberEdit.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Setting\Conn\View\ConnSettingView.xaml"> <Page Include="Setting\Conn\View\ConnSettingView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
......
...@@ -120,6 +120,7 @@ namespace VIZ.Package.Service ...@@ -120,6 +120,7 @@ namespace VIZ.Package.Service
model.PluginID = entity.PluginID; model.PluginID = entity.PluginID;
model.Order = entity.Order; model.Order = entity.Order;
model.PluginName = ApplicationDomainEx.PluginInfos.FirstOrDefault(p => p.ID == entity.PluginID)?.Name; model.PluginName = ApplicationDomainEx.PluginInfos.FirstOrDefault(p => p.ID == entity.PluginID)?.Name;
model.PageNum = entity.PageNum;
groupModel.Pages.Add(model); groupModel.Pages.Add(model);
} }
...@@ -175,6 +176,7 @@ namespace VIZ.Package.Service ...@@ -175,6 +176,7 @@ namespace VIZ.Package.Service
pageEntity.PageGroupID = pageModel.PageGroupID; pageEntity.PageGroupID = pageModel.PageGroupID;
pageEntity.TemplateID = pageModel.TemplateID; pageEntity.TemplateID = pageModel.TemplateID;
pageEntity.PluginID = pageModel.PluginID; pageEntity.PluginID = pageModel.PluginID;
pageEntity.PageNum = pageModel.PageNum;
pageEntity.Order = j; pageEntity.Order = j;
pages.Add(pageEntity); pages.Add(pageEntity);
......
...@@ -31,5 +31,10 @@ namespace VIZ.Package.Storage ...@@ -31,5 +31,10 @@ namespace VIZ.Package.Storage
/// 关联插件ID /// 关联插件ID
/// </summary> /// </summary>
public string PluginID { get; set; } public string PluginID { get; set; }
/// <summary>
/// 页号
/// </summary>
public int PageNum { get; set; }
} }
} }
...@@ -43,10 +43,20 @@ namespace VIZ.Package ...@@ -43,10 +43,20 @@ namespace VIZ.Package
// 发送系统关闭消息 // 发送系统关闭消息
try try
{ {
ApplicationCloseMessage msg = new ApplicationCloseMessage(); ApplicationClosingMessage closeingMsg = new ApplicationClosingMessage();
ApplicationDomainEx.MessageManager.Send(msg); ApplicationDomainEx.MessageManager.Send(closeingMsg);
e.Cancel = msg.IsCancel; // 如果取消关闭
if (closeingMsg.Cancel)
{
e.Cancel = true;
return;
}
// 发送确定关闭消息
ApplicationClosedMessage closedMsg = new ApplicationClosedMessage();
ApplicationDomainEx.MessageManager.Send(closedMsg);
} }
catch (Exception ex) catch (Exception ex)
{ {
......
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