using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using System.Windows; using JD.Localization.Core.Model; using JD.LocalizationExport.Service.API; using JD.LocalizationExport.Service.Implementation; using JD.LocalizationExport.Service.Model.Options; using JD.Oasis.Module; using JD.Oasis.Service.Implementation; using JD.Rosetta.Module; using Plume.Application.WPF; using Plume.Interfaces.Services; using Plume.Interfaces.WPF.Modules; using Plume.Output; using Plume.Perforce.Service.Implementation; using System.Configuration; namespace Rosetta { /// /// Interaction logic for App.xaml /// public partial class App : WpfApplication { public override bool HasDocumentWorkspace => false; public override Size InitialWindowSize => new Size(1440, 900); public App() { Documentation = new Uri("https://mdc-web-tomcat17.ubisoft.org/confluence/x/d_TpJw"); } protected override void OnStartup(StartupEventArgs e) { // Setting working directory to the application directory before anything else string applicationPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); Directory.SetCurrentDirectory(applicationPath); base.OnStartup(e); } protected override void OnApplicationReady() { base.OnApplicationReady(); RosettaModule rosettaModule = ModuleManager.Get(); rosettaModule.LocalizationExportLaunched += OnLocalizationExportLaunched; } protected override void Dispose(bool disposing) { if (disposing) { RosettaModule rosettaModule = ModuleManager.Get(); rosettaModule.LocalizationExportLaunched -= OnLocalizationExportLaunched; } } protected override IEnumerable SetupModules() { yield return new WpfModuleInfo(new OutputModule()); // Setupping it first to get logging on the other modules right from the start yield return new WpfModuleInfo(new RosettaModule(), new RosettaModuleSetup { PerforceDataHost = ConfigurationManager.AppSettings["PerforceDataHost"], PerforceCodeHost = ConfigurationManager.AppSettings["PerforceCodeHost"] }); yield return new WpfModuleInfo(new OasisModule(), new OasisModuleSetup { PerforceDataHost = ConfigurationManager.AppSettings["PerforceDataHost"], PerforceCodeHost = ConfigurationManager.AppSettings["PerforceCodeHost"] }); } protected override IEnumerable SetupServices() { yield return new OasisService(); yield return new PerforceService(); yield return new LocalizationExportService(); } protected override void OnToolbarInitialization() { } private async Task OnLocalizationExportLaunched(IDictionary exportTypesAndOptionsToExecute, IEnumerable languagesToExport) { OasisModule oasisModule = ModuleManager.Get(); if (oasisModule != null) { await oasisModule.OnLocalizationExportLaunched(exportTypesAndOptionsToExecute, languagesToExport); } } } }