FModel/FModel/ViewModels/Commands/TabCommand.cs
4sval af2fceb9e5 removed any kind of popup asking for a directory
it was more annoying than useful now that you can just click to open the file location
2023-02-07 21:14:00 +01:00

77 lines
3.2 KiB
C#

using System.Windows;
using AdonisUI.Controls;
using FModel.Framework;
using FModel.Services;
using FModel.Views.Resources.Controls;
namespace FModel.ViewModels.Commands;
public class TabCommand : ViewModelCommand<TabItem>
{
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
public TabCommand(TabItem contextViewModel) : base(contextViewModel)
{
}
public override async void Execute(TabItem contextViewModel, object parameter)
{
switch (parameter)
{
case TabItem mdlClick:
_applicationView.CUE4Parse.TabControl.RemoveTab(mdlClick);
break;
case "Close_Tab":
_applicationView.CUE4Parse.TabControl.RemoveTab(contextViewModel);
break;
case "Close_All_Tabs":
_applicationView.CUE4Parse.TabControl.RemoveAllTabs();
break;
case "Close_Other_Tabs":
_applicationView.CUE4Parse.TabControl.RemoveOtherTabs(contextViewModel);
break;
case "Asset_Export_Data":
await _threadWorkerView.Begin(_ => _applicationView.CUE4Parse.ExportData(contextViewModel.FullPath));
break;
case "Asset_Save_Properties":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.FullPath, false, EBulkType.Properties | EBulkType.Auto);
});
break;
case "Asset_Save_Textures":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.FullPath, false, EBulkType.Textures | EBulkType.Auto);
});
break;
case "Asset_Save_Models":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.FullPath, false, EBulkType.Meshes | EBulkType.Auto);
});
break;
case "Asset_Save_Animations":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.FullPath, false, EBulkType.Animations | EBulkType.Auto);
});
break;
case "Open_Properties":
if (contextViewModel.Header == "New Tab" || contextViewModel.Document == null) return;
Helper.OpenWindow<AdonisWindow>(contextViewModel.Header + " (Properties)", () =>
{
new PropertiesPopout(contextViewModel)
{
Title = contextViewModel.Header + " (Properties)"
}.Show();
});
break;
case "Copy_Asset_Path":
Clipboard.SetText(contextViewModel.FullPath);
break;
}
}
}