Commit c204fc03 by wangonghui

暂时提交

parent 196f206a
......@@ -27,5 +27,15 @@ namespace VIZ.Package.Module
/// </summary>
/// <param name="isEnabled">是否可用</param>
void SetIsEnabled(bool isEnabled);
/// <summary>
/// 保存位置
/// </summary>
void SaveLayout1();
/// <summary>
/// 加载位置
/// </summary>
void LoadLayout1();
}
}
......@@ -54,6 +54,10 @@ namespace VIZ.Package.Module
this.AboutCommand = new VCommand(this.About);
this.AboutCustomControlFieldCommand = new VCommand(this.AboutCustomControlField);
this.AboutPageCommandCommand = new VCommand(this.AboutPageCommand);
this.ExportLayoutCommand = new VCommand(this.ExportLayout);
this.ImportLayoutCommand = new VCommand(this.ImportLayout);
}
/// <summary>
......@@ -167,6 +171,21 @@ namespace VIZ.Package.Module
Command = this.ResetLayoutCommand
});
items.Add(new MenuItemModel
{
Header = "导入布局",
Icon = "/VIZ.Package.Module.Resource;component/Icons/top_icon_layout_20x20.png",
Type = MenuItemType.Button,
Command = this.ExportLayoutCommand
});
items.Add(new MenuItemModel
{
Header = "导出布局",
Icon = "/VIZ.Package.Module.Resource;component/Icons/top_icon_layout_20x20.png",
Type = MenuItemType.Button,
Command = this.ImportLayoutCommand
});
this.ItemsSource = items.ToObservableCollection();
}
......@@ -428,6 +447,48 @@ namespace VIZ.Package.Module
#endregion
#region ImportLayoutCommand --导入布局
public VCommand ImportLayoutCommand { get; set; }
private void ImportLayout()
{
IMainViewService service = ApplicationDomainEx.ServiceManager.GetService<IMainViewService>(ViewServiceKeys.MAIN_VIEW_SERVICE);
if (service == null)
return;
// 记录操作日志
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, "导入布局");
service.LoadLayout1();
}
#endregion
#region ExportLayoutCommand---导出布局
public VCommand ExportLayoutCommand { get; set; }
private void ExportLayout()
{
IMainViewService service = ApplicationDomainEx.ServiceManager.GetService<IMainViewService>(ViewServiceKeys.MAIN_VIEW_SERVICE);
if (service == null)
return;
// 记录操作日志
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, "导出布局");
service.SaveLayout1();
}
#endregion
#region AboutCommand -- 关于命令
/// <summary>
......
using Gma.System.MouseKeyHook;
using DevExpress.Xpf.Docking;
using Gma.System.MouseKeyHook;
using log4net;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
......@@ -309,5 +311,32 @@ namespace VIZ.Package.Module
}
}
const string filter = "Configuration (*.xml)|*.xml|All files (*.*)|*.*";
public void SaveLayout1()
{
MainView view = this.GetView<MainView>();
if (view == null)
return;
OpenFileDialog openFileDialog = new OpenFileDialog() { Filter = filter };
var openResult = openFileDialog.ShowDialog();
if (openResult.HasValue && openResult.Value)
view.dockLayoutManager.RestoreLayoutFromXml(openFileDialog.FileName);
}
public void LoadLayout1()
{
MainView view = this.GetView<MainView>();
if (view == null)
return;
SaveFileDialog saveFileDialog = new SaveFileDialog() { Filter = filter };
var saveResult = saveFileDialog.ShowDialog();
if (saveResult.HasValue && saveResult.Value)
view.dockLayoutManager.SaveLayoutToXml(saveFileDialog.FileName);
}
}
}
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