Commit e9f9b120 by liulongfei

命令窗口加保存

parent 3116ff1a
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition> <RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="35"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 描述 --> <!-- 描述 -->
...@@ -48,8 +49,20 @@ ...@@ -48,8 +49,20 @@
<TextBlock Text="{Binding PageType}" Margin="10,0,0,0" MinWidth="80" d:Foreground="White"></TextBlock> <TextBlock Text="{Binding PageType}" Margin="10,0,0,0" MinWidth="80" d:Foreground="White"></TextBlock>
</StackPanel> </StackPanel>
</Border> </Border>
<!-- 按钮组 -->
<Border Background="#11FFFFFF" Grid.Row="1">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<!-- 保存 -->
<fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/icon_save_30x30.png"
IconHover="/VIZ.Package.Module.Resource;component/Icons/icon_save_hover_30x30.png"
Style="{StaticResource IconButton_Menu}"
ToolTip="保存" Margin="5,0,0,0"
IconWidth="24" IconHeight="24" Width="24" Height="24"
Command="{Binding SaveCommand}"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 命令输入框 --> <!-- 命令输入框 -->
<dx:DXTabControl Grid.Row="1" Margin="0,10,0,0" Padding="0,5,0,0"> <dx:DXTabControl Grid.Row="2" Margin="0,10,0,0" Padding="0,5,0,0">
<dx:DXTabItem Header="Take"> <dx:DXTabItem Header="Take">
<dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5" <dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5"
VerticalContentAlignment="Top"></dxe:TextEdit> VerticalContentAlignment="Top"></dxe:TextEdit>
......
...@@ -49,7 +49,7 @@ namespace VIZ.Package.Module ...@@ -49,7 +49,7 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void InitCommand() private void InitCommand()
{ {
this.SaveCommand = new VCommand(this.Save);
} }
/// <summary> /// <summary>
...@@ -60,6 +60,7 @@ namespace VIZ.Package.Module ...@@ -60,6 +60,7 @@ namespace VIZ.Package.Module
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage); ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
ApplicationDomainEx.MessageManager.Register<PageSaveMessage>(this, this.OnPageSaveMessage); ApplicationDomainEx.MessageManager.Register<PageSaveMessage>(this, this.OnPageSaveMessage);
ApplicationDomainEx.MessageManager.Register<PageSaveAsMessage>(this, this.OnPageSaveAsMessage); ApplicationDomainEx.MessageManager.Register<PageSaveAsMessage>(this, this.OnPageSaveAsMessage);
ApplicationDomainEx.MessageManager.Register<HotkeyMessage>(this, this.OnHotkeyMessage);
} }
// ====================================================================================== // ======================================================================================
...@@ -177,6 +178,41 @@ namespace VIZ.Package.Module ...@@ -177,6 +178,41 @@ namespace VIZ.Package.Module
// Command // Command
// ====================================================================================== // ======================================================================================
#region SaveCommand -- 保存命令
/// <summary>
/// 保存命令
/// </summary>
public VCommand SaveCommand { get; set; }
/// <summary>
/// 保存
/// </summary>
private void Save()
{
if (ApplicationDomainEx.CurrentPage == null)
return;
Guid templateIdOrPageId = ApplicationDomainEx.CurrentPage.GetTemplateIdOrPageId();
PageCommandEntity entity = ApplicationDomainEx.ProjectDbContext.PageCommand.Find(p => p.PageID == templateIdOrPageId).FirstOrDefault();
entity = entity ?? new PageCommandEntity();
entity.PageID = templateIdOrPageId;
entity.TakeCommand = this.TakeCommand;
entity.TakeContinueCommand = this.TakeContinueCommand;
entity.TakeOutCommand = this.TakeOutCommand;
entity.TakeUpdateCommand = this.TakeUpdateCommand;
ApplicationDomainEx.ProjectDbContext.PageCommand.Upsert(entity);
// 发送弹出提示
AlertMessage alertMessage = new AlertMessage();
alertMessage.Message = "保存成功";
ApplicationDomainEx.MessageManager.Send(alertMessage);
}
#endregion
// ====================================================================================== // ======================================================================================
// Message // Message
// ====================================================================================== // ======================================================================================
...@@ -247,6 +283,18 @@ namespace VIZ.Package.Module ...@@ -247,6 +283,18 @@ namespace VIZ.Package.Module
ApplicationDomainEx.ProjectDbContext.PageCommand.Upsert(entity); ApplicationDomainEx.ProjectDbContext.PageCommand.Upsert(entity);
} }
/// <summary>
/// 处理热键
/// </summary>
/// <param name="msg">消息</param>
private void OnHotkeyMessage(HotkeyMessage msg)
{
if (msg.Key == ApplicationDomainEx.HotKeyConfig.SaveOpendPageOrTemplateAndProject)
{
this.Save();
}
}
// ====================================================================================== // ======================================================================================
// Public Function // Public Function
// ====================================================================================== // ======================================================================================
...@@ -294,6 +342,5 @@ namespace VIZ.Package.Module ...@@ -294,6 +342,5 @@ namespace VIZ.Package.Module
// ====================================================================================== // ======================================================================================
// Private Function // Private Function
// ====================================================================================== // ======================================================================================
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.TestPlugin
{
/// <summary>
/// 插件程序集
/// </summary>
public class PluginAssembly : IPluginAssembly
{
public void Check()
{
}
}
}
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
<Compile Include="Module\TestModuleViewModel.cs" /> <Compile Include="Module\TestModuleViewModel.cs" />
<Compile Include="Module\TestModulePluginLifeCycle.cs" /> <Compile Include="Module\TestModulePluginLifeCycle.cs" />
<Compile Include="Page\TestPagePluginLifeCycle.cs" /> <Compile Include="Page\TestPagePluginLifeCycle.cs" />
<Compile Include="PluginAssembly.cs" />
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
......
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