JD2022-TU1/main/tools/apps/SongEditor/App.xaml.cs

92 lines
3.1 KiB
C#

using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using JD.CrashReporter;
using JD.Shotgun.Service;
using JD.Shotgun.Service.ShotgunEntities;
using JD.Shotgun.WPF;
using JD.Shotgun.WPF.Views;
using JD.TplEditor;
using Plume.Application.WPF;
using Plume.Bloomberg;
using Plume.Icons;
using Plume.ImageViewer;
using Plume.Interfaces.Services;
using Plume.Interfaces.WPF.Actions;
using Plume.Interfaces.WPF.Modules;
using Plume.Interfaces.WPF.Window;
using Plume.Perforce;
using Plume.Perforce.Service.Implementation;
using Plume.TextEditor;
using Plume.WPF.Commands;
using SongEditor.Actions;
using SongEditor.View;
namespace SongEditor
{
/// <inheritdoc />
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : WpfApplication
{
public App()
{
}
public new static App Current => Application.Current as App;
/// <inheritdoc />
protected override IEnumerable<WpfModuleInfo> SetupModules()
{
//JiraConfiguration
yield return new WpfModuleInfo(new TextEditorModule());
yield return new WpfModuleInfo(new ImageViewerModule());
yield return new WpfModuleInfo(new PerforceModule(), new PerforceModuleSetup { DefaultPerforceHost = "p4-jd-data-mrc.ubisoft.org:1808" });
yield return new WpfModuleInfo(new ToolCrashReporterModule());
yield return new WpfModuleInfo(new TplEditorModule());
yield return new WpfModuleInfo(new ShotgunModule());
}
/// <inheritdoc />
protected override IEnumerable<IService> SetupServices()
{
yield return new PerforceService();
yield return new BloombergService();
var shotgunService = new ShotgunService();
yield return shotgunService;
}
/// <inheritdoc />
protected override void OnApplicationReady()
{
base.OnApplicationReady();
InitActions();
InitWindows();
}
private void InitWindows()
{
var window = WindowManager.AddToolWindow("MapToolWindow", "Map info", StandardIcon.Info, new MapToolWindow(DocumentManager), DockingSide.Right, new DoubleKeyGesture(ModifierKeys.Control, Key.V, Key.M));
window.ContainerMinSize = new Size(320, 320);
var shotgunService = ServiceManager.Get<IShotgunService>();
var assetExplorerView = new ShotgunMapExplorerView(shotgunService, SettingsManager, GetActionsFunc);
assetExplorerView.MapSelected += (sender, map) => SelectedMapEntity = map;
WindowManager.AddToolWindow("MapExplorerWindow", "Map Explorer", StandardIcon.OpenFolder, assetExplorerView, DockingSide.Left, new DoubleKeyGesture(ModifierKeys.Control, Key.V, Key.M));
}
private void InitActions()
{
ActionManager.Register<OpenSongDescAction>();
}
private IEnumerable<Action> GetActionsFunc(ShotgunMap mapEntity)
{
yield return ActionManager.Get<OpenSongDescAction>();
}
public ShotgunMap SelectedMapEntity { get; set; }
}
}