From a751c8fcac0aab40de9cf0539fff65791da51f34 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sun, 27 Aug 2017 15:48:28 +0100 Subject: Fixed up a few things --- Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs') diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs index 77d307b..05b5ec1 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs @@ -186,6 +186,7 @@ namespace Histacom2.OS.Win95.Win95Apps try { mainText.LoadFile(selectedPath); + CurrentFilePath = selectedPath; } catch { (new WindowManager()).StartInfobox95("Wordpad", "An error occured opening the file.", Engine.Template.InfoboxType.Error, Engine.Template.InfoboxButtons.OK); @@ -233,5 +234,50 @@ namespace Histacom2.OS.Win95.Win95Apps } catch (Exception ex) { MessageBox.Show(ex.Message); } } + + private void btnNew_Click(object sender, EventArgs e) + { + + } + + private void btnOpen_Click(object sender, EventArgs e) + { + try + { + ActivateOpenFileDialog(".rtf"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + + if (selectedPath != null) + { + try + { + mainText.LoadFile(selectedPath); + } + catch + { + (new WindowManager()).StartInfobox95("Wordpad", "An error occured opening the file.", Engine.Template.InfoboxType.Error, Engine.Template.InfoboxButtons.OK); + } + + } + } + catch + { + } + } + + private void btnSave_Click(object sender, EventArgs e) + { + if (CurrentFilePath == "") + { + // We aren't in a file right now + + SaveAs(); + } + else + { + File.Delete(CurrentFilePath); + SaveRtfDocument(mainText, CurrentFilePath); + } + } } } \ No newline at end of file -- cgit v1.2.3