aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs
diff options
context:
space:
mode:
authorAlex-TIMEHACK <[email protected]>2017-08-18 20:41:45 +0100
committerAlex-TIMEHACK <[email protected]>2017-08-18 20:41:45 +0100
commit943b4dcb5fa597264f13f2d0cfa305f4dd542dbe (patch)
tree3da3edb5249c5e338724859740838a7b4de7c652 /TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs
parentbd3612eadf3181856d5033d3e47b97357d88c345 (diff)
downloadhistacom2-943b4dcb5fa597264f13f2d0cfa305f4dd542dbe.tar.gz
histacom2-943b4dcb5fa597264f13f2d0cfa305f4dd542dbe.tar.bz2
histacom2-943b4dcb5fa597264f13f2d0cfa305f4dd542dbe.zip
Wordpad Save, Open and Save As
Diffstat (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs')
-rw-r--r--TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs64
1 files changed, 64 insertions, 0 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs
index 7d7956a..f8a927e 100644
--- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs
+++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWordPad.cs
@@ -9,6 +9,8 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Text;
using TimeHACK.Engine;
+using static TimeHACK.Engine.FileDialogBoxManager;
+using System.IO;
namespace TimeHACK.OS.Win95.Win95Apps
{
@@ -20,6 +22,8 @@ namespace TimeHACK.OS.Win95.Win95Apps
bool doItalic = false;
bool doUnderline = false;
+ string CurrentFilePath = "";
+
public WinClassicWordPad()
{
InitializeComponent();
@@ -169,5 +173,65 @@ namespace TimeHACK.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);
+ } 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); }
+ }
}
} \ No newline at end of file