private void editButton_Click(object sender, RoutedEventArgs e) { var editWindow = new WordStorageEditWindow(WordStorageManager.GetInstance().GetStorageState(false).GetData()); editWindow.ShowDialog(); WordStorageManager.GetInstance().OverwriteStorageState(new WordStoreMemento(editWindow.EditedStore)); }
private void saveButton_Click(object sender, RoutedEventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "State File|*.json"; if (sfd.ShowDialog() == true) { //SaveF.Instance.Save(new NPath(System.IO.Path.GetDirectoryName(sfd.FileName)), System.IO.Path.GetFileName(sfd.FileName), false); SaveLoadManager.SaveToDisk(new NPath(System.IO.Path.GetFullPath(sfd.FileName)), UserManager.GetInstance().GetUserState(true), WordStorageManager.GetInstance().GetStorageState(true)); } }
private void testButton_Click(object sender, RoutedEventArgs e) { var wordStoreMemento = WordStorageManager.GetInstance().GetStorageState(true); if (wordStoreMemento.GetData().mWordCollections.Count == 0) { MessageBox.Show("You don't have any added word collections.\nPlease add some.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); return; } TestSelectCollectionWindow selectCollectionWindow = new TestSelectCollectionWindow(wordStoreMemento.GetData()); selectCollectionWindow.ShowDialog(); UpdateStats(); }
private void loadButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "State File|*.json"; if (ofd.ShowDialog() == true) { UserStateMemento userStateMemento; WordStoreMemento wordStoreMemento; SaveLoadManager.LoadFromDisk(new NPath(System.IO.Path.GetFullPath(ofd.FileName)), out userStateMemento, out wordStoreMemento); UserManager.GetInstance().OverwriteUserState(userStateMemento); WordStorageManager.GetInstance().OverwriteStorageState(wordStoreMemento); UpdateStats(); } }