private void Client_InventoryUpdated() { Device.BeginInvokeOnMainThread(() => { string money; IList <InventoryItem> items; lock (Bot) { money = Bot.Game.Money.ToString("#,##0"); items = Bot.Game.Items.ToArray(); } MoneyText.Text = "Poke$: " + money; InventoryItemsLabelName lblNames = new InventoryItemsLabelName { Id = "Id", Name = "Name", Quantity = "Quantity", Scope = "Scope" }; List <InventoryItemsLabelName> lol = new List <InventoryItemsLabelName>(); lol.Add(lblNames); foreach (var item in items) { InventoryItemsLabelName values = new InventoryItemsLabelName { Id = item.Id.ToString(), Name = item.Name, Quantity = item.Quantity.ToString(), Scope = item.Scope.ToString() }; lol.Add(values); } Inventories.ItemView.ItemsSource = lol; }); }
private void Bot_ConnectionClosed() { Device.BeginInvokeOnMainThread(() => { _lastQueueBreakPoint = null; btnLogin.IsEnabled = true; StatusText.Text = "Status: Offline"; StatusText.TextColor = Color.OrangeRed; Team.Team = new List <Pokemon>(); Team.PokemonsListView.ItemsSource = null; Team.PokemonsListView.ItemsSource = null; Team.PokemonsListView.BeginRefresh(); Team.PokemonsListView.EndRefresh(); Players.PlayerListView.ItemsSource = null; Players.PlayerListView.BeginRefresh(); Players.PlayerListView.EndRefresh(); Inventories.ItemView.BeginRefresh(); InventoryItemsLabelName lblNames = new InventoryItemsLabelName { Id = "Id", Name = "Name", Quantity = "Quantity", Scope = "Scope" }; List <InventoryItemsLabelName> lol = new List <InventoryItemsLabelName>(); lol.Add(lblNames); Inventories.ItemView.ItemsSource = lol; Inventories.ItemView.EndRefresh(); Players.Content = new StackLayout { Children = { Players.PlayerListView } }; Team.Content = new StackLayout { Children = { Team.PokemonsListView } }; btnLogin.Text = "Login"; }); }
private void InitializeComponents() { InventoryItemsLabelName lblNames = new InventoryItemsLabelName { Id = "Id", Name = "Name", Quantity = "Quantity", Scope = "Scope" }; List <InventoryItemsLabelName> lol = new List <InventoryItemsLabelName>(); lol.Add(lblNames); Inventories.ItemView.ItemsSource = lol; PlayerPositionText = new Label { Text = "Player Position: (0, 0)", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; MapNameText = new Label { Text = "Map Name: ??", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; StatusText = new Label { Text = "Status: Offline", TextColor = Color.OrangeRed, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; MoneyText = new Label { Text = "Poke$: 0", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; PokeTimeText = new Label { Text = "Game Time: 0:00", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), Margin = 2 }; btnLogin = new Button { Text = "Login", TextColor = Color.White, BackgroundColor = Color.FromHex("77D065"), }; txtUsername = new Entry { Placeholder = "Username" }; txtPassword = new Entry { Placeholder = "Password", IsPassword = true }; txtServer = new Entry { Placeholder = "Server" }; Logs = new List <string>(); btnBot = new Button { WidthRequest = Device.Android == Device.RuntimePlatform ? 60 : 120, TextColor = Color.White, Text = "Start", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), BackgroundColor = Color.FromHex("2C88C6") }; btnStopBot = new Button { WidthRequest = Device.Android == Device.RuntimePlatform ? 60 : 120, TextColor = Color.White, Text = "Stop", IsEnabled = false, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), BackgroundColor = Color.FromHex("2C88C6") }; AutoEvolveSwitch = new Switch { Margin = -5, }; Label header = new Label { Text = "Auto Evolve:", Margin = 2, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) }; LogTexts = new Editor { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), HeightRequest = 130 }; AutoEvolveSwitch.IsToggled = Bot.PokemonEvolver.IsEnabled; btnLoadScript = new Button { WidthRequest = Device.Android == Device.RuntimePlatform ? 60 : 120, TextColor = Color.White, Text = "Load Script", FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), BackgroundColor = Color.FromHex("2C88C6") }; grid = new Grid { RowSpacing = 1, ColumnSpacing = 1 }; grid.HorizontalOptions = LayoutOptions.FillAndExpand; grid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto } }; var content1 = new StackLayout { Children = { StatusText, MapNameText, PlayerPositionText, MoneyText, }, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 15 }; var content2 = new StackLayout { Children = { PokeTimeText, header, AutoEvolveSwitch, }, Orientation = StackOrientation.Horizontal, }; var content3 = new StackLayout { Children = { btnLoadScript, btnBot, btnStopBot }, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, }; grid.Children.Add(content1); Grid.SetColumnSpan(content1, 1); grid.Children.Add(content2, 0, 1); Grid.SetColumnSpan(content2, 1); grid.Children.Add(content3, 0, 2); Grid.SetColumnSpan(content3, 1); grid.Children.Add(LogTexts, 0, 3); var profilePage = new ContentPage { Title = "Login", Content = new StackLayout { Spacing = 20, Padding = 50, VerticalOptions = LayoutOptions.Center, Children = { txtUsername, txtPassword, txtServer, btnLogin } } }; var settingsPage = new ContentPage { Title = "Bot", Content = grid }; var mainPage = new TabbedPage { Children = { profilePage, settingsPage, Team, Chat, Players, Inventories } }; Children.Add(mainPage); }