Commit 28138c77 by wangonghui
parents 8e4eabca e0e7e9c3
......@@ -144,6 +144,11 @@ namespace VIZ.Package.Domain
public static bool IsSceneLoading { get; set; }
/// <summary>
/// 是否正在设置热键
/// </summary>
public static bool IsHotkeySetting { get; set; }
/// <summary>
/// 场景信息列表
/// </summary>
/// <remarks>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace VIZ.Package.Domain
{
/// <summary>
/// 热键消息
/// </summary>
public class HotkeyMessage
{
/// <summary>
/// 热键
/// </summary>
public string Key { get; set; }
/// <summary>
/// 当前激活的视图
/// </summary>
public FrameworkElement View { get; set; }
}
}
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Core;
using VIZ.Package.Storage;
......@@ -125,6 +126,20 @@ namespace VIZ.Package.Domain
#endregion
#region View -- 视图
private WeakReference<FrameworkElement> view;
/// <summary>
/// 视图
/// </summary>
public WeakReference<FrameworkElement> View
{
get { return view; }
set { view = value; this.RaisePropertyChanged(nameof(View)); }
}
#endregion
/// <summary>
/// 空插件
/// </summary>
......
......@@ -87,6 +87,7 @@
<Compile Include="Message\Conn\ConnChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlListFieldChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" />
<Compile Include="Message\Hotkey\HotkeyMessage.cs" />
<Compile Include="Message\Log\ErrorLogMessage.cs" />
<Compile Include="Message\Log\VizCommandLogMessage.cs" />
<Compile Include="Message\Page\PageDeleteMessage.cs" />
......
......@@ -27,6 +27,9 @@ namespace VIZ.Package.Module
// 初始化命令
this.InitCommand();
// 初始化消息
this.InitMessage();
// 注册服务
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.CONTROL_SERVICE, this);
}
......@@ -42,6 +45,14 @@ namespace VIZ.Package.Module
this.UpdateCommand = new VCommand(this.Update);
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<HotkeyMessage>(this, this.OnHotkeyMessage);
}
// ==============================================================
// Service & Controller
// ==============================================================
......@@ -182,6 +193,52 @@ namespace VIZ.Package.Module
#endregion
// ==============================================================
// Message
// ==============================================================
/// <summary>
/// 处理热键消息
/// </summary>
/// <param name="msg">消息</param>
private void OnHotkeyMessage(HotkeyMessage msg)
{
try
{
// 上板
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.Take))
{
this.Take();
return;
}
// 继续
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.TakeContinue))
{
this.Continue();
return;
}
// 下版
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.TakeOut))
{
this.TakeOut();
return;
}
// 更新
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.TakeUpdate))
{
this.Update();
return;
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
// ==============================================================
// Private Function
// ==============================================================
......
......@@ -51,6 +51,7 @@ namespace VIZ.Package.Module
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<HotkeyMessage>(this, this.OnHotkeyMessage);
ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage);
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
}
......@@ -292,6 +293,27 @@ namespace VIZ.Package.Module
this.SelectedNavigationConfig = config;
}
/// <summary>
/// 热键消息
/// </summary>
/// <param name="msg">消息</param>
private void OnHotkeyMessage(HotkeyMessage msg)
{
try
{
// 保存
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.SaveOpendPageOrTemplateAndProject))
{
this.Save();
return;
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
// =============================================================
// Public Function
// =============================================================
......
......@@ -24,7 +24,8 @@
<dxg:GridControl ItemsSource="{Binding Path=ControlObject.FieldNodes}" ShowBorder="False"
SelectedItem="{Binding Path=SelectedControlField,Mode=TwoWay}">
<dxg:GridControl.Columns>
<dxg:GridColumn Header="" FieldName="IsCustom" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="30" AllowResizing="True">
<dxg:GridColumn Header="字段" FieldName="FieldIdentifier" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="150" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="" FieldName="IsCustom" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="20" AllowResizing="True">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Image Source="/VIZ.Package.Module.Resource;component/Icons/icon_custom_32x32.png" Width="14" Height="14"
......@@ -32,7 +33,6 @@
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="字段" FieldName="FieldIdentifier" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="150" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="类型" FieldName="Type" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="100" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="描述" FieldName="Description" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="值" FieldName="Value" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True"></dxg:GridColumn>
......
......@@ -21,7 +21,7 @@
<!-- 系统版本 -->
<TextBlock Text="系统版本:" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Row="1" Grid.Column="0" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="V1.0.0.02211119_beta" VerticalAlignment="Center" HorizontalAlignment="Left"
<TextBlock Text="V1.0.0.02242006_beta" VerticalAlignment="Center" HorizontalAlignment="Left"
Grid.Row="1" Grid.Column="1"></TextBlock>
</Grid>
</dx:ThemedWindow>
......@@ -63,7 +63,7 @@ namespace VIZ.Package.Module
/// </summary>
private void Clear()
{
VizCommandWindow view = this.GetView<VizCommandWindow>();
ErrorLogWindow view = this.GetView<ErrorLogWindow>();
if (view == null)
return;
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Plugin;
namespace VIZ.Package.Module
{
/// <summary>
/// 热键控制器
/// </summary>
public class HotkeyController
{
/// <summary>
/// 热键控制器
/// </summary>
/// <param name="vm">视图模型</param>
public HotkeyController(MainViewModel vm)
{
this.MainViewModel = vm;
}
/// <summary>
/// 主视图模型
/// </summary>
public MainViewModel MainViewModel { get; set; }
/// <summary>
/// 开始执行热键
/// </summary>
/// <param name="key">热键</param>
public void BeginExecute(string key)
{
if (ApplicationDomainEx.IsHotkeySetting)
return;
if (string.IsNullOrWhiteSpace(key))
return;
WPFHelper.BeginInvoke(() =>
{
// 插件视图
FrameworkElement pluginView = this.GetPluginView();
HotkeyMessage msg = new HotkeyMessage();
msg.Key = key;
msg.View = pluginView;
ApplicationDomainEx.MessageManager.Send(msg);
if (!ApplicationDomainEx.IS_DEBUG)
return;
Debug.WriteLine($"Hotkey: {key} , View: {pluginView?.ToString()}");
});
}
/// <summary>
/// 获取插件视图
/// </summary>
/// <returns>插件视图</returns>
private FrameworkElement GetPluginView()
{
MainView view = this.MainViewModel.GetView<MainView>();
if (view == null)
return null;
FrameworkElement element = view.dockLayoutManager.ActiveDockItem as FrameworkElement;
if (element == null)
return null;
PluginInfo info = element.DataContext as PluginInfo;
if (info == null)
return null;
FrameworkElement pluginView = null;
info.View?.TryGetTarget(out pluginView);
return pluginView;
}
}
}
using DevExpress.Xpf.Bars;
using DevExpress.Xpf.Core;
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
......@@ -20,6 +21,11 @@ namespace VIZ.Package.Module
/// </summary>
public class MainTopViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(MainTopViewModel));
public MainTopViewModel()
{
// 初始化命令
......@@ -52,6 +58,7 @@ namespace VIZ.Package.Module
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<HotkeyMessage>(this, this.OnHotkeyMessage);
ApplicationDomainEx.MessageManager.Register<VizPreviewReadyMessage>(this, this.OnVizPreviewReadyMessage);
ApplicationDomainEx.MessageManager.Register<VizPreviewRestartMessage>(this, this.OnVizPreviewRestartMessage);
ApplicationDomainEx.MessageManager.Register<ApplicationClosingMessage>(this, this.OnApplicationClosingMessage);
......@@ -482,6 +489,26 @@ namespace VIZ.Package.Module
}
}
/// <summary>
/// 热键消息
/// </summary>
/// <param name="msg">消息</param>
private void OnHotkeyMessage(HotkeyMessage msg)
{
try
{
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.SaveOpendPageOrTemplateAndProject))
{
this.SaveProject();
return;
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
// =====================================================================
// Public Function
// =====================================================================
......
using System;
using Gma.System.MouseKeyHook;
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Plugin;
......@@ -16,6 +19,11 @@ namespace VIZ.Package.Module
/// </summary>
public class MainViewModel : ViewModelBase, IMainViewService
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(MainViewModel));
public MainViewModel()
{
// 初始化命令
......@@ -24,6 +32,9 @@ namespace VIZ.Package.Module
// 初始化消息
this.InitMessage();
// 初始化控制器
this.InitController();
// 初始化热键
this.InitHotkey();
......@@ -48,17 +59,43 @@ namespace VIZ.Package.Module
}
/// <summary>
/// 初始化控制器
/// </summary>
private void InitController()
{
this.HotkeyController = new HotkeyController(this);
}
/// <summary>
/// 初始化热键
/// </summary>
private void InitHotkey()
{
// 注册键盘钩子
this.KeyboardMouseEvents = Hook.AppEvents();
this.KeyboardMouseEvents.KeyDown -= KeyboardMouseEvents_KeyDown;
this.KeyboardMouseEvents.KeyDown += KeyboardMouseEvents_KeyDown;
}
// ============================================================
// Field
// ============================================================
/// <summary>
/// 鼠标键盘钩子
/// </summary>
private IKeyboardMouseEvents KeyboardMouseEvents;
// ============================================================
// Service & Controller
// ============================================================
/// <summary>
/// 热键控制器
/// </summary>
private HotkeyController HotkeyController;
// ============================================================
// Property
// ============================================================
......@@ -254,5 +291,23 @@ namespace VIZ.Package.Module
return path;
}
/// <summary>
/// 键盘钩子事件
/// </summary>
private void KeyboardMouseEvents_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
try
{
string key = HotkeyHelper.GetHotkey(e);
this.HotkeyController.BeginExecute(key);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
}
......@@ -20,6 +20,10 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="PreviewKeyDown" Command="{Binding Path=PreviewKeyDownCommand}" PassEventArgsToCommand="True"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
......@@ -306,7 +310,7 @@
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
ShowDragDropHint="False" IsVisibleChanged="TableView_IsVisibleChanged"
ShowTargetInfoInDragDropHint="false">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="RowDoubleClick" Command="{Binding ElementName=uc, Path=DataContext.OpenPageCommand}"></dxmvvm:EventToCommand>
......@@ -329,14 +333,14 @@
Command="{Binding ElementName=uc,Path=DataContext.TakeInitCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarItemLinkSeparator />
<dxb:BarButtonItem Name="CopyPage" Content="复制选中页"
<dxb:BarButtonItem Name="CopyPage" Content="复制选中页 ( Ctrl + C )"
Command="{Binding ElementName=uc,Path=DataContext.BeginCopyPageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarButtonItem Name="PastePage" Content="粘贴页"
<dxb:BarButtonItem Name="PastePage" Content="粘贴页 ( Ctrl + V )"
Command="{Binding ElementName=uc,Path=DataContext.PastePageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarItemLinkSeparator />
<dxb:BarButtonItem Name="DeleteItem" Content="删除选中页"
<dxb:BarButtonItem Name="DeleteItem" Content="删除选中页 ( Delete )"
Command="{Binding ElementName=uc,Path=DataContext.DeleteItemCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
......
......@@ -29,5 +29,21 @@ namespace VIZ.Package.Module
WPFHelper.BindingViewModel(this, new PageGroupViewModel());
}
/// <summary>
/// 当前可见的表视图
/// </summary>
public TableView CurrentIsVisibleTableView;
/// <summary>
/// 表视图可见性改变时触发
/// </summary>
private void TableView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if ((bool)e.NewValue == true)
{
this.CurrentIsVisibleTableView = sender as TableView;
}
}
}
}
......@@ -17,6 +17,9 @@ using VIZ.Package.Common;
using VIZ.Package.Service;
using VIZ.Package.Storage;
using DevExpress.Xpf.Editors.Helpers;
using System.Windows.Input;
using VIZ.Framework.Common;
using System.Windows.Controls.Primitives;
namespace VIZ.Package.Module
{
......@@ -102,6 +105,7 @@ namespace VIZ.Package.Module
this.CopyPageGroupCommand = new VCommand(this.CopyPageGroup, this.CanCopyPageGroup);
this.BeginCopyPageCommand = new VCommand(this.BeginCopyPage, this.CanBeginCopyPage);
this.PastePageCommand = new VCommand(this.PastePage, this.CanPastePage);
this.PreviewKeyDownCommand = new VCommand<KeyEventArgs>(this.PreviewKeyDown);
}
/// <summary>
......@@ -109,6 +113,7 @@ namespace VIZ.Package.Module
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<HotkeyMessage>(this, this.OnHotkeyMessage);
ApplicationDomainEx.MessageManager.Register<ProjectOpenMessage>(this, this.OnProjectOpenMessage);
ApplicationDomainEx.MessageManager.Register<ProjectCloseMessage>(this, this.OnProjectCloseMessage);
ApplicationDomainEx.MessageManager.Register<ProjectSaveMessage>(this, this.OnProjectSaveMessage);
......@@ -717,6 +722,56 @@ namespace VIZ.Package.Module
#endregion
#region PreviewKeyDownCommand -- 按键按下命令
/// <summary>
/// 按键按下命令
/// </summary>
public VCommand<KeyEventArgs> PreviewKeyDownCommand { get; set; }
/// <summary>
/// 按键按下
/// </summary>
/// <param name="e">事件参数</param>
private void PreviewKeyDown(KeyEventArgs e)
{
try
{
TextBoxBase tb = e.OriginalSource as TextBoxBase;
if (tb != null)
return;
string key = HotkeyHelper.GetHotkey(e);
// 复制页
if (string.Equals(key, HotKeyConfigEntity.COPY))
{
this.BeginCopyPage();
return;
}
// 粘贴页
if (string.Equals(key, HotKeyConfigEntity.PASTE))
{
this.PastePage();
return;
}
// 删除页
if (string.Equals(key, HotKeyConfigEntity.DELETE))
{
this.DeleteItem();
return;
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
#endregion
// ======================================================================================
// Message
// ======================================================================================
......@@ -819,6 +874,27 @@ namespace VIZ.Package.Module
}
}
/// <summary>
/// 处理热键消息
/// </summary>
/// <param name="msg">消息</param>
private void OnHotkeyMessage(HotkeyMessage msg)
{
try
{
// 打开下一页
if (string.Equals(msg.Key, ApplicationDomainEx.HotKeyConfig.OpenNextPage))
{
this.OpenNextPageItem();
return;
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
// ======================================================================================
// Public Function
// ======================================================================================
......@@ -929,6 +1005,39 @@ namespace VIZ.Package.Module
this.ConnGroups = ApplicationDomainEx.ConnGroups;
}
/// <summary>
/// 打开下一页
/// </summary>
public void OpenNextPageItem()
{
if (this.SelectedPageGroupModel == null)
return;
PageModel page = ApplicationDomainEx.CurrentPage as PageModel;
if (page == null)
return;
if (this.SelectedPageGroupModel.Pages == null || this.SelectedPageGroupModel.Pages.Count == 0)
return;
int index = this.SelectedPageGroupModel.Pages.IndexOf(page);
if (index < 0)
return;
++index;
if (this.SelectedPageGroupModel.Pages.Count <= index)
return;
this.SelectedPageGroupModel.SelectedPage = this.SelectedPageGroupModel.Pages[index];
this.OpenPage();
PageGroupView view = this.GetView<PageGroupView>();
if (view == null)
return;
view.CurrentIsVisibleTableView?.ScrollIntoView(this.SelectedPageGroupModel.SelectedPage);
}
// ======================================================================================
// Private Function
// ======================================================================================
......
......@@ -18,6 +18,11 @@
d:DataContext="{d:DesignInstance Type=local:PageTemplateViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="PreviewKeyDown" Command="{Binding Path=PreviewKeyDownCommand}" PassEventArgsToCommand="True"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<UserControl.Resources>
<ResourceDictionary>
<resource:RowHandleConverter x:Key="RowHandleConverter"></resource:RowHandleConverter>
......@@ -31,7 +36,7 @@
<Grid IsEnabled="{Binding Path=IsEnabled}" Margin="0,10,0,10">
<dxg:GridControl ItemsSource="{Binding Path=SceneTemplateModels}" ShowBorder="False" SelectionMode="Row"
SelectedItem="{Binding Path=SelectedSceneTemplateModel}"
SelectedItem="{Binding Path=SelectedSceneTemplateModel}" x:Name="t"
SelectedItems="{Binding Path=SelectedSceneTemplateModels}">
<dxg:GridControl.ContextMenu>
<ContextMenu>
......@@ -40,7 +45,7 @@
<MenuItem Header="添加至节目单" Command="{Binding Path=PlacementTarget.DataContext.AddToPageGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="更新模板" Command="{Binding Path=PlacementTarget.DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator></Separator>
<MenuItem Header="删除模板" Command="{Binding Path=PlacementTarget.DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除模板 ( Delete )" Command="{Binding Path=PlacementTarget.DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.Columns>
......
......@@ -8,7 +8,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media.Animation;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Service;
......@@ -47,6 +51,7 @@ namespace VIZ.Package.Module
this.OpenScenePageCommand = new VCommand(this.OpenScenePage);
this.UpdateCommand = new VCommand(this.Update);
this.DeleteCommand = new VCommand(this.Delete);
this.PreviewKeyDownCommand = new VCommand<KeyEventArgs>(this.PreviewKeyDown);
}
/// <summary>
......@@ -290,7 +295,8 @@ namespace VIZ.Package.Module
if (this.SelectedSceneTemplateModels == null || this.SelectedSceneTemplateModels.Count == 0)
return;
if (DXMessageBox.Show($"是否删除模板?", "提示", System.Windows.MessageBoxButton.YesNo) != System.Windows.MessageBoxResult.Yes)
string scenes = string.Join(" ,", this.SelectedSceneTemplateModels.Select(p => p.Scene));
if (DXMessageBox.Show($"是否删除模板 [{scenes}] ?", "提示", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
List<PageTemplateModel> templates = this.SelectedSceneTemplateModels.ToList();
......@@ -302,6 +308,42 @@ namespace VIZ.Package.Module
#endregion
#region PreviewKeyDownCommand -- 按键按下命令
/// <summary>
/// 按键按下命令
/// </summary>
public VCommand<KeyEventArgs> PreviewKeyDownCommand { get; set; }
/// <summary>
/// 按键按下
/// </summary>
/// <param name="e">事件参数</param>
private void PreviewKeyDown(KeyEventArgs e)
{
try
{
TextBoxBase tb = e.OriginalSource as TextBoxBase;
if (tb != null)
return;
string key = HotkeyHelper.GetHotkey(e);
// 删除模板
if (string.Equals(key, HotKeyConfigEntity.DELETE))
{
this.Delete();
return;
}
}
catch (Exception ex)
{
log.Error(ex);
}
}
#endregion
// ======================================================================================
// Message
// ======================================================================================
......
......@@ -154,7 +154,7 @@ namespace VIZ.Package.Module
/// <summary>
/// 发送Viz引擎准备完毕消息
/// </summary>
public void BeginSendVizEngineReadlyMessage()
private void BeginSendVizEngineReadlyMessage()
{
WPFHelper.BeginInvoke(() =>
{
......
......@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
......@@ -25,6 +26,17 @@ namespace VIZ.Package.Module
InitializeComponent();
WPFHelper.BindingViewModel(this, new SettingWindowModel());
// 当前处于热键设置状态
ApplicationDomainEx.IsHotkeySetting = true;
this.Closed += SettingWindow_Closed;
}
private void SettingWindow_Closed(object sender, EventArgs e)
{
// 关闭当前热键设置状态
ApplicationDomainEx.IsHotkeySetting = false;
}
}
}
......@@ -80,16 +80,10 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- 删除当前选择的页 -->
<TextBlock Text="删除当前选择的页:" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<fcommon:HotkeyBox IsEnabled="False" Grid.Column="1" Height="30" Margin="15,0,10,0"
Hotkey="{Binding Path=DeletePageOrTemplate,Mode=TwoWay}"></fcommon:HotkeyBox>
<!-- 保存当前打开的页及项目 -->
<TextBlock Text="保存当前打开的页及项目:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1"></TextBlock>
<fcommon:HotkeyBox IsEnabled="False" Grid.Column="1" Height="30" Grid.Row="1" Margin="15,0,10,0"
<TextBlock Text="保存当前打开的页及项目:" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="0"></TextBlock>
<fcommon:HotkeyBox IsEnabled="False" Grid.Column="1" Height="30" Grid.Row="0" Margin="15,0,10,0"
Hotkey="{Binding Path=SaveOpendPageOrTemplateAndProject,Mode=TwoWay}"></fcommon:HotkeyBox>
</Grid>
</GroupBox>
......
......@@ -139,25 +139,6 @@ namespace VIZ.Package.Module
#endregion
#region DeletePageOrTemplate -- 删除当前选中的页或模板
private string deletePageOrTemplate;
/// <summary>
/// 删除当前选中的页或模板
/// </summary>
public string DeletePageOrTemplate
{
get { return deletePageOrTemplate; }
set
{
this.CheckHotkey(value);
deletePageOrTemplate = value;
this.RaisePropertyChanged(nameof(DeletePageOrTemplate));
}
}
#endregion
#region SaveOpendPageOrTemplateAndProject -- 保存当前打开的页或模板和项目
private string saveOpendPageOrTemplateAndProject;
......@@ -200,7 +181,6 @@ namespace VIZ.Package.Module
this.TakeOut = config.TakeOut;
this.TakeUpdate = config.TakeUpdate;
this.OpenNextPage = config.OpenNextPage;
this.DeletePageOrTemplate = config.DeletePageOrTemplate;
this.SaveOpendPageOrTemplateAndProject = config.SaveOpendPageOrTemplateAndProject;
}
......@@ -222,7 +202,6 @@ namespace VIZ.Package.Module
config.TakeOut = this.TakeOut;
config.TakeUpdate = this.TakeUpdate;
config.OpenNextPage = this.OpenNextPage;
config.DeletePageOrTemplate = this.DeletePageOrTemplate;
config.SaveOpendPageOrTemplateAndProject = this.SaveOpendPageOrTemplateAndProject;
ApplicationDomainEx.LocalDbContext.HotKeyConfig.Update(config);
......@@ -263,10 +242,6 @@ namespace VIZ.Package.Module
{
this.OpenNextPage = string.Empty;
}
if (string.Equals(this.DeletePageOrTemplate, key))
{
this.DeletePageOrTemplate = string.Empty;
}
if (string.Equals(this.SaveOpendPageOrTemplateAndProject, key))
{
this.SaveOpendPageOrTemplateAndProject = string.Empty;
......
......@@ -129,6 +129,7 @@
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
<Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" />
<Compile Include="Log\ViewModel\VizCommandWindowModel.cs" />
<Compile Include="Main\Controller\HotkeyController.cs" />
<Compile Include="Page\Core\View\PageLoadingWindow.xaml.cs">
<DependentUpon>PageLoadingWindow.xaml</DependentUpon>
</Compile>
......@@ -407,7 +408,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Main\Controller\" />
<Folder Include="ProjectManager\Model\" />
</ItemGroup>
<ItemGroup>
......
......@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using VIZ.Package.Domain;
namespace VIZ.Package.Plugin
{
......@@ -63,6 +64,12 @@ namespace VIZ.Package.Plugin
FrameworkElement view = this.ViewType.Assembly.CreateInstance(this.ViewType.FullName) as FrameworkElement;
this.Content = view;
PluginInfo info = this.DataContext as PluginInfo;
if (info != null)
{
info.View = new WeakReference<FrameworkElement>(view);
}
}
catch (Exception ex)
{
......
......@@ -111,10 +111,18 @@
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Domain\VIZ.Framework.Domain.csproj">
<Project>{28661e82-c86a-4611-a028-c34f6ac85c97}</Project>
<Name>VIZ.Framework.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj">
<Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project>
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Domain\VIZ.Package.Domain.csproj">
<Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project>
<Name>VIZ.Package.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Storage\VIZ.Package.Storage.csproj">
<Project>{5bf08a07-9405-4f5d-a7f7-9d9ee17d6dd0}</Project>
<Name>VIZ.Package.Storage</Name>
......
......@@ -13,6 +13,26 @@ namespace VIZ.Package.Storage
public class HotKeyConfigEntity
{
/// <summary>
/// 拷贝
/// </summary>
public const string COPY = "Ctrl + C";
/// <summary>
/// 剪切
/// </summary>
public const string CUT = "Ctrl + X";
/// <summary>
/// 粘贴
/// </summary>
public const string PASTE = "Ctrl + V";
/// <summary>
/// 删除
/// </summary>
public const string DELETE = "Delete";
/// <summary>
/// 编号
/// </summary>
[BsonId(true)]
......@@ -44,11 +64,6 @@ namespace VIZ.Package.Storage
public string OpenNextPage { get; set; } = "F9";
/// <summary>
/// 删除当前选中的页或模板
/// </summary>
public string DeletePageOrTemplate { get; set; } = "Delete";
/// <summary>
/// 保存当前打开的页或模板和项目
/// </summary>
public string SaveOpendPageOrTemplateAndProject { get; set; } = "Ctrl + S";
......
......@@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "10-Core", "10-Core", "{38A2
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "20-Storage", "20-Storage", "{DA43E9E0-AFD0-4764-8228-44A01DF922A3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "25-Plugin", "25-Plugin", "{9AA1CFFD-41A1-448C-9144-1115A6B19AFA}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "45-Plugin", "45-Plugin", "{9AA1CFFD-41A1-448C-9144-1115A6B19AFA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "30-Domain", "30-Domain", "{7E1F0C7E-1A9C-4E9E-AB5F-C38BBB1B3E4A}"
EndProject
......
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