/// <summary> /// Deletes this note, fading the note out if fade is true. /// </summary> public void Delete(bool fade) { if (fade && this.Opacity == 1.0) { // When we fade out, Windows only shows the background of the form, not // the controls, so we make our background color the color of our text // box so the fade looks correct this.BackColor = textBox_.BackColor; WinUser.AnimateWindow(this.Handle, FadeTime, WinUser.AW_BLEND | WinUser.AW_HIDE); } try { note_.Delete(); } catch (Exception e) { PluginCore.Managers.ErrorManager.ShowError("Error on save", e); } note_ = null; this.Close(); }
public Preferences() : base() { this.Note = new Note(); }
/// <summary> /// Creates a NoteForm for the given Note instance. We load our settings /// from the given Note instance, and we bind ourselves to the instance, /// so as the user changes this NoteForm, we serialize the changes in the /// given Note. If fadeIn is true, we fade the note in rather than just /// showing it. /// </summary> public NoteForm(PluginMain mainForm, Note note, bool fadeIn) { mainForm_ = mainForm; note_ = note; fadeIn_ = fadeIn; InitializeComponent(); this.Icon = Stickies.Icons.Media.StickiesIcon; this.preferencesMenuItem.Text = LocaleHelper.GetString("Messages.NotePreferences"); deleteMenuItem_.Text = LocaleHelper.GetString("Messages.NoteDelete"); archiveMenuItem_.Text = LocaleHelper.GetString("Messages.NoteArchive"); boldMenuItem_.Text = LocaleHelper.GetString("Messages.NoteBold"); italicMenuItem_.Text = LocaleHelper.GetString("Messages.NoteItalic"); strikethroughMenuItem_.Text = LocaleHelper.GetString("Messages.NoteStrikethrough"); // Load the settings from the Note instance this.StartPosition = FormStartPosition.Manual; this.Location = new Point(note.Left, note.Top); this.Size = new Size(note.Width, note.Height); this.BackColor = Color.FromArgb(note.BorderColor); textBox_.BackColor = Color.FromArgb(note.BackColor); textBoxPaddingPanel_.BackColor = textBox_.BackColor; textBox_.ForeColor = Color.FromArgb(note.FontColor); textBox_.Rtf = note.Rtf; this.TopMost = note.AlwaysOnTop; this.Opacity = 1.0 - note_.Transparency; // Lock this note initially since it is not a new note Lock(); UpdateTitle(); // We are not dirty since the note just loaded dirty_ = false; }