mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
77 lines
3.1 KiB
C#
77 lines
3.1 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.Asset));
|
|
break;
|
|
case "Asset_Save_Properties":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.Asset, false, EBulkType.Properties);
|
|
});
|
|
break;
|
|
case "Asset_Save_Textures":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.Asset, false, EBulkType.Textures);
|
|
});
|
|
break;
|
|
case "Asset_Save_Models":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.Asset, false, EBulkType.Meshes);
|
|
});
|
|
break;
|
|
case "Asset_Save_Animations":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, contextViewModel.Asset, false, EBulkType.Animations);
|
|
});
|
|
break;
|
|
case "Open_Properties":
|
|
if (contextViewModel.Asset.FileName == "New Tab" || contextViewModel.Document == null) return;
|
|
Helper.OpenWindow<AdonisWindow>(contextViewModel.Asset.FileName + " (Properties)", () =>
|
|
{
|
|
new PropertiesPopout(contextViewModel)
|
|
{
|
|
Title = contextViewModel.Asset.FileName + " (Properties)"
|
|
}.Show();
|
|
});
|
|
break;
|
|
case "Copy_Asset_Path":
|
|
Clipboard.SetText(contextViewModel.Asset.FullPath);
|
|
break;
|
|
}
|
|
}
|
|
}
|