Beispiel #1
0
        private void NoteManager_NoteClosed(object sender, NoteEventArgs e)
        {
            var control = lvNotes.Items.Cast <Control>().FirstOrDefault(c => c.Tag == e.NoteWindow);

            if (control != null)
            {
                lvNotes.Items.Remove(control);
            }
        }
Beispiel #2
0
        private void NoteManager_NoteTextChanged(object sender, NoteEventArgs e)
        {
            var control = lvNotes.Items.Cast <Control>().FirstOrDefault(c => c.Tag == e.NoteWindow);

            if (control != null && control is Button btn)
            {
                btn.Content = e.NoteWindow.NoteText;
            }
        }
Beispiel #3
0
        private void NoteManager_NewNote(object sender, NoteEventArgs e)
        {
            Button btn = new Button();

            btn.Width   = 300;
            btn.Content = e.NoteWindow.NoteText;
            btn.Click  += (s, ce) => {
                e.NoteWindow.Show();
                e.NoteWindow.Activate();
            };
            btn.MouseDown += (s, ce) => {
                if (ce.ChangedButton == MouseButton.Middle && ce.ButtonState == MouseButtonState.Pressed)
                {
                    NoteManager.Remove(e.NoteWindow);
                    e.NoteWindow.Close();
                }
            };
            btn.Tag = e.NoteWindow;
            int index = lvNotes.Items.Add(btn);
        }
Beispiel #4
0
 protected virtual void OnNoteTextChanged(NoteEventArgs e)
 {
     NoteTextChanged?.Invoke(this, e);
 }
Beispiel #5
0
 protected virtual void OnNoteClosed(NoteEventArgs e)
 {
     NoteClosed?.Invoke(this, e);
 }
Beispiel #6
0
 protected virtual void OnNewNote(NoteEventArgs e)
 {
     NewNote?.Invoke(this, e);
 }