Ejemplo n.º 1
0
        public static string Show(string lable, string title)
        {
            InputBoxView  view   = new InputBoxView();
            ContentWindow window = ContentWindow.Create(view, 400, 150, false, false, false);

            window.Title             = title;
            view.HeaderText.Text     = lable;
            view.OKButton.Click     += delegate { window.DialogResult = true; window.Close(); };
            view.CancelButton.Click += delegate { window.DialogResult = false; };
            window.ShowDialog();
            if (window.DialogResult.HasValue && window.DialogResult.Value)
            {
                return(view.ContentTextBox.Text);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        private void ToggelUnlockButton_Click(object sender, RoutedEventArgs e)
        {
            EqualityCompareProblemViewModel p = DataContext as EqualityCompareProblemViewModel;

            if (p == null || !p.ToggelUnlockCommand.CanExecute(null))
            {
                return;
            }
            if (p.IsLocked)
            {
                p.Password = InputBoxView.Show("Enter the password", "Unlock Problem");
                if (p.Password != null)
                {
                    p.ToggelUnlockCommand.Execute(null);
                }
            }
            else
            {
                p.ToggelUnlockCommand.Execute(null);
            }
        }