Exemplo n.º 1
0
        private void Editor_Load(object sender, EventArgs e)
        {
            //Settings for toolStripStatusLabel
            toolStripStatusLabel1.BorderSides = (((ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Top)
                                                  | ToolStripStatusLabelBorderSides.Right)
                                                 | ToolStripStatusLabelBorderSides.Bottom);
            toolStripStatusLabel1.BorderStyle = Border3DStyle.Sunken;
            toolStripStatusLabel1.Text        = "";
            toolStripStatusLabel1.TextAlign   = ContentAlignment.MiddleLeft;
            toolStripStatusLabel2.BorderSides = (((ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Top)
                                                  | ToolStripStatusLabelBorderSides.Right)
                                                 | ToolStripStatusLabelBorderSides.Bottom);
            toolStripStatusLabel2.BorderStyle = Border3DStyle.Sunken;
            toolStripStatusLabel2.Text        = DateTime.Today.ToLongDateString();
            toolStripStatusLabel2.TextAlign   = ContentAlignment.MiddleRight;

            //Create an new SupportMethods object
            var support = new SupportMethods(this);

            //Check for settings.xml in App Data folder
            if (File.Exists(_workingDirectory + _fileName))
            {
                support.LoadSettings(); //load saved settings from json
            }
            Text = @"RTFEditor - New Document";
            Update();
        }
Exemplo n.º 2
0
        private void Editor_FormClosing(object sender, FormClosingEventArgs e)
        {
            var support = new SupportMethods();

            if (richTextBox1.Text.Length > 1)
            {
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    richTextBox1.SaveFile(saveFileDialog1.FileName);
                    //Save settings to settings.txt before exit
                    support.SaveSettings();
                }
                else
                {
                    //Save settings to settings.txt before exit
                    support.SaveSettings();
                }
            }
            else
            {
                //Save settings to settings.txt before exit
                support.SaveSettings();
            }
        }