public LoginWindow(BotClient bot) { InitializeComponent(); ProxyCheckBox_Checked(null, null); _bot = bot; Title = App.Name + " - " + Title; UsernameTextBox.Focus(); ServerComboBox.ItemsSource = new List<string>() { "Red Server", "Blue Server" }; ServerComboBox.SelectedIndex = 0; RefreshAccountList(); }
public PlayersView(BotClient bot) { InitializeComponent(); _bot = bot; }
private void Bot_StateChanged(BotClient.State state) { Dispatcher.InvokeAsync(delegate { UpdateBotMenu(); string stateText; if (BotClient.State.Started == state) { stateText = "started"; StartScriptButtonIcon.Icon = FontAwesome.WPF.FontAwesomeIcon.Pause; } else if (BotClient.State.Paused == state) { stateText = "paused"; StartScriptButtonIcon.Icon = FontAwesome.WPF.FontAwesomeIcon.Play; } else { stateText = "stopped"; StartScriptButtonIcon.Icon = FontAwesome.WPF.FontAwesomeIcon.Play; } LogMessage("Bot " + stateText); }); }
public MainWindow() { #if !DEBUG AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; #endif Thread.CurrentThread.Name = "UI Thread"; Bot = new BotClient(); Bot.StateChanged += Bot_StateChanged; Bot.ClientChanged += Bot_ClientChanged; Bot.AutoReconnector.StateChanged += Bot_AutoReconnectorStateChanged; Bot.StaffAvoider.StateChanged += Bot_StaffAvoiderStateChanged; Bot.PokemonEvolver.StateChanged += Bot_PokemonEvolverStateChanged; Bot.ConnectionOpened += Bot_ConnectionOpened; Bot.ConnectionClosed += Bot_ConnectionClosed; Bot.MessageLogged += Bot_LogMessage; InitializeComponent(); AutoReconnectSwitch.IsChecked = Bot.AutoReconnector.IsEnabled; AvoidStaffSwitch.IsChecked = Bot.StaffAvoider.IsEnabled; AutoEvolveSwitch.IsChecked = Bot.PokemonEvolver.IsEnabled; App.InitializeVersion(); Team = new TeamView(Bot); Inventory = new InventoryView(); Chat = new ChatView(Bot); Players = new PlayersView(Bot); _refreshPlayers = DateTime.UtcNow; _refreshPlayersDelay = 5000; TeamContent.Content = Team; InventoryContent.Content = Inventory; ChatContent.Content = Chat; PlayersContent.Content = Players; TeamContent.Visibility = Visibility.Visible; InventoryContent.Visibility = Visibility.Collapsed; ChatContent.Visibility = Visibility.Collapsed; PlayersContent.Visibility = Visibility.Collapsed; TeamButton.IsChecked = true; SetTitle(null); LogMessage("Running " + App.Name + " by " + App.Author + ", version " + App.Version); Task.Run(() => UpdateClients()); }