private void ShowNote(object sender, MouseButtonEventArgs e) { var listBox = sender as ListBox; if (!(listBox?.SelectedItem is Note noteModel)) { return; } foreach (var window in Application.Current.Windows) { if (!(window is NoteWindow noteWindow) || noteWindow.Id != noteModel.Id) { continue; } noteWindow.Focus(); return; } var note = new NoteWindow(_controller, noteModel.Id); note.ShowNoteList.Click += ShowNoteList; note.DeleteNote.Click += DeleteNote; note.AddNote.Click += AddNote; note.Show(); listBox.UnselectAll(); }
private void BtnNote_Click(object sender, RoutedEventArgs e) { var nw = new NoteWindow(); nw.Owner = this; nw.Show(); }
private void txtNoteGHeader_Click(object sender, EventArgs e) { if (noteWindow == null) { noteWindow = new NoteWindow(note); noteWindow.FormClosed += new FormClosedEventHandler(noteWindow_FormClosed); noteWindow.Show(this); } else { noteWindow.Activate(); } }
public void ParameterizedConstructorTest() { NoteWindow noteWindow = new NoteWindow("test"); bool eventCalled = false; string eventArg = null; noteWindow.Check += (s) => { eventCalled = true; eventArg = s; }; noteWindow.Show(); noteWindow.Close(); Assert.IsTrue(eventCalled); Assert.AreEqual("test", eventArg); }
private async void AddNote(object sender, RoutedEventArgs e) { var id = Guid.NewGuid().ToString("N"); await _controller.AddNote(new Note { Id = id, Color = new SolidColorBrush(Colors.OrangeRed), Edited = DateTime.Now }); var note = new NoteWindow(_controller, id); note.ShowNoteList.Click += ShowNoteList; note.DeleteNote.Click += DeleteNote; note.AddNote.Click += AddNote; note.Show(); ShowNoteList(); }
public override void Execute() { var noteWindow = new NoteWindow(this); noteWindow.Show(); }