Esempio n. 1
0
        public void Execute(object parameter)
        {
            //Delete current selected file
            viewModel.DeleteFile().Wait();

            //Set everything to empty
            viewModel.SelectedFile = new TextFileModel("", "", "");

            viewModel.canEdit = false;
            viewModel.canSave = false;

            viewModel.changesMade();
            viewModel.PerformFiltering();
            viewModel.CreateCollection();
        }
Esempio n. 2
0
        public void Execute(object parameter)
        {
            //Make it so you can save the file and you can no longer edit the file
            viewModel.SelectedFile = new TextFileModel("", "", "");

            //Make it so you can edit the text box
            myTextBox.IsReadOnly = false;
            viewModel.canDelete  = false;
            viewModel.canSave    = true;
            viewModel.canEdit    = false;
            viewModel.isNew      = true;

            viewModel.changesMade();
            viewModel.PerformFiltering();
            viewModel.CreateCollection();
        }
Esempio n. 3
0
        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 = "";
        }
Esempio n. 4
0
        public async void Execute(object parameter)
        {
            DeleteDialog deleteDialog = new DeleteDialog();
            await deleteDialog.ShowAsync();

            if (deleteDialog.canDelete == true)
            {
                //Delete current selected file
                //viewModel.DeleteFile();
                DataRepo.DeleteData(viewModel.SelectedFile.NoteID);


                //Set everything to empty
                viewModel.SelectedFile = new TextFileModel("", "", "");

                viewModel.canEdit = false;
                viewModel.canSave = false;

                viewModel.changesMade();
                viewModel.PerformFiltering();
                viewModel.CreateCollection();
            }
        }