Commit 57b9c9f5 by liulongfei

场景模板选择页面逻辑调整

parent ad6b3a81
...@@ -117,20 +117,6 @@ namespace VIZ.Package.Domain ...@@ -117,20 +117,6 @@ 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
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// 方法 // 方法
......

3.08 KB | W: | H:

3.16 KB | W: | H:

VIZ.Package.Module.Resource/Icons/checked_36x36.png
VIZ.Package.Module.Resource/Icons/checked_36x36.png
VIZ.Package.Module.Resource/Icons/checked_36x36.png
VIZ.Package.Module.Resource/Icons/checked_36x36.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -57,16 +57,9 @@ namespace VIZ.Package.Module ...@@ -57,16 +57,9 @@ namespace VIZ.Package.Module
if (folder == null) if (folder == null)
{ {
this.ViewModel.FileModels = null; this.ViewModel.FileModels = null;
this.ViewModel.SelectedFileModel = null;
return; return;
} }
// 清除选择
foreach (GHResourceFileModel file in folder.Files)
{
file.IsChecked = false;
}
// 已经获取过文件 // 已经获取过文件
if (folder.IsRefreshedFiles) if (folder.IsRefreshedFiles)
{ {
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<TextBlock Grid.Row="1" TextAlignment="Center" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center" <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"/> Text="{Binding Path=Row.Name}" ToolTip="{Binding Path=Row.Name}" Margin="0,5,0,0"/>
<CheckBox Style="{StaticResource ResourceKey=CheckBox_Resource}" Grid.RowSpan="2" <CheckBox Style="{StaticResource ResourceKey=CheckBox_Resource}" Grid.RowSpan="2"
IsChecked="{Binding Path=Row.IsChecked,Mode=TwoWay}"></CheckBox> IsChecked="{Binding Path=IsSelected,Mode=OneWay}" IsHitTestVisible="False"></CheckBox>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</resource:ResourceFileSelectionModeConverter.MultipleDataTemplate> </resource:ResourceFileSelectionModeConverter.MultipleDataTemplate>
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
SelectionMode="Row" SelectionMode="Row"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}" CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
ItemsSource="{Binding Path=FileModels}" ItemsSource="{Binding Path=FileModels}"
SelectedItems="{Binding Path=SelectedFileModels,Mode=OneWayToSource}"
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>
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="Transparent"> <Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!-- GH资源面板 --> <!-- GH资源面板 -->
<local:GHResourcePanel FileSelectionMode="Multiple"> <local:GHResourcePanel FileSelectionMode="Multiple">
<local:GHResourcePanel.FolderContextMenu> <local:GHResourcePanel.FolderContextMenu>
...@@ -17,11 +21,14 @@ ...@@ -17,11 +21,14 @@
<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>
</local:GHResourcePanel.FileContextMenu> </local:GHResourcePanel.FileContextMenu>
</local:GHResourcePanel> </local:GHResourcePanel>
<!-- 按钮组 -->
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0">
<Button Content="添加模板" Width="100" Height="30" Command="{Binding Path=AddSceneTemplateCommand}"></Button>
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>
using DevExpress.Mvvm.Xpf; using DevExpress.Mvvm.Xpf;
using log4net; using log4net;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
...@@ -143,6 +144,20 @@ namespace VIZ.Package.Module ...@@ -143,6 +144,20 @@ namespace VIZ.Package.Module
#endregion #endregion
#region SelectedFileModels -- 选中的文件模型集合
private IList selectedFileModels;
/// <summary>
/// 选中的文件模型集合
/// </summary>
public IList SelectedFileModels
{
get { return selectedFileModels; }
set { selectedFileModels = value; this.RaisePropertyChanged(nameof(SelectedFileModels)); }
}
#endregion
#region IsFolderLoading -- 是否正在加载文件夹 #region IsFolderLoading -- 是否正在加载文件夹
private bool isFolderLoading; private bool isFolderLoading;
......
using System; using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -27,7 +28,6 @@ namespace VIZ.Package.Module ...@@ -27,7 +28,6 @@ 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);
} }
// =========================================================================== // ===========================================================================
...@@ -46,45 +46,23 @@ namespace VIZ.Package.Module ...@@ -46,45 +46,23 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void AddSceneTemplate() private void AddSceneTemplate()
{ {
if (this.SelectedFolderModel == null) if (this.SelectedFolderModel == null || this.SelectedFileModels.Count == 0)
{
DXMessageBox.Show("请选择场景模板");
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;
foreach (GHResourceFileModel file in this.SelectedFolderModel.Files) foreach (GHResourceFileModel file in this.SelectedFileModels)
{ {
if (!file.IsChecked)
continue;
service.AddSceneTemplate(file); service.AddSceneTemplate(file);
} }
} }
#endregion #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
} }
} }
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