Commit 60ee21fa by liulongfei

1. 场景多选

2. 退出程序时询问是否保存项目
parent 0a7cf5aa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 资源文件选择模式
/// </summary>
public enum ResourceFileSelectionMode
{
/// <summary>
/// 单选
/// </summary>
Single,
/// <summary>
/// 多选
/// </summary>
Multiple
}
}
...@@ -117,6 +117,20 @@ namespace VIZ.Package.Domain ...@@ -117,6 +117,20 @@ namespace VIZ.Package.Domain
#endregion #endregion
#region IsChecked -- 是否被选中
private bool isChecked;
/// <summary>
/// 是否被选中
/// </summary>
public bool IsChecked
{
get { return isChecked; }
set { isChecked = value; this.RaisePropertyChanged(nameof(IsChecked)); }
}
#endregion
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// 方法 // 方法
......
...@@ -34,11 +34,11 @@ namespace VIZ.Package.Domain ...@@ -34,11 +34,11 @@ namespace VIZ.Package.Domain
#region Files -- 文件集合 #region Files -- 文件集合
private ObservableCollection<GHResourceFileModel> files; private ObservableCollection<GHResourceFileModel> files = new ObservableCollection<GHResourceFileModel>();
/// <summary> /// <summary>
/// 文件集合 /// 文件集合
/// </summary> /// </summary>
public ObservableCollection<GHResourceFileModel> Files public ObservableCollection<GHResourceFileModel> Files
{ {
get { return files; } get { return files; }
set { files = value; this.RaisePropertyChanged(nameof(Files)); } set { files = value; this.RaisePropertyChanged(nameof(Files)); }
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<Compile Include="Model\Page\PageModel.cs" /> <Compile Include="Model\Page\PageModel.cs" />
<Compile Include="Model\Page\PageModelBase.cs" /> <Compile Include="Model\Page\PageModelBase.cs" />
<Compile Include="Model\Page\PageTemplateModel.cs" /> <Compile Include="Model\Page\PageTemplateModel.cs" />
<Compile Include="Model\Resource\Enum\ResourceFileSelectionMode.cs" />
<Compile Include="Model\Resource\Enum\ResourceFileType.cs" /> <Compile Include="Model\Resource\Enum\ResourceFileType.cs" />
<Compile Include="Model\Resource\Enum\ResourceFolderType.cs" /> <Compile Include="Model\Resource\Enum\ResourceFolderType.cs" />
<Compile Include="Model\Resource\GH\GHResourceFileModel.cs" /> <Compile Include="Model\Resource\GH\GHResourceFileModel.cs" />
......
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using VIZ.Package.Domain;
namespace VIZ.Package.Module.Resource
{
/// <summary>
/// 资源文件选择模式转化器
/// </summary>
public class ResourceFileSelectionModeConverter : IValueConverter
{
/// <summary>
/// 单选模式数据模板
/// </summary>
public DataTemplate SingleDataTemplate { get; set; }
/// <summary>
/// 多选模式数据模板
/// </summary>
public DataTemplate MultipleDataTemplate { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is ResourceFileSelectionMode mode))
return null;
switch (mode)
{
case ResourceFileSelectionMode.Single: return this.SingleDataTemplate;
case ResourceFileSelectionMode.Multiple: return this.MultipleDataTemplate;
default: return null;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- CheckBox_Resource -->
<Style x:Key="CheckBox_Resource" TargetType="CheckBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid Background="Transparent">
<Image x:Name="img_hover" Width="36" Height="36" Visibility="Collapsed"
VerticalAlignment="Top" HorizontalAlignment="Right"
Source="/VIZ.Package.Module.Resource;component/Icons/checked_36x36.png"></Image>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="img_hover" Property="Visibility" Value="Visible"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
...@@ -77,6 +77,10 @@ ...@@ -77,6 +77,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Style\CheckBox\CheckBox_Resource.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Style\CheckBox\CheckBox_Preview.xaml"> <Page Include="Style\CheckBox\CheckBox_Preview.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -95,6 +99,7 @@ ...@@ -95,6 +99,7 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<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="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
...@@ -145,6 +150,14 @@ ...@@ -145,6 +150,14 @@
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project> <Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name> <Name>VIZ.Framework.Core</Name>
</ProjectReference> </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.Package.Domain\VIZ.Package.Domain.csproj">
<Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project>
<Name>VIZ.Package.Domain</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Icons\bb_36x36.png" /> <Resource Include="Icons\bb_36x36.png" />
...@@ -166,5 +179,8 @@ ...@@ -166,5 +179,8 @@
<Resource Include="Icons\ta_36x36.png" /> <Resource Include="Icons\ta_36x36.png" />
<Resource Include="Icons\ta_hover_36x36.png" /> <Resource Include="Icons\ta_hover_36x36.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Icons\checked_36x36.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -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.Windows;
using System.Windows.Forms; using System.Windows.Forms;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
...@@ -51,6 +52,7 @@ namespace VIZ.Package.Module ...@@ -51,6 +52,7 @@ namespace VIZ.Package.Module
private void InitMessage() private void InitMessage()
{ {
ApplicationDomainEx.MessageManager.Register<VizPreviewReadyMessage>(this, this.OnVizPreviewReadyMessage); ApplicationDomainEx.MessageManager.Register<VizPreviewReadyMessage>(this, this.OnVizPreviewReadyMessage);
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage);
} }
// ===================================================================== // =====================================================================
...@@ -358,6 +360,21 @@ namespace VIZ.Package.Module ...@@ -358,6 +360,21 @@ namespace VIZ.Package.Module
this.IsVizPreviewReady = true; this.IsVizPreviewReady = true;
} }
/// <summary>
/// 应用程序关闭消息
/// </summary>
/// <param name="msg">消息</param>
private void OnApplicationCloseMessage(ApplicationCloseMessage msg)
{
if (ApplicationDomainEx.ProjectDbContext == null)
return;
if (DXMessageBox.Show("是否保存项目?", "提示", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
this.SaveProject();
}
// ===================================================================== // =====================================================================
// Public Function // Public Function
// ===================================================================== // =====================================================================
......
...@@ -500,9 +500,6 @@ namespace VIZ.Package.Module ...@@ -500,9 +500,6 @@ namespace VIZ.Package.Module
if (ApplicationDomainEx.VizPreviewProcess == null || ApplicationDomainEx.VizPreviewProcess.HasExited) if (ApplicationDomainEx.VizPreviewProcess == null || ApplicationDomainEx.VizPreviewProcess.HasExited)
return; return;
if (DXMessageBox.Show("是否关闭Viz引擎?", "提示", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
try try
{ {
ApplicationDomainEx.VizPreviewProcess.Kill(); ApplicationDomainEx.VizPreviewProcess.Kill();
......
...@@ -61,6 +61,12 @@ namespace VIZ.Package.Module ...@@ -61,6 +61,12 @@ namespace VIZ.Package.Module
return; return;
} }
// 清除选择
foreach (GHResourceFileModel file in folder.Files)
{
file.IsChecked = false;
}
// 已经获取过文件 // 已经获取过文件
if (folder.IsRefreshedFiles) if (folder.IsRefreshedFiles)
{ {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core" xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:local="clr-namespace:VIZ.Package.Module" xmlns:local="clr-namespace:VIZ.Package.Module"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain" xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:GHResourcePanelModel}" d:DataContext="{d:DesignInstance Type=local:GHResourcePanelModel}"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
...@@ -20,8 +21,41 @@ ...@@ -20,8 +21,41 @@
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Package.Module.Resource;component/DevExpreess/GridControl/GridControl_Files.xaml"></ResourceDictionary> <ResourceDictionary Source="/VIZ.Package.Module.Resource;component/DevExpreess/GridControl/GridControl_Files.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/GridSplitter/GridSplitter_None.xaml"></ResourceDictionary> <ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/GridSplitter/GridSplitter_None.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/CheckBox/CheckBox_Resource.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<fcore:Bitmap2ImageSourceConverter x:Key="Bitmap2ImageSourceConverter"></fcore:Bitmap2ImageSourceConverter> <fcore:Bitmap2ImageSourceConverter x:Key="Bitmap2ImageSourceConverter"></fcore:Bitmap2ImageSourceConverter>
<resource:ResourceFileSelectionModeConverter x:Key="ResourceFileSelectionModeConverter">
<!-- 单选 -->
<resource:ResourceFileSelectionModeConverter.SingleDataTemplate>
<DataTemplate>
<Grid Width="120" ClipToBounds="False" UseLayoutRounding="True" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Image Source="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"></Image>
<TextBlock Grid.Row="1" TextAlignment="Center" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center"
Text="{Binding Path=Row.Name}" ToolTip="{Binding Path=Row.Name}" Margin="0,5,0,0"/>
</Grid>
</DataTemplate>
</resource:ResourceFileSelectionModeConverter.SingleDataTemplate>
<!-- 多选 -->
<resource:ResourceFileSelectionModeConverter.MultipleDataTemplate>
<DataTemplate>
<Grid Width="120" ClipToBounds="False" UseLayoutRounding="True" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Image Source="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"></Image>
<TextBlock Grid.Row="1" TextAlignment="Center" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center"
Text="{Binding Path=Row.Name}" ToolTip="{Binding Path=Row.Name}" Margin="0,5,0,0"/>
<CheckBox Style="{StaticResource ResourceKey=CheckBox_Resource}" Grid.RowSpan="2"
IsChecked="{Binding Path=Row.IsChecked,Mode=TwoWay}"></CheckBox>
</Grid>
</DataTemplate>
</resource:ResourceFileSelectionModeConverter.MultipleDataTemplate>
</resource:ResourceFileSelectionModeConverter>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
...@@ -38,7 +72,8 @@ ...@@ -38,7 +72,8 @@
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,10,0" <dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,10,0"
SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}" SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}"
ContextMenu="{Binding Path=FolderContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}" ContextMenu="{Binding Path=FolderContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
SelectionMode="Row" ShowNodeImages="True" ShowSearchPanel="False" SelectionMode="Row"
ShowNodeImages="True" ShowSearchPanel="False"
ExpandStateFieldName="IsExpand" ExpandStateFieldName="IsExpand"
AllowEditing="False" TreeViewFieldName="Name" ChildNodesPath="Children"> AllowEditing="False" TreeViewFieldName="Name" ChildNodesPath="Children">
<dxmvvm:Interaction.Behaviors> <dxmvvm:Interaction.Behaviors>
...@@ -56,26 +91,13 @@ ...@@ -56,26 +91,13 @@
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False" <dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False"
ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}" ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
SelectionMode="Row"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}" CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
ItemsSource="{Binding Path=FileModels}" ItemsSource="{Binding Path=FileModels}"
SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}"> SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}">
<dxmvvm:Interaction.Behaviors> <dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="MouseDoubleClick" Command="{Binding Path=FileDoubleClickCommand}"></dxmvvm:EventToCommand> <dxmvvm:EventToCommand EventName="MouseDoubleClick" Command="{Binding Path=FileDoubleClickCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors> </dxmvvm:Interaction.Behaviors>
<dxg:GridControl.Resources>
<!-- 定义Card模板 -->
<DataTemplate x:Key="CardTemplate">
<Grid Width="120" ClipToBounds="False" UseLayoutRounding="True" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Image Source="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"></Image>
<TextBlock Grid.Row="1" TextAlignment="Center" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center"
Text="{Binding Path=Row.Name}" ToolTip="{Binding Path=Row.Name}" Margin="0,5,0,0"/>
</Grid>
</DataTemplate>
</dxg:GridControl.Resources>
<dxg:GridControl.Columns> <dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Name" AllowColumnFiltering="False" AllowEditing="False" ReadOnly="True"></dxg:GridColumn> <dxg:GridColumn FieldName="Name" AllowColumnFiltering="False" AllowEditing="False" ReadOnly="True"></dxg:GridColumn>
</dxg:GridControl.Columns> </dxg:GridControl.Columns>
...@@ -93,9 +115,7 @@ ...@@ -93,9 +115,7 @@
ShowSearchPanelMode="Never" ShowSearchPanelMode="Never"
SearchColumns="Name" SearchColumns="Name"
NavigationStyle="Row" NavigationStyle="Row"
CardTemplate="{StaticResource CardTemplate}"/> CardTemplate="{Binding Path=FileSelectionMode,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}},Converter={StaticResource ResourceFileSelectionModeConverter}}"/>
</dxg:GridControl.View> </dxg:GridControl.View>
</dxg:GridControl> </dxg:GridControl>
......
using System; using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -13,6 +14,7 @@ using System.Windows.Media.Imaging; ...@@ -13,6 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -63,5 +65,24 @@ namespace VIZ.Package.Module ...@@ -63,5 +65,24 @@ namespace VIZ.Package.Module
DependencyProperty.Register("FileContextMenu", typeof(ContextMenu), typeof(GHResourcePanel), new PropertyMetadata(null)); DependencyProperty.Register("FileContextMenu", typeof(ContextMenu), typeof(GHResourcePanel), new PropertyMetadata(null));
#endregion #endregion
#region FileSelectionMode -- 文件选择模式
/// <summary>
/// 文件选择模式
/// </summary>
public ResourceFileSelectionMode FileSelectionMode
{
get { return (ResourceFileSelectionMode)GetValue(FileSelectionModeProperty); }
set { SetValue(FileSelectionModeProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for FileSelectionMode. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty FileSelectionModeProperty =
DependencyProperty.Register("FileSelectionMode", typeof(ResourceFileSelectionMode), typeof(GHResourcePanel), new PropertyMetadata(ResourceFileSelectionMode.Single));
#endregion
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="Transparent"> <Grid Background="Transparent">
<!-- GH资源面板 --> <!-- GH资源面板 -->
<local:GHResourcePanel> <local:GHResourcePanel FileSelectionMode="Multiple">
<local:GHResourcePanel.FolderContextMenu> <local:GHResourcePanel.FolderContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFolderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> <MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFolderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<local:GHResourcePanel.FileContextMenu> <local:GHResourcePanel.FileContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> <MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="取消选择" Command="{Binding Path=PlacementTarget.DataContext.CancelFileSelectedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator/> <Separator/>
<MenuItem Header="添加场景模板" Command="{Binding Path=PlacementTarget.DataContext.AddSceneTemplateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> <MenuItem Header="添加场景模板" Command="{Binding Path=PlacementTarget.DataContext.AddSceneTemplateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu> </ContextMenu>
......
...@@ -27,6 +27,7 @@ namespace VIZ.Package.Module ...@@ -27,6 +27,7 @@ namespace VIZ.Package.Module
private void InitCommand() private void InitCommand()
{ {
this.AddSceneTemplateCommand = new VCommand(this.AddSceneTemplate); this.AddSceneTemplateCommand = new VCommand(this.AddSceneTemplate);
this.CancelFileSelectedCommand = new VCommand(this.CancelFileSelected);
} }
// =========================================================================== // ===========================================================================
...@@ -45,14 +46,43 @@ namespace VIZ.Package.Module ...@@ -45,14 +46,43 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void AddSceneTemplate() private void AddSceneTemplate()
{ {
if (this.SelectedFileModel == null) if (this.SelectedFolderModel == null)
return; return;
IPageTemplateService service = ApplicationDomainEx.ServiceManager.GetService<IPageTemplateService>(ViewServiceKeys.PAGE_TEMPLATE_SERVICE); IPageTemplateService service = ApplicationDomainEx.ServiceManager.GetService<IPageTemplateService>(ViewServiceKeys.PAGE_TEMPLATE_SERVICE);
if (service == null) if (service == null)
return; return;
service.AddSceneTemplate(this.SelectedFileModel); foreach (GHResourceFileModel file in this.SelectedFolderModel.Files)
{
if (!file.IsChecked)
continue;
service.AddSceneTemplate(file);
}
}
#endregion
#region CancelFileSelectedCommand -- 取消文件选择命令
/// <summary>
/// 取消文件选择命令
/// </summary>
public VCommand CancelFileSelectedCommand { get; set; }
/// <summary>
/// 取消文件选择
/// </summary>
private void CancelFileSelected()
{
if (this.SelectedFolderModel == null)
return;
foreach (GHResourceFileModel file in this.SelectedFolderModel.Files)
{
file.IsChecked = false;
}
} }
#endregion #endregion
......
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