Exemple #1
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (SaveFileToolStripMenuItem.Enabled)
     {
         DialogResult messageResult = MessageBox.Show("File not save! Save?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         if (messageResult == DialogResult.OK)
         {
             SaveFileEvent?.Invoke(this, EventArgs.Empty);
         }
     }
 }
Exemple #2
0
 private void SaveAll_ToolStripButton_Click(object sender, EventArgs e)
 {
     for (var i = 0; i < tabControlCode.TabCount; i++)
     {
         foreach (FastColoredTextBox item in tabControlCode.TabPages[i].Controls)
         {
             if (!(item is FastColoredTextBox))
             {
                 continue;
             }
             _proj.CsFile[i].Text = item.Text;
             SaveFileEvent?.Invoke(this, new ProjectEventArgs {
                 Cs = _proj.CsFile[i]
             });
         }
     }
 }
        /// <summary>
        /// Receive the selected file from the server
        /// </summary>
        private void ReciveFile()
        {
            try
            {
                Array.Clear(received, 0, received.Length);
                Array.Clear(toSend, 0, toSend.Length);

                stream.Read(received, 0, received.Length);

                SaveFileEvent?.Invoke(this, new SaveFileEventArgs(TrimEnd(received)));
            }
            catch (System.IO.IOException)
            {
                Console.Write("IO excp");
            }
            catch { }
        }
Exemple #4
0
 private void toolStripButtonAllSave_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < tabControlCode.TabCount; i++)
     {
         foreach (FastColoredTextBox item in tabControlCode.TabPages[i].Controls)
         {
             if (item is FastColoredTextBox)
             {
                 this.project.csfile[i].Text = item.Text;
                 SaveFileEvent?.Invoke(this, new CSEventArgs()
                 {
                     cS = this.project.csfile[i]
                 });
             }
         }
     }
 }
Exemple #5
0
 private void SaveFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(FilePath))
     {
         SaveFileDialog SetFile = new SaveFileDialog()
         {
             Filter = "Text Files|*.txt|All Files|*.*"
         };
         if (SetFile.ShowDialog() == DialogResult.OK)
         {
             FilePath = SetFile.FileName;
             Text     = "Simple Text Editor [" + FilePath + "]";
         }
         else
         {
             return;
         }
     }
     SaveFileToolStripMenuItem.Enabled = false;
     SaveFileEvent?.Invoke(this, EventArgs.Empty);
 }