Commit 331a29fb by liulongfei

样式调整

parent ef392993
...@@ -11,5 +11,9 @@ namespace VIZ.Package.Domain ...@@ -11,5 +11,9 @@ namespace VIZ.Package.Domain
/// </summary> /// </summary>
public class ApplicationCloseMessage public class ApplicationCloseMessage
{ {
/// <summary>
/// 是否取消关闭
/// </summary>
public bool IsCancel { get; set; }
} }
} }
using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace VIZ.Package.Module.Resource
{
/// <summary>
/// Viz主题资源
/// </summary>
public class VizThemeThemePalette : ThemePalette
{
public VizThemeThemePalette() : base("VizTheme")
{
SetColor("HoverBackground", (Color)ColorConverter.ConvertFromString("#11FFFFFF"));
SetColor("Backstage.Button.Background", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Backstage.Delimiter", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Backstage.HoverBackground", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Backstage.Window.Background", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Focused", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("SelectionBackground", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("SelectionBorder", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
SetColor("Window.HeaderButton.SelectionBackground", (Color)ColorConverter.ConvertFromString("#FF4E4BDE"));
}
}
}
...@@ -83,5 +83,42 @@ ...@@ -83,5 +83,42 @@
</Setter> </Setter>
</Style> </Style>
<!-- IconButton_Menu -->
<Style x:Key="IconButton_Menu" TargetType="fcommon:IconButton">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Height" Value="20"></Setter>
<Setter Property="Width" Value="20"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="fcommon:IconButton">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<Grid x:Name="content" Opacity="1">
<Image x:Name="img" Width="20" Height="20" Visibility="Visible"
Source="{TemplateBinding Icon}"></Image>
<Image x:Name="img_hover" Width="20" Height="20" Visibility="Collapsed"
Source="{TemplateBinding IconHover}"></Image>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="content" Property="Opacity" Value="1"></Setter>
<Setter TargetName="img" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="img_hover" Property="Visibility" Value="Visible"></Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="content" Property="Opacity" Value="0.9"></Setter>
<Setter TargetName="img" Property="Visibility" Value="Collapsed"></Setter>
<Setter TargetName="img_hover" Property="Visibility" Value="Visible"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary> </ResourceDictionary>
\ No newline at end of file
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
<Compile Include="Converter\ResourceFileSelectionModeConverter.cs" /> <Compile Include="Converter\ResourceFileSelectionModeConverter.cs" />
<Compile Include="Converter\RichText2TextConverter.cs" /> <Compile Include="Converter\RichText2TextConverter.cs" />
<Compile Include="Converter\RowHandleConverter.cs" /> <Compile Include="Converter\RowHandleConverter.cs" />
<Compile Include="DevExpreess\Theme\VizThemeThemePalette.cs" />
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
...@@ -194,5 +195,18 @@ ...@@ -194,5 +195,18 @@
<ItemGroup> <ItemGroup>
<Resource Include="Images\logo_large.png" /> <Resource Include="Images\logo_large.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Icons\icon_save_30x30.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\icon_save_hover_30x30.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\icon_save_as_30x30.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\icon_save_as_hover_30x30.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
using log4net; using DevExpress.Data;
using log4net;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -72,10 +73,23 @@ namespace VIZ.Package.Module ...@@ -72,10 +73,23 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void Take() private void Take()
{ {
// 更新控制字段List的值
IFieldTreeService service = ApplicationDomainEx.ServiceManager.GetService<IFieldTreeService>(ViewServiceKeys.FIELD_TREE_SERVICE);
if (service == null)
return;
// 尝试更新控制字段List的值
service.TryUpdateControlFieldListValue();
// 执行上版流程
this.Execute( this.Execute(
controlObjectAction: (obj, conn) => controlObjectAction: (obj, conn) =>
{ {
this.vizCommandService.TakeIn(conn, ApplicationDomainEx.CurrentPage.ScenePath, ApplicationDomainEx.CurrentPage.Layer); this.vizCommandService.SetEnabledUpdate(conn, false);
this.vizCommandService.SetObject(conn, ApplicationDomainEx.CurrentPage.ScenePath, ApplicationDomainEx.CurrentPage.Layer);
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.Start(conn, ApplicationDomainEx.CurrentPage.Layer);
}, },
pluginAction: (view, conns) => pluginAction: (view, conns) =>
{ {
...@@ -147,6 +161,15 @@ namespace VIZ.Package.Module ...@@ -147,6 +161,15 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void Update() private void Update()
{ {
// 更新控制字段List的值
IFieldTreeService service = ApplicationDomainEx.ServiceManager.GetService<IFieldTreeService>(ViewServiceKeys.FIELD_TREE_SERVICE);
if (service == null)
return;
// 尝试更新控制字段List的值
service.TryUpdateControlFieldListValue();
// 执行更新流程
this.Execute( this.Execute(
controlObjectAction: (obj, conn) => controlObjectAction: (obj, conn) =>
{ {
......
...@@ -64,6 +64,10 @@ namespace VIZ.Package.Module ...@@ -64,6 +64,10 @@ namespace VIZ.Package.Module
bool.TryParse(e.NewValue?.ToString(), out bool value); bool.TryParse(e.NewValue?.ToString(), out bool value);
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = value ? "1" : "0";
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
...@@ -69,7 +73,7 @@ namespace VIZ.Package.Module ...@@ -69,7 +73,7 @@ namespace VIZ.Package.Module
columnDefinition.ControlField.FieldIdentifier, columnDefinition.ControlField.FieldIdentifier,
cellData.RowData.RowHandle.Value, cellData.RowData.RowHandle.Value,
columnDefinition.FieldName, columnDefinition.FieldName,
e.NewValue?.ToString()); e.NewValue?.ToString() ?? string.Empty);
} }
} }
} }
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -74,6 +74,10 @@ namespace VIZ.Package.Module ...@@ -74,6 +74,10 @@ namespace VIZ.Package.Module
string richText = $"{RICH_TEXT_LEFT}{e.NewValue?.ToString() ?? string.Empty}{RICH_TEXT_RIGHT}"; string richText = $"{RICH_TEXT_LEFT}{e.NewValue?.ToString() ?? string.Empty}{RICH_TEXT_RIGHT}";
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = richText;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module ...@@ -62,6 +62,10 @@ namespace VIZ.Package.Module
if (columnDefinition == null) if (columnDefinition == null)
return; return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令 // 向Viz发送指令
this.VizCommandControlObjectService.SetControlObjectListValue( this.VizCommandControlObjectService.SetControlObjectListValue(
ApplicationDomainEx.PreviewConn, ApplicationDomainEx.PreviewConn,
......
...@@ -3,22 +3,57 @@ ...@@ -3,22 +3,57 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:common="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common" xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:local="clr-namespace:VIZ.Package.Module" xmlns:local="clr-namespace:VIZ.Package.Module"
d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}" d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}"
d:Background="Black"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 描述 -->
<Border Background="#11FFFFFF" Grid.Row="0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
<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="场景:" Margin="30,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="字段:" Margin="30,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>
</StackPanel>
</Border>
<!-- 按钮组 --> <!-- 按钮组 -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Border Background="#11FFFFFF" Grid.Row="1">
<Button Width="80" Height="24" Content="保存字段" Command="{Binding SaveCommand}"></Button> <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
</StackPanel> <!-- 保存 -->
<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"
Command="{Binding SaveCommand}"></fcommon:IconButton>
<!-- 另存为 -->
<fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/icon_save_as_30x30.png"
IconHover="/VIZ.Package.Module.Resource;component/Icons/icon_save_as_hover_30x30.png"
Style="{StaticResource IconButton_Menu}"
ToolTip="另保为" Margin="5,0,0,0"
Command="{Binding SaveAsCommand}"></fcommon:IconButton>
</StackPanel>
</Border>
<!-- 字段编辑 --> <!-- 字段编辑 -->
<common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" Grid.Row="1" <fcommon:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" Grid.Row="2" Margin="0,5,0,0"
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl> SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></fcommon:NavigationControl>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -37,6 +37,7 @@ namespace VIZ.Package.Module ...@@ -37,6 +37,7 @@ namespace VIZ.Package.Module
private void InitCommand() private void InitCommand()
{ {
this.SaveCommand = new VCommand(this.Save); this.SaveCommand = new VCommand(this.Save);
this.SaveAsCommand = new VCommand(this.SaveAs);
} }
/// <summary> /// <summary>
...@@ -45,6 +46,7 @@ namespace VIZ.Package.Module ...@@ -45,6 +46,7 @@ namespace VIZ.Package.Module
private void InitMessage() private void InitMessage()
{ {
ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage); ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage);
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
} }
// ============================================================= // =============================================================
...@@ -88,6 +90,34 @@ namespace VIZ.Package.Module ...@@ -88,6 +90,34 @@ namespace VIZ.Package.Module
#endregion #endregion
#region PageID -- ID
private int? pageID;
/// <summary>
/// 页ID
/// </summary>
public int? PageID
{
get { return pageID; }
set { pageID = value; this.RaisePropertyChanged(nameof(PageID)); }
}
#endregion
#region Scene -- 场景
private string scene;
/// <summary>
/// 场景
/// </summary>
public string Scene
{
get { return scene; }
set { scene = value; this.RaisePropertyChanged(nameof(Scene)); }
}
#endregion
// ============================================================= // =============================================================
// Command // Command
// ============================================================= // =============================================================
...@@ -134,11 +164,66 @@ namespace VIZ.Package.Module ...@@ -134,11 +164,66 @@ namespace VIZ.Package.Module
#endregion #endregion
#region SaveAsCommand -- 另存为命令
/// <summary>
/// 另存为命令
/// </summary>
public VCommand SaveAsCommand { get; set; }
/// <summary>
/// 另存为
/// </summary>
private void SaveAs()
{
// 当前没有打开的页或模板 || 当前没有打开的项目
if (ApplicationDomainEx.CurrentPage == null || ApplicationDomainEx.ProjectDbContext == null)
{
DXMessageBox.Show("另存失败!");
return;
}
// 页分组服务不可用
IPageGroupService pageGroupService = ApplicationDomainEx.ServiceManager.GetService<IPageGroupService>(ViewServiceKeys.PAGE_GROUP_SERVICE);
if (pageGroupService == null)
{
DXMessageBox.Show("另存失败!");
return;
}
// 另存模板
if (ApplicationDomainEx.CurrentPage is PageTemplateModel srcTemplate)
{
PageModel page = pageGroupService.AddPage(srcTemplate);
this.controlObjectService.CopyControlFields(srcTemplate.TemplateID, page.PageID);
pageGroupService.OpenPage(page);
}
// 另存页
else if (ApplicationDomainEx.CurrentPage is PageModel srcPage)
{
PageModel page = pageGroupService.CopyPage();
this.controlObjectService.CopyControlFields(srcPage.PageID, page.PageID);
pageGroupService.OpenPage(page);
}
}
#endregion
// ============================================================= // =============================================================
// Message // Message
// ============================================================= // =============================================================
/// <summary> /// <summary>
/// 页打开消息
/// </summary>
/// <param name="msg">消息</param>
private void OnPageOpenMessage(PageOpenMessage msg)
{
this.PageID = 1000;
this.Scene = msg.Page?.Scene;
}
/// <summary>
/// 控制字段切换消息 /// 控制字段切换消息
/// </summary> /// </summary>
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
......
...@@ -18,5 +18,10 @@ namespace VIZ.Package.Module ...@@ -18,5 +18,10 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
/// <returns>获取控制对象</returns> /// <returns>获取控制对象</returns>
ControlObjectModel GetControlObject(); ControlObjectModel GetControlObject();
/// <summary>
/// 尝试更新控制字段List的值
/// </summary>
void TryUpdateControlFieldListValue();
} }
} }
...@@ -102,8 +102,8 @@ namespace VIZ.Package.Module ...@@ -102,8 +102,8 @@ namespace VIZ.Package.Module
get { return selectedControlField; } get { return selectedControlField; }
set set
{ {
// 字段改变处理 // 尝试更新List的值
this.beforeControlFieldChanged(selectedControlField, value); this.TryUpdateControlFieldListValue();
selectedControlField = value; selectedControlField = value;
this.RaisePropertyChanged(nameof(SelectedControlField)); this.RaisePropertyChanged(nameof(SelectedControlField));
...@@ -186,25 +186,18 @@ namespace VIZ.Package.Module ...@@ -186,25 +186,18 @@ namespace VIZ.Package.Module
return this.ControlObject; return this.ControlObject;
} }
// =============================================================
// Private Function
// =============================================================
/// <summary> /// <summary>
/// 控制字段改变之前触发 /// 尝试更新控制字段List的值
/// </summary> /// </summary>
/// <param name="oldField">改变之前的字段</param> public void TryUpdateControlFieldListValue()
/// <param name="newField">改变之后的字段</param>
private void beforeControlFieldChanged(ControlFieldNodeModel oldField, ControlFieldNodeModel newField)
{ {
// 如果之前的字段为list字段,那么需要更新最新的list值 if (this.SelectedControlField == null || this.SelectedControlField.Type != VizControlFieldType.list)
if (oldField != null && oldField.Type == Storage.VizControlFieldType.list) return;
IFieldEditService service = ApplicationDomainEx.ServiceManager.GetService<IFieldEditService>(ViewServiceKeys.FIELD_EDIT_SERVICE);
if (service != null)
{ {
IFieldEditService service = ApplicationDomainEx.ServiceManager.GetService<IFieldEditService>(ViewServiceKeys.FIELD_EDIT_SERVICE); this.SelectedControlField.Value = service.GetCurrentEditFieldValue();
if (service != null)
{
oldField.Value = service.GetCurrentEditFieldValue();
}
} }
} }
} }
......
...@@ -81,6 +81,6 @@ ...@@ -81,6 +81,6 @@
Command="{Binding Path=LoginCommand}"></Button> Command="{Binding Path=LoginCommand}"></Button>
</Grid> </Grid>
<dx:WaitIndicator DeferedVisibility="{Binding IsLoading}" Content="Loading..." /> <dx:WaitIndicator DeferedVisibility="{Binding IsLoading}" Content="Loading..." Grid.RowSpan="2" />
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
</dxmvvm:Interaction.Behaviors> </dxmvvm:Interaction.Behaviors>
<dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop" EnableWin32Compatibility="True" <dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop" EnableWin32Compatibility="True"
ViewStyle="Light"
AutoHideExpandMode="MouseDown"> AutoHideExpandMode="MouseDown">
<dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup> <dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup>
</dxdo:DockLayoutManager> </dxdo:DockLayoutManager>
......
...@@ -366,13 +366,32 @@ namespace VIZ.Package.Module ...@@ -366,13 +366,32 @@ namespace VIZ.Package.Module
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg) private void OnApplicationCloseMessage(ApplicationCloseMessage msg)
{ {
// 项目未打开
if (ApplicationDomainEx.ProjectDbContext == null) if (ApplicationDomainEx.ProjectDbContext == null)
return; {
var result = DXMessageBox.Show("确定关闭系统?", "提示", MessageBoxButton.YesNo);
if (DXMessageBox.Show("是否保存项目?", "提示", MessageBoxButton.YesNo) != MessageBoxResult.Yes) msg.IsCancel = result == MessageBoxResult.No;
return; }
// 项目已经打开
else
{
var result = DXMessageBox.Show("是否保存项目?", "提示", MessageBoxButton.YesNoCancel);
this.SaveProject(); // 保存项目
if (result == MessageBoxResult.Yes)
{
this.SaveProject();
return;
}
// 取消关闭
if (result == MessageBoxResult.Cancel)
{
msg.IsCancel = true;
}
}
} }
// ===================================================================== // =====================================================================
......
...@@ -17,6 +17,19 @@ namespace VIZ.Package.Module ...@@ -17,6 +17,19 @@ namespace VIZ.Package.Module
/// 添加页 /// 添加页
/// </summary> /// </summary>
/// <param name="template">模板</param> /// <param name="template">模板</param>
void AddPage(PageTemplateModel template); /// <returns>页</returns>
PageModel AddPage(PageTemplateModel template);
/// <summary>
/// 拷贝页
/// </summary>
/// <returns>页</returns>
PageModel CopyPage();
/// <summary>
/// 打开页
/// </summary>
/// <param name="page">页</param>
void OpenPage(PageModel page);
} }
} }
...@@ -6,6 +6,7 @@ using System.Collections.ObjectModel; ...@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.UI;
using System.Windows; using System.Windows;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
...@@ -73,6 +74,11 @@ namespace VIZ.Package.Module ...@@ -73,6 +74,11 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private GHService ghService = new GHService(); private GHService ghService = new GHService();
/// <summary>
/// 控制对象服务
/// </summary>
private ControlObjectService controlObjectService = new ControlObjectService();
// ====================================================================================== // ======================================================================================
// Property // Property
// ====================================================================================== // ======================================================================================
...@@ -372,10 +378,11 @@ namespace VIZ.Package.Module ...@@ -372,10 +378,11 @@ namespace VIZ.Package.Module
/// 添加页 /// 添加页
/// </summary> /// </summary>
/// <param name="template">模板</param> /// <param name="template">模板</param>
public void AddPage(PageTemplateModel template) /// <returns>页</returns>
public PageModel AddPage(PageTemplateModel template)
{ {
if (this.SelectedPageGroupModel == null) if (this.SelectedPageGroupModel == null)
return; return null;
PageAddWindow window = new PageAddWindow(); PageAddWindow window = new PageAddWindow();
PageAddViewModel vm = window.DataContext as PageAddViewModel; PageAddViewModel vm = window.DataContext as PageAddViewModel;
...@@ -384,7 +391,7 @@ namespace VIZ.Package.Module ...@@ -384,7 +391,7 @@ namespace VIZ.Package.Module
vm.Layer = template.Layer; vm.Layer = template.Layer;
if (window.ShowDialog() != true) if (window.ShowDialog() != true)
return; return null;
PageModel page = new PageModel(); PageModel page = new PageModel();
page.PageID = Guid.NewGuid(); page.PageID = Guid.NewGuid();
...@@ -415,6 +422,70 @@ namespace VIZ.Package.Module ...@@ -415,6 +422,70 @@ namespace VIZ.Package.Module
}); });
}); });
} }
return page;
}
/// <summary>
/// 拷贝页
/// </summary>
/// <returns>页</returns>
public PageModel CopyPage()
{
if (this.SelectedPageGroupModel == null || this.SelectedPageModel == null)
return null;
// 当前没有打开的页
if (ApplicationDomainEx.CurrentPage == null)
return null;
PageModel page = new PageModel();
page.PageID = Guid.NewGuid();
page.PageGroupID = this.SelectedPageGroupModel.GroupID;
page.Scene = this.SelectedPageModel.Scene;
page.ScenePath = this.SelectedPageModel.ScenePath;
page.ThumbnailUri = this.SelectedPageModel.ThumbnailUri;
page.Remark = this.SelectedPageModel.Remark;
page.Layer = this.SelectedPageModel.Layer;
page.EngineType = this.SelectedPageModel.EngineType;
page.PageType = this.SelectedPageModel.PageType;
page.TemplateID = this.SelectedPageModel.TemplateID;
page.ThumbnailBitmap = this.SelectedPageModel.ThumbnailBitmap;
page.PluginID = this.SelectedPageModel.PluginID;
page.PluginName = this.SelectedPageModel.PluginName;
this.SelectedPageGroupModel.Pages.Add(page);
if (page.ThumbnailBitmap == null)
{
ThreadHelper.SafeRun(() =>
{
var bmp = this.ghService.GetImage(page.ThumbnailUri);
WPFHelper.BeginInvoke(() =>
{
page.ThumbnailBitmap = bmp;
});
});
}
return page;
}
/// <summary>
/// 打开页
/// </summary>
/// <param name="page">页</param>
public void OpenPage(PageModel page)
{
PageGroupModel group = this.PageGroupModels.FirstOrDefault(p => p.GroupID == page.PageGroupID);
if (group == null)
return;
this.SelectedPageGroupModel = group;
this.SelectedPageModel = page;
this.OpenPage();
} }
} }
} }
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<!-- VIZ引擎 --> <!-- VIZ引擎 -->
<fcommon:WindowHost x:Name="host" Grid.Row="1" Background="#ff252526" BackColor="#ff252526"> <fcommon:WindowHost x:Name="host" Grid.Row="1" Background="Black" BackColor="Black">
<dxmvvm:Interaction.Behaviors> <dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand PassEventArgsToCommand="True" EventName="SizeChanged" <dxmvvm:EventToCommand PassEventArgsToCommand="True" EventName="SizeChanged"
Command="{Binding Path=WindowHostSizeChangedCommand}"></dxmvvm:EventToCommand> Command="{Binding Path=WindowHostSizeChangedCommand}"></dxmvvm:EventToCommand>
......
...@@ -72,6 +72,20 @@ namespace VIZ.Package.Service ...@@ -72,6 +72,20 @@ namespace VIZ.Package.Service
} }
/// <summary> /// <summary>
/// 拷贝控制字段
/// </summary>
/// <param name="srcID">源ID</param>
/// <param name="distID">目标ID</param>
public void CopyControlFields(Guid srcID, Guid distID)
{
ILiteCollection<ControlFieldEntity> srcCollection = ApplicationDomainEx.ProjectDbContext.GetControlFiled(srcID);
ILiteCollection<ControlFieldEntity> dstCollection = ApplicationDomainEx.ProjectDbContext.GetControlFiled(distID);
dstCollection.DeleteAll();
dstCollection.Insert(srcCollection.FindAll());
}
/// <summary>
/// 获取控制字段 /// 获取控制字段
/// </summary> /// </summary>
/// <param name="pageBase">页或模板</param> /// <param name="pageBase">页或模板</param>
......
...@@ -231,16 +231,22 @@ namespace VIZ.Package.Service ...@@ -231,16 +231,22 @@ namespace VIZ.Package.Service
} }
/// <summary> /// <summary>
/// 上版子 /// 设置更新
/// </summary> /// </summary>
/// <param name="connection">连接</param> /// <param name="conn">连接</param>
/// <param name="scene">场景</param> /// <param name="isEnabled">是否启用</param>
public void SetEnabledUpdate(ConnModel conn, bool isEnabled)
{
conn.EndpointManager.Send($"RENDERER*UPDATE SET {(isEnabled ? 1 : 0)}");
}
/// <summary>
/// 开始动画
/// </summary>
/// <param name="conn">连接</param>
/// <param name="layer">层</param>s /// <param name="layer">层</param>s
public void TakeIn(ConnModel conn, string scene, VizLayer layer) public void Start(ConnModel conn, VizLayer layer)
{ {
conn.EndpointManager.Send("RENDERER*UPDATE SET 0");
conn.EndpointManager.Send($"RENDERER*{layer} SET_OBJECT {scene}");
conn.EndpointManager.Send("RENDERER*UPDATE SET 1");
conn.EndpointManager.Send($"RENDERER*{layer}*STAGE START"); conn.EndpointManager.Send($"RENDERER*{layer}*STAGE START");
} }
......
...@@ -7,10 +7,12 @@ using System.Linq; ...@@ -7,10 +7,12 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Media;
using VIZ.Framework.Module; using VIZ.Framework.Module;
using VIZ.Package.Common; using VIZ.Package.Common;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Module; using VIZ.Package.Module;
using VIZ.Package.Module.Resource;
namespace VIZ.Package namespace VIZ.Package
{ {
...@@ -22,7 +24,10 @@ namespace VIZ.Package ...@@ -22,7 +24,10 @@ namespace VIZ.Package
public App() public App()
{ {
// 设置DevExpress主题 // 设置DevExpress主题
ApplicationThemeHelper.ApplicationThemeName = Theme.VS2019DarkName; VizThemeThemePalette palette = new VizThemeThemePalette();
Theme theme = Theme.CreateTheme(palette, Theme.VS2019Dark);
Theme.RegisterTheme(theme);
ApplicationThemeHelper.ApplicationThemeName = theme.Name;
// 初始化LiteDB // 初始化LiteDB
AppSetup.AppendSetup(new AppSetup_InitLiteDB()); AppSetup.AppendSetup(new AppSetup_InitLiteDB());
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:module="clr-namespace:VIZ.Package.Module;assembly=VIZ.Package.Module" xmlns:module="clr-namespace:VIZ.Package.Module;assembly=VIZ.Package.Module"
Title="魔羯座" Height="1000" Width="1600" ShowTitle="False" Title="魔羯座" Height="1000" Width="1600" ShowTitle="False" Padding="0"
WindowStartupLocation="CenterScreen" WindowState="Maximized"> WindowStartupLocation="CenterScreen" WindowState="Maximized">
<dx:ThemedWindow.ToolbarItems> <dx:ThemedWindow.ToolbarItems>
<!-- 主视图顶部 --> <!-- 主视图顶部 -->
...@@ -12,17 +12,17 @@ ...@@ -12,17 +12,17 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="35"></RowDefinition> <RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="35"></RowDefinition> <RowDefinition Height="25"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 主视图 --> <!-- 主视图 -->
<module:MainView></module:MainView> <module:MainView></module:MainView>
<!-- 状态视图 --> <!-- 状态视图 -->
<Border BorderBrush="#ff3f3f46" BorderThickness="1" Grid.Row="1" Margin="0,5,0,0"> <Border Background="#11ffffff" Grid.Row="1">
<module:MainStatusView></module:MainStatusView> <module:MainStatusView></module:MainStatusView>
</Border> </Border>
<!-- 连接视图 --> <!-- 连接视图 -->
<Border BorderBrush="#ff3f3f46" BorderThickness="1" Grid.Row="2" Margin="0,5,0,0"> <Border Background="#11ffffff" Grid.Row="2">
<module:MainConnView></module:MainConnView> <module:MainConnView></module:MainConnView>
</Border> </Border>
</Grid> </Grid>
......
...@@ -45,6 +45,8 @@ namespace VIZ.Package ...@@ -45,6 +45,8 @@ namespace VIZ.Package
{ {
ApplicationCloseMessage msg = new ApplicationCloseMessage(); ApplicationCloseMessage msg = new ApplicationCloseMessage();
ApplicationDomainEx.MessageManager.Send(msg); ApplicationDomainEx.MessageManager.Send(msg);
e.Cancel = msg.IsCancel;
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -68,6 +68,18 @@ ...@@ -68,6 +68,18 @@
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mono.Cecil, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.11.4.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
......
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
<packages> <packages>
<package id="LiteDB" version="5.0.15" targetFramework="net48" /> <package id="LiteDB" version="5.0.15" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" /> <package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Mono.Cecil" version="0.11.4" targetFramework="net48" />
</packages> </packages>
\ No newline at end of file
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