Commit 564eeaba by liulongfei

打开当前页 Take当前页

parent 5f14b939
......@@ -25,6 +25,12 @@ namespace VIZ.Package.Module
void Take(Action callback);
/// <summary>
/// 当页打开后Take指定页
/// </summary>
/// <param name="pageBase">指定页</param>
void TakeWhenPageOpend(PageModelBase pageBase);
/// <summary>
/// 继续
/// </summary>
void Continue();
......
......@@ -52,9 +52,19 @@ namespace VIZ.Package.Module
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<HotkeyMessage>(this, this.OnHotkeyMessage);
ApplicationDomainEx.MessageManager.Register<PageOpenOverMessage>(this, this.OnPageOpenOverMessage);
}
// ==============================================================
// Field
// ==============================================================
/// <summary>
/// 等待Take的页
/// </summary>
private PageModelBase waitTakePageBase;
// ==============================================================
// Service & Controller
// ==============================================================
......@@ -277,6 +287,23 @@ namespace VIZ.Package.Module
}
}
/// <summary>
/// 页打开完成消息
/// </summary>
/// <param name="msg">消息</param>
private void OnPageOpenOverMessage(PageOpenOverMessage msg)
{
if (this.waitTakePageBase == null)
return;
if (this.waitTakePageBase != msg.Page)
return;
this.waitTakePageBase = null;
this.Take();
}
// ==============================================================
// Public Function
// ==============================================================
......@@ -333,6 +360,15 @@ namespace VIZ.Package.Module
});
}
/// <summary>
/// 当页打开后Take指定页
/// </summary>
/// <param name="pageBase">指定页</param>
public void TakeWhenPageOpend(PageModelBase pageBase)
{
this.waitTakePageBase = pageBase;
}
// ==============================================================
// Private Function
// ==============================================================
......
......@@ -425,6 +425,9 @@
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
</dxg:TableView.ColumnMenuCustomizations>
<dxg:TableView.RowCellMenuCustomizations>
<dxb:BarButtonItem Name="OpenAndTakePage" Content="Take"
Command="{Binding ElementName=uc,Path=DataContext.OpenAndTakePageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarButtonItem Name="OpenPage" Content="打开"
Command="{Binding ElementName=uc,Path=DataContext.OpenPageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
......
......@@ -96,6 +96,7 @@ namespace VIZ.Package.Module
this.DeleteGroupCommand = new VCommand(this.DeleteGroup);
this.DeleteItemCommand = new VCommand(this.DeleteItem);
this.OpenPageCommand = new VCommand(this.OpenPage, this.CanOpenPage);
this.OpenAndTakePageCommand = new VCommand(this.OpenAndTakePage, this.CanOpenAndTakePage);
this.UpdateCommand = new VCommand(this.Update, this.CanUpdate);
this.TakeClearCommand = new VCommand(this.TakeClear);
this.TakeInitCommand = new VCommand(this.TakeInit, this.CanTakeInit);
......@@ -467,6 +468,51 @@ namespace VIZ.Package.Module
#endregion
#region OpenAndTakePageCommand -- 打开并Take页命令
/// <summary>
/// 打开并Take页命令
/// </summary>
public VCommand OpenAndTakePageCommand { get; set; }
/// <summary>
/// 是否可以打开并Take页
/// </summary>
/// <returns>是否可以打开并Take页</returns>
private bool CanOpenAndTakePage()
{
return this.SelectedPageGroupModel != null &&
this.SelectedPageGroupModel.SelectedPage != null;
}
/// <summary>
/// 打开并Take页
/// </summary>
private void OpenAndTakePage()
{
if (this.SelectedPageGroupModel == null)
return;
if (this.SelectedPageGroupModel.SelectedPage == null)
return;
// 记录操作日志
string remark = $"{this.SelectedPageGroupModel.SelectedPage.ScenePath}";
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PAGE_OPEN, remark);
// 设置需要等待Take的页
IControlService service = ApplicationDomainEx.ServiceManager.GetService<IControlService>(ViewServiceKeys.CONTROL_SERVICE);
if (service == null)
return;
service.TakeWhenPageOpend(this.SelectedPageGroupModel.SelectedPage);
// 打开页
this.OpenPage(this.SelectedPageGroupModel.SelectedPage);
}
#endregion
#region UpdateCommand -- 更新命令
/// <summary>
......@@ -1020,6 +1066,15 @@ namespace VIZ.Package.Module
return;
}
// 打开并Take选中页
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.OpenAndTakeSelectedPage))
{
// 记录操作日志
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.SYSTEM_HOT_KEY, msg.Key);
this.OpenAndTakePage();
}
}
catch (Exception ex)
{
......
......@@ -50,6 +50,7 @@
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- Take -->
<TextBlock Text="Take:" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
......@@ -75,6 +76,10 @@
<TextBlock Text="Take当前页打开下一页:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="5"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Height="30" Grid.Row="5" Margin="15,0,10,0"
Hotkey="{Binding Path=TakeAndOpenNextPage,Mode=TwoWay}"></fcommon:HotkeyBox>
<!-- 打开并Take -->
<TextBlock Text="打开并Take选中页:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="6"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Height="30" Grid.Row="6" Margin="15,0,10,0"
Hotkey="{Binding Path=TakeAndOpenNextPage,Mode=TwoWay}"></fcommon:HotkeyBox>
</Grid>
</GroupBox>
<GroupBox Header="其他快捷键" Margin="10,5,10,10" Padding="5" Grid.Row="1">
......
......@@ -153,6 +153,20 @@ namespace VIZ.Package.Module
#endregion
#region OpenAndTakeSelectedPage -- 打开并Take当前页
private string openAndTakeSelectedPage;
/// <summary>
/// 打开并Take当前页
/// </summary>
public string OpenAndTakeSelectedPage
{
get { return openAndTakeSelectedPage; }
set { openAndTakeSelectedPage = value; this.RaisePropertyChanged(nameof(OpenAndTakeSelectedPage)); }
}
#endregion
#region SaveOpendPageOrTemplateAndProject -- 保存当前打开的页或模板和项目
private string saveOpendPageOrTemplateAndProject;
......@@ -196,6 +210,7 @@ namespace VIZ.Package.Module
this.TakeUpdate = config.TakeUpdate;
this.OpenNextPage = config.OpenNextPage;
this.TakeAndOpenNextPage = config.TakeAndOpenNextPage;
this.OpenAndTakeSelectedPage = config.OpenAndTakeSelectedPage;
this.SaveOpendPageOrTemplateAndProject = config.SaveOpendPageOrTemplateAndProject;
}
......@@ -218,6 +233,7 @@ namespace VIZ.Package.Module
config.TakeUpdate = this.TakeUpdate;
config.OpenNextPage = this.OpenNextPage;
config.TakeAndOpenNextPage = this.TakeAndOpenNextPage;
config.OpenAndTakeSelectedPage = this.OpenAndTakeSelectedPage;
config.SaveOpendPageOrTemplateAndProject = this.SaveOpendPageOrTemplateAndProject;
ApplicationDomainEx.LocalDbContext.HotKeyConfig.Update(config);
......@@ -262,6 +278,10 @@ namespace VIZ.Package.Module
{
this.TakeAndOpenNextPage = string.Empty;
}
if (string.Equals(this.OpenAndTakeSelectedPage, key))
{
this.OpenAndTakeSelectedPage = string.Empty;
}
if (string.Equals(this.SaveOpendPageOrTemplateAndProject, key))
{
this.SaveOpendPageOrTemplateAndProject = string.Empty;
......
......@@ -69,6 +69,11 @@ namespace VIZ.Package.Storage
public string TakeAndOpenNextPage { get; set; } = "F10";
/// <summary>
/// 打开当前页 Take & 当前当前页
/// </summary>
public string OpenAndTakeSelectedPage { get; set; } = "F11";
/// <summary>
/// 保存当前打开的页或模板和项目
/// </summary>
public string SaveOpendPageOrTemplateAndProject { get; set; } = "Ctrl + S";
......
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