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);
        }
示例#2
0
        private static void OnOpenNoteWindow(object parameter)
        {
            var win = new NoteWindow
            {
                Owner         = MainWindow.Current,
                ShowInTaskbar = false
            };
            var vm = new NoteViewModel
            {
                CloseWindow = () =>
                {
                    if (win.IsActive)
                    {
                        win.Close();
                    }
                }
            };

            win.DataContext = vm;
            win.ShowDialog();
        }