Exemplo n.º 1
0
        /// <summary>Displays a new <see cref="InputNotification"/> in a thread-safe way.</summary>
        /// <param name="message">Message to be displayed</param>
        /// <param name="title">Title of the <see cref="InputNotification"/> window</param>
        /// <param name="defaultText">Text to be displayed in the TxtInput TextBox by default.</param>
        internal static string InputDialog(string message, string title, string defaultText = "")
        {
            TextBox           txtInput = new TextBox();
            InputNotification newIn    = new InputNotification(message, title, MainWindow, defaultText);

            return(Application.Current.Dispatcher.Invoke(() => newIn.ShowDialog()) == true ? newIn.TxtInput.Text : "");
        }
Exemplo n.º 2
0
 public void StartNotification()
 {
     args = new UserInputEventArgs();
     while (true)
     {
         args.Key = Console.ReadKey().Key;
         if (args.Key == ConsoleKey.Escape)
         {
             break;
         }
         InputNotification?.Invoke(this, args);
     }
 }