Commit 259bfd4b by wangonghui

媒体库选择资源

parent 7f6e11b6
...@@ -20,6 +20,8 @@ namespace VIZ.Package.Module ...@@ -20,6 +20,8 @@ namespace VIZ.Package.Module
this.GHResourceEditPartModel.FilterResourceFileType = ResourceFileType.IMAGE; this.GHResourceEditPartModel.FilterResourceFileType = ResourceFileType.IMAGE;
this.GHResourceEditPartModel.OnFileDoubleClick += GHResourceEditPartModel_OnFileDoubleClick; this.GHResourceEditPartModel.OnFileDoubleClick += GHResourceEditPartModel_OnFileDoubleClick;
// 初始化命令 // 初始化命令
this.InitCommand(); this.InitCommand();
} }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Module
{
public class MHResourceEditPartModel: MediaResourcePanelViewModel
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// 媒体资源双击事件
/// </summary>
public class MHResourceFileDoubleClickEventArgs : EventArgs
{
/// <summary>
/// 文件
/// </summary>
public MHResourceFileModel File { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// 媒体资源库选中事件
/// </summary>
public class MHResourceSelectedFileChangedEventArgs : EventArgs
{
/// <summary>
/// 文件
/// </summary>
public MHResourceFileModel File { get; set; }
}
}
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition> <!--<RowDefinition Height="30"></RowDefinition>-->
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 资源文件夹 --> <!-- 资源文件夹 -->
...@@ -66,18 +66,18 @@ ...@@ -66,18 +66,18 @@
<GridSplitter HorizontalAlignment="Right" Width="4" Grid.Row="1"></GridSplitter> <GridSplitter HorizontalAlignment="Right" Width="4" Grid.Row="1"></GridSplitter>
<!-- 资源文件 --> <!-- 资源文件 -->
<StackPanel Grid.Column="1" Orientation="Horizontal"> <!--<StackPanel Grid.Column="1" Orientation="Horizontal">
<RadioButton Height="30" Width="60" Content="All" IsChecked="True"> <RadioButton Height="30" Width="60" Content="All" IsChecked="True">
<dxmvvm:Interaction.Behaviors> <dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.None}"></dxmvvm:EventToCommand> <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.None}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors> </dxmvvm:Interaction.Behaviors>
</RadioButton> </RadioButton>
<!--<RadioButton Height="30" Width="60" Content="场景"> <RadioButton Height="30" Width="60" Content="场景">
<dxmvvm:Interaction.Behaviors> <dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.SCENE}"></dxmvvm:EventToCommand> <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.SCENE}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors> </dxmvvm:Interaction.Behaviors>
</RadioButton>--> </RadioButton>
<RadioButton Height="30" Width="60" Content="图片"> <RadioButton Height="30" Width="60" Content="图片">
<dxmvvm:Interaction.Behaviors> <dxmvvm:Interaction.Behaviors>
...@@ -89,12 +89,17 @@ ...@@ -89,12 +89,17 @@
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.Video}"></dxmvvm:EventToCommand> <dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.Video}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors> </dxmvvm:Interaction.Behaviors>
</RadioButton> </RadioButton>
</StackPanel> </StackPanel>-->
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False" Grid.Row="1" <dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False" Grid.Row="1"
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}"
ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:MediaResourcePanel}}}"> ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:MediaResourcePanel}}}">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="MouseDoubleClick" Command="{Binding Path=FileDoubleClickCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:GridControl.Resources> <dxg:GridControl.Resources>
<!-- 定义Card模板 --> <!-- 定义Card模板 -->
<DataTemplate x:Key="CardTemplate"> <DataTemplate x:Key="CardTemplate">
......
...@@ -54,9 +54,10 @@ namespace VIZ.Package.Module ...@@ -54,9 +54,10 @@ namespace VIZ.Package.Module
this.FolderExpandCommand = new VCommand<DevExpress.Xpf.Grid.TreeList.NodeDoubleClickEventArgs>(this.FolderExpand); this.FolderExpandCommand = new VCommand<DevExpress.Xpf.Grid.TreeList.NodeDoubleClickEventArgs>(this.FolderExpand);
this.FileFilterCommand = new VCommand<ResourceFileType>(this.FileFilter); this.FileFilterCommand = new VCommand<ResourceFileType>(this.FileFilter);
this.FileRowFilterCommand = new DevExpress.Mvvm.DelegateCommand<RowFilterArgs>(this.FileRowFilter); this.FileRowFilterCommand = new DevExpress.Mvvm.DelegateCommand<RowFilterArgs>(this.FileRowFilter);
this.FileDoubleClickCommand = new VCommand(this.FileDoubleClick);
//this.FileContextMenuOpendCommand = new VCommand(this.FileContextMenuOpend); //this.FileContextMenuOpendCommand = new VCommand(this.FileContextMenuOpend);
//this.AddProgramTemplateCommand = new VCommand(this.AddProgramTemplate, this.CanAddProgramTemplate); //this.AddProgramTemplateCommand = new VCommand(this.AddProgramTemplate, this.CanAddProgramTemplate);
// this.CopyFilePathCommand = new VCommand(this.CopyFilePath, this.CanCopyFilePath); // this.CopyFilePathCommand = new VCommand(this.CopyFilePath, this.CanCopyFilePath);
} }
...@@ -129,7 +130,12 @@ namespace VIZ.Package.Module ...@@ -129,7 +130,12 @@ namespace VIZ.Package.Module
public MHResourceFileModel SelectedFileModel public MHResourceFileModel SelectedFileModel
{ {
get { return selectedFileModel; } get { return selectedFileModel; }
set { selectedFileModel = value; this.RaisePropertyChanged(nameof(SelectedFileModel)); } set
{
selectedFileModel = value;
this.RaisePropertyChanged(nameof(SelectedFileModel));
this.OnSelectedFileModelChanged?.Invoke(this, new MHResourceSelectedFileChangedEventArgs { File = value });
}
} }
#endregion #endregion
...@@ -219,6 +225,35 @@ namespace VIZ.Package.Module ...@@ -219,6 +225,35 @@ namespace VIZ.Package.Module
#endregion #endregion
/// <summary>
/// 选择文件改变时触发
/// </summary>
public event EventHandler<MHResourceSelectedFileChangedEventArgs> OnSelectedFileModelChanged;
/// <summary>
/// 文件双击时触发
/// </summary>
public event EventHandler<MHResourceFileDoubleClickEventArgs> OnFileDoubleClick;
#region FileDoubleClickCommand -- 文件双击命令
/// <summary>
/// 文件双击命令
/// </summary>
public VCommand FileDoubleClickCommand { get; set; }
/// <summary>
/// 文件双击
/// </summary>
private void FileDoubleClick()
{
this.OnFileDoubleClick?.Invoke(this, new MHResourceFileDoubleClickEventArgs { File = this.SelectedFileModel });
}
#endregion
#region RefreshFolderCommand -- 刷新文件夹命令 #region RefreshFolderCommand -- 刷新文件夹命令
/// <summary> /// <summary>
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
<Reference Include="WindowsFormsIntegration" /> <Reference Include="WindowsFormsIntegration" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ControlObject\FieldEdit\Edit\ResourceEdit\MHResourceEditPartModel.cs" />
<Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" /> <Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" /> <Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
<Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" /> <Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" />
...@@ -102,6 +103,8 @@ ...@@ -102,6 +103,8 @@
<DependentUpon>MainStatusView.xaml</DependentUpon> <DependentUpon>MainStatusView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Plugin\Service\IPluginService.cs" /> <Compile Include="Plugin\Service\IPluginService.cs" />
<Compile Include="Resource\MediaResource\Core\MHResourceFileDoubleClickEventArgs.cs" />
<Compile Include="Resource\MediaResource\Core\MHResourceSelectedFileChangedEventArgs.cs" />
<Compile Include="Setting\Conn\View\ConnSettingView.xaml.cs"> <Compile Include="Setting\Conn\View\ConnSettingView.xaml.cs">
<DependentUpon>ConnSettingView.xaml</DependentUpon> <DependentUpon>ConnSettingView.xaml</DependentUpon>
</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