/// <summary> /// Handles the Click event of the tsSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void tsSave_Click(object sender, EventArgs e) { if (!this.EnableSaveDocument) { return; } // biriwork - isdirty torlese // Fire save event if we have a subscription RTFEditorEventArgs ea = new RTFEditorEventArgs(); ea.Cancel = false; if (OnDocumentSave != null) { OnDocumentSave(this, ea); } if (!ea.Cancel) { // Save file from RTF editor SaveFileDialog sfd = new SaveFileDialog(); if (sfd.ShowDialog() == DialogResult.OK) { if (!String.IsNullOrEmpty(sfd.FileName)) { this.rtb.SaveFile(sfd.FileName); } } } }
/// <summary> /// Handles the Click event of the tsOpen control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void tsOpen_Click(object sender, EventArgs e) { if (!this.EnableOpenDocument) { return; } // biriwork - isDirty vizsgalat // Fire open event if we have a subscription RTFEditorEventArgs ea = new RTFEditorEventArgs(); ea.Cancel = false; if (OnDocumentOpen != null) { OnDocumentOpen(this, ea); } if (!ea.Cancel) { // Open file and send it to the RTF editor OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { if (!String.IsNullOrEmpty(ofd.FileName)) { try { this.rtb.LoadFile(ofd.FileName); } catch (Exception ex) { try { this.rtb.LoadFile(ofd.FileName, RichTextBoxStreamType.PlainText); } catch (Exception exc) { } } } } } }