Exemple #1
0
        public static bool ShowDialog(NewWindow newWindow, string sTitle, string sBtnFirst, string sBtnSecond, string sLabel)
        {
            MyOwnDialog dialog = new MyOwnDialog();

            dialog.Owner             = newWindow;
            dialog.Title             = sTitle;
            dialog.btnFirst.Content  = sBtnFirst;
            dialog.btnSecond.Content = sBtnSecond;
            dialog.mainLabel.Text    = sLabel;

            if (dialog.ShowDialog() == true)
            {
                return(true);
            }

            return(false);
        }
 private void btDecrypt_Click(object sender, RoutedEventArgs e)
 {
     if (tbPassword.Password.Length > 7)
     {
         DialogResult = true;
     }
     else
     {
         MyOwnDialog own = new MyOwnDialog();
         own.Owner             = this;
         own.Title             = "Information";
         own.btnFirst.Content  = "Ok";
         own.btnSecond.Content = "Cancel";
         own.mainLabel.Text    = "Password is too short! Minimum length is 8 characters.";
         own.ShowDialog();
     }
 }