diff options
| author | AShifter <loganr.lowe@gmail.com> | 2017-08-29 12:34:00 -0600 |
|---|---|---|
| committer | AShifter <loganr.lowe@gmail.com> | 2017-08-29 12:34:00 -0600 |
| commit | b1689dea36e46933280bfcc0d186746dd6210c0f (patch) | |
| tree | 3644ac63218378082e0afa90d4c42d73d6d3980c /Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs | |
| parent | f8e657ddbaf3654f102676a0b51e424c005218c3 (diff) | |
| parent | d4d94f85a6424e4d21cecccec21b0e78860431d6 (diff) | |
| download | histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.tar.gz histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.tar.bz2 histacom2-b1689dea36e46933280bfcc0d186746dd6210c0f.zip | |
Merge remote-tracking branch 'refs/remotes/Histacom2-Devs/master'
Diffstat (limited to 'Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs')
| -rw-r--r-- | Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs index f1f5245..91d9368 100644 --- a/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs +++ b/Histacom2/OS/Win95/Win95Apps/WinClassicWordPad.cs @@ -8,6 +8,8 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Drawing.Text; +using static Histacom2.Engine.FileDialogBoxManager; +using System.IO; using Histacom2.Engine; namespace Histacom2.OS.Win95.Win95Apps @@ -20,6 +22,8 @@ namespace Histacom2.OS.Win95.Win95Apps bool doItalic = false; bool doUnderline = false; + public string CurrentFilePath = ""; + public WinClassicWordPad() { InitializeComponent(); @@ -169,5 +173,111 @@ namespace Histacom2.OS.Win95.Win95Apps if (doUnderline) Underline = FontStyle.Underline; mainText.SelectionFont = new Font(mainText.SelectionFont.FontFamily, mainText.SelectionFont.Size, Bold | Italic | Underline); } + + private void openToolStripMenuItem1_Click(object sender, EventArgs e) + { + try + { + ActivateOpenFileDialog(".rtf"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + + if (selectedPath != null) + { + 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); + } + + } + } + catch + { + } + } + + private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveAs(); + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (CurrentFilePath == "") + { + // We aren't in a file right now + + SaveAs(); + } + else + { + File.Delete(CurrentFilePath); + SaveRtfDocument(mainText, CurrentFilePath); + } + } + + void SaveAs() + { + try + { + ActivateSaveFileDialog(".rtf"); + string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); + + if (selectedPath != "") + { + SaveRtfDocument(mainText, selectedPath); + CurrentFilePath = selectedPath; + } + } + 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 |
