mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
Some checks failed
FModel QA Builder / build (push) Has been cancelled
+ filter by types, find by references (UE5+), and a lot of other improvements Co-authored-by: Asval <asval.contactme@gmail.com> Co-authored-by: LongerWarrior <LongerWarrior@gmail.com>
86 lines
3.4 KiB
C#
86 lines
3.4 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 tabViewModel, object parameter)
|
|
{
|
|
switch (parameter)
|
|
{
|
|
case TabItem mdlClick:
|
|
_applicationView.CUE4Parse.TabControl.RemoveTab(mdlClick);
|
|
break;
|
|
case "Close_Tab":
|
|
_applicationView.CUE4Parse.TabControl.RemoveTab(tabViewModel);
|
|
break;
|
|
case "Close_All_Tabs":
|
|
_applicationView.CUE4Parse.TabControl.RemoveAllTabs();
|
|
break;
|
|
case "Close_Other_Tabs":
|
|
_applicationView.CUE4Parse.TabControl.RemoveOtherTabs(tabViewModel);
|
|
break;
|
|
case "Find_References":
|
|
_applicationView.CUE4Parse.FindReferences(tabViewModel.Entry);
|
|
break;
|
|
case "Asset_Export_Data":
|
|
await _threadWorkerView.Begin(_ => _applicationView.CUE4Parse.ExportData(tabViewModel.Entry));
|
|
break;
|
|
case "Asset_Save_Properties":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Properties);
|
|
});
|
|
break;
|
|
case "Asset_Save_Textures":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Textures);
|
|
});
|
|
break;
|
|
case "Asset_Save_Models":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Meshes);
|
|
});
|
|
break;
|
|
case "Asset_Save_Animations":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Animations);
|
|
});
|
|
break;
|
|
case "Asset_Save_Audio":
|
|
await _threadWorkerView.Begin(cancellationToken =>
|
|
{
|
|
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Audio);
|
|
});
|
|
break;
|
|
case "Open_Properties":
|
|
if (tabViewModel.Header == "New Tab" || tabViewModel.Document == null) return;
|
|
Helper.OpenWindow<AdonisWindow>(tabViewModel.Header + " (Properties)", () =>
|
|
{
|
|
new PropertiesPopout(tabViewModel)
|
|
{
|
|
Title = tabViewModel.Header + " (Properties)"
|
|
}.Show();
|
|
});
|
|
break;
|
|
case "Copy_Asset_Path":
|
|
Clipboard.SetText(tabViewModel.Entry.Path);
|
|
break;
|
|
}
|
|
}
|
|
}
|