/// <summary> /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée /// seront utilisés par exemple au moment du lancement de l'application pour l'ouverture d'un fichier spécifique. /// </summary> /// <param name="e">Détails concernant la requête et le processus de lancement.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { var rootFrame = Window.Current.Content as Frame; //Serris Modules Server ! GlobalVariables.GlobalizationRessources = new ResourceLoader(); SMSInitialize.InitializeSMSJson(); GlobalVariables.CurrentTheme = await new ThemeReader(ModulesAccessManager.GetCurrentThemeID()).GetThemeBrushesContent(); Messenger.Default.Register <SMSNotification>(this, async(notification) => { try { switch (notification.Type) { case TypeUpdateModule.CurrentThemeUpdated: GlobalVariables.CurrentTheme = await new ThemeReader(notification.ID).GetThemeBrushesContent(); Messenger.Default.Send(new EditorViewNotification { ID = 0, type = EditorViewNotificationType.UpdateUI }); break; } } catch { } }); Messenger.Default.Register <TempContentNotification>(this, (notification) => { try { switch (notification.type) { case TempContentType.currentIDs when !notification.answerNotification: Messenger.Default.Send(new TempContentNotification { answerNotification = true, type = TempContentType.currentIDs, content = GlobalVariables.CurrentIDs }); break; case TempContentType.currentDevice when !notification.answerNotification: Messenger.Default.Send(new TempContentNotification { answerNotification = true, type = TempContentType.currentDevice, content = GlobalVariables.CurrentDevice }); break; case TempContentType.currentTheme when !notification.answerNotification: Messenger.Default.Send(new TempContentNotification { answerNotification = true, type = TempContentType.currentTheme, content = GlobalVariables.CurrentTheme }); break; } } catch { } }); // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu, // assurez-vous juste que la fenêtre est active if (rootFrame == null) { // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: chargez l'état de l'application précédemment suspendue } // Placez le frame dans la fenêtre active Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // Quand la pile de navigation n'est pas restaurée, accédez à la première page, // puis configurez la nouvelle page en transmettant les informations requises en tant que // paramètre rootFrame.Navigate(typeof(EditorView), e.Arguments); } // Vérifiez que la fenêtre actuelle est active Window.Current.Activate(); } }
protected override async void OnFileActivated(FileActivatedEventArgs args) { var rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { GlobalVariables.GlobalizationRessources = new ResourceLoader(); SMSInitialize.InitializeSMSJson(); GlobalVariables.CurrentTheme = await new ThemeReader(ModulesAccessManager.GetCurrentThemeID()).GetThemeBrushesContent(); Messenger.Default.Register <SMSNotification>(this, async(notification) => { try { switch (notification.Type) { case TypeUpdateModule.CurrentThemeUpdated: GlobalVariables.CurrentTheme = await new ThemeReader(notification.ID).GetThemeBrushesContent(); Messenger.Default.Send(new EditorViewNotification { ID = 0, type = EditorViewNotificationType.UpdateUI }); break; } } catch { } }); Messenger.Default.Register <TempContentNotification>(this, (notification) => { try { switch (notification.type) { case TempContentType.currentIDs when !notification.answerNotification: Messenger.Default.Send(new TempContentNotification { answerNotification = true, type = TempContentType.currentIDs, content = GlobalVariables.CurrentIDs }); break; case TempContentType.currentDevice when !notification.answerNotification: Messenger.Default.Send(new TempContentNotification { answerNotification = true, type = TempContentType.currentDevice, content = GlobalVariables.CurrentDevice }); break; case TempContentType.currentTheme when !notification.answerNotification: Messenger.Default.Send(new TempContentNotification { answerNotification = true, type = TempContentType.currentTheme, content = GlobalVariables.CurrentTheme }); break; } } catch { } }); rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Window.Current.Content = rootFrame; if (rootFrame.Content == null) { rootFrame.Navigate(typeof(EditorView), args); } Window.Current.Activate(); } else { await TabsCreatorAssistant.OpenFilesAlreadyOpenedAndCreateNewTabsFiles(GlobalVariables.CurrentIDs.ID_TabsList, args.Files); } }
private async void LoadModules() { ListModules.Items.Clear(); int IDThemeMonaco = ModulesAccessManager.GetCurrentThemeMonacoID(), IDTheme = ModulesAccessManager.GetCurrentThemeID(); switch (currentSelectedButton) { default: ListModules.SelectionMode = ListViewSelectionMode.Single; break; case 2: case 3: ListModules.SelectionMode = ListViewSelectionMode.None; break; } foreach (InfosModule module in ModulesAccessManager.GetModules(true)) { ModuleInfosShow ModuleInfos = new ModuleInfosShow { Module = module, StrokeThickness = 0 }; ModuleInfos.Thumbnail = await ModulesAccessManager.GetModuleDefaultLogoViaIDAsync(ModuleInfos.Module.ID, ModuleInfos.Module.ModuleSystem); switch (module.ModuleType) { case ModuleTypesList.Templates when currentSelectedButton == 3: case ModuleTypesList.ProgrammingLanguage when currentSelectedButton == 2: case ModuleTypesList.Addon when currentSelectedButton == 0: ListModules.Items.Add(ModuleInfos); break; case ModuleTypesList.Theme when currentSelectedButton == 1: if (IDTheme == ModuleInfos.Module.ID || IDThemeMonaco == ModuleInfos.Module.ID) { ModuleInfos.StrokeThickness = 2; } ListModules.Items.Add(ModuleInfos); break; } } }