public async void Save() //Sauvegarde les données entrées dans un fichier { if (store.Folder == null) //pas de dossier sélectionné { await new MessageDialog("Veuillez sélectionner un emplacement.").ShowAsync(); return; } Matchimpro match = new Matchimpro(nomeq1.Text.Trim(), nomeq2.Text.Trim(), numberofround.SelectedIndex + 1); match.Save(store.Folder); MainPage mainFrame = (MainPage)((Frame)Window.Current.Content).Content; if (mainFrame.navigationView.MenuItems.Count == 5) { mainFrame.navigationView.MenuItems[0] = new NavigationViewItem { Name = "CURRENT", IsSelected = true, Content = "Match en cours", Icon = new SymbolIcon((Symbol)0xE945), Tag = "currentNav" }; } MainPage.MainPageFrame?.Navigate(typeof(CurrentMatchPage), match); //renvoie à la page de match }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is Matchimpro) { var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); Matchimpro match = (Matchimpro)e.Parameter; match.Save(store.Folder); contentFrame.Navigate(typeof(CurrentMatchPage), match); ToastNotifier ToastNotifier = ToastNotificationManager.CreateToastNotifier(); XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); XmlNodeList toastNodeList = toastXml.GetElementsByTagName("text"); toastNodeList.Item(0).AppendChild(toastXml.CreateTextNode(resourceLoader.GetString("ImportTitle"))); toastNodeList.Item(1).AppendChild(toastXml.CreateTextNode(resourceLoader.GetString("ImportMessage"))); ToastNotification toast = new ToastNotification(toastXml); toast.ExpirationTime = DateTime.Now.AddSeconds(1); ToastNotifier.Show(toast); } else if (e.Parameter is "catei") { contentFrame.Navigate(typeof(ImportCatei)); } }