Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        private void BtnNote_Click(object sender, RoutedEventArgs e)
        {
            var nw = new NoteWindow();

            nw.Owner = this;
            nw.Show();
        }
Exemplo n.º 3
0
 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);
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        public override void Execute()
        {
            var noteWindow = new NoteWindow(this);

            noteWindow.Show();
        }