public async void Execute(object parameter) { //Text block text string txt = myTextBox.Text; //If the text is new if (viewModel.isNew) { //Open a save dialog box SaveDialog saveDialog = new SaveDialog(viewModel); await saveDialog.ShowAsync(); //If the result isn't empty then create a new file if (!saveDialog.Exited) { //viewModel.CreateNewFile(saveDialog.Result, txt); DataRepo.AddData(txt, saveDialog.Result); } } else { //Write to an existing file and save the new content //viewModel.WriteToFile(txt); DataRepo.UpdateData(viewModel.SelectedFile.NoteID, txt); } //Remake the collection of files and perform filtering viewModel.CreateCollection(); viewModel.PerformFiltering(); //Set properties viewModel.canEdit = false; viewModel.canDelete = false; viewModel.canSave = false; myTextBox.IsReadOnly = true; //Invoke changes viewModel.changesMade(); //Set text box to blank myTextBox.Text = ""; }