Ejemplo n.º 1
0
 public override bool TryGetBasicBotSettings(out BasicBotSettings botSettings)
 {
     var result = DialogHelper.ShowDialog(() =>
     {
         SettingsWindow settingsWindow = new SettingsWindow();
         settingsWindow.Topmost = true;
         return settingsWindow.ShowDialog();
     });
     botSettings = result;
     return botSettings != null;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!CanSave)
            {
                MessageBox.Show("All fields are required. Fix the values on the form before submitting.",
                    "Invalid Settings", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            botSettings = new BasicBotSettings
            {
                Username = txtUsername.Text,
                Password = txtPassword1.Text,
                Owner = txtOwner.Text,
                Trigger = txtTrigger.Text,
                AutoJoins = txtAutoJoins.Text.Split(new char[] { ',' } , StringSplitOptions.RemoveEmptyEntries)
            };
            this.Close();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tries to get the basic bot settings. Returns true if successful,
        /// otherwise false.
        /// </summary>
        /// <param name="botSettings">The bot settings.</param>
        /// <returns>
        /// True if settings were retrieved, otherwise false.
        /// </returns>
        public virtual bool TryGetBasicBotSettings(out BasicBotSettings botSettings)
        {
            botSettings = new BasicBotSettings();

            console.Write("Bot settings have not been created yet.\nWould you like to create them now? (Y/N) ", Style.Prompt);
            string input = console.ReadLine().Trim();
            if (input.ToLower() == "N")
                return false;

            console.WriteLine("Please enter the following information.");
            console.Write("Bot Username: "******"Bot Password: "******"One more time: ", Style.Prompt);
                string pass2 = console.ReadLine();

                if (pass1 == pass2)
                {
                    botSettings.Password = pass1;
                    break;
                }
                else
                {
                    console.WriteLine("Passwords don't match! Let's enter those again...", Style.Warning);
                }
            }

            console.Write("Bot Trigger: ", Style.Prompt);
            botSettings.Trigger = console.ReadLine();
            console.Write("Bot Owner: ", Style.Prompt);
            botSettings.Owner = console.ReadLine().Trim();

            console.Write("What channels would you like your bot to join? Separate with commas: ", Style.Prompt);
            botSettings.AutoJoins = console.ReadLine().Split(new [] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            return true;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Handles the Click event of the btnCancel control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     botSettings = null;
     this.Close();
 }