async void LoadAccountsIntoPicker() { AccountManagement.AccountManager accountManger = new AccountManagement.AccountManager(); var activeAccount = await accountManager.GetActiveAccountAsync(); if (activeAccount == null) { await Navigation.PushModalAsync(new LacunaExpress.Pages.AccountPages.Login()); } }
async Task <bool> LoadMessagesAsync(string category) { var acntMgr = new AccountManagement.AccountManager(); account = await acntMgr.GetActiveAccountAsync(); if (account == null) { await Navigation.PushAsync(new Login()); return(false); } else { messageList.Clear(); string json; switch (category) { case "All": json = Inbox.ViewInbox(account.SessionID); break; case "Sent": json = Inbox.ViewSent(account.SessionID); break; case "Trashed": json = Inbox.ViewTrash(account.SessionID); break; case "Archived": json = Inbox.ViewArchive(account.SessionID); break; default: json = Inbox.ViewInbox(account.SessionID, category); break; } try { var s = new Server(); var response = await s.GetHttpResultAsync(account.Server, Inbox.url, json); foreach (var m in response.result.messages) { messageList.Add(new MessageData(m.from, m.subject, m.body_preview, m.id.ToString())); } } catch (Exception e) { var f = e.Message; } } return(true); }
async void GetActiveAccount() { var accm = new AccountManagement.AccountManager(); activeAccount = await accm.GetActiveAccountAsync(); if (activeAccount == null) { await Navigation.PushModalAsync(new Login()); //GetActiveAccount(); } }
async Task <AccountModel> GetActiveAccountAsync() { var accm = new AccountManagement.AccountManager(); var account = await accm.GetActiveAccountAsync(); if (account == null) { await Navigation.PushModalAsync(new Login()); account = await GetActiveAccountAsync(); } return(account); }
public StationsMain() { var mainLayout = new StackLayout { BackgroundColor = Color.FromRgb(0, 0, 128), Children = { pickerLabel, stationPicker, viewStation, parliamentBtn } }; Content = mainLayout; if (Device.OS == TargetPlatform.iOS) { mainLayout.Padding = new Thickness(0, 20, 0, 0); } this.Appearing += async(sender, e) => { AccountManagement.AccountManager accountMngr = new AccountManagement.AccountManager(); activeAccount = await accountMngr.GetActiveAccountAsync(); var stationNames = activeAccount.Stations.Values.ToList(); stationNames.Sort(); foreach (var s in stationNames) { stationPicker.Items.Add(s); } }; viewStation.IsVisible = false; parliamentBtn.IsVisible = false; stationPicker.SelectedIndexChanged += (sender, e) => { selectedStation = stationPicker.Items[stationPicker.SelectedIndex]; ActivateButtons(); }; viewStation.Clicked += async(sender, e) => { await Navigation.PushAsync(new StationBuildings(activeAccount, selectedStation)); }; parliamentBtn.Clicked += async(sender, e) => { if (activeAccount.Stations.Count > 0) { await Navigation.PushAsync(new Parliament(activeAccount, selectedStation)); } }; }
public StationsMain() { var mainLayout = new StackLayout { BackgroundColor = Color.FromRgb (0, 0, 128), Children = { pickerLabel, stationPicker, viewStation, parliamentBtn } }; Content = mainLayout; if (Device.OS == TargetPlatform.iOS) { mainLayout.Padding = new Thickness (0, 20, 0, 0); } this.Appearing += async (sender, e) => { AccountManagement.AccountManager accountMngr = new AccountManagement.AccountManager(); activeAccount = await accountMngr.GetActiveAccountAsync(); var stationNames = activeAccount.Stations.Values.ToList(); stationNames.Sort(); foreach (var s in stationNames) { stationPicker.Items.Add(s); } }; viewStation.IsVisible = false; parliamentBtn.IsVisible = false; stationPicker.SelectedIndexChanged += (sender, e) => { selectedStation = stationPicker.Items[stationPicker.SelectedIndex]; ActivateButtons(); }; viewStation.Clicked += async (sender, e) => { await Navigation.PushAsync(new StationBuildings(activeAccount, selectedStation)); }; parliamentBtn.Clicked += async (sender, e) => { if(activeAccount.Stations.Count >0) await Navigation.PushAsync(new Parliament(activeAccount, selectedStation)); }; }
async Task<bool> LoadMessagesAsync(string category) { var acntMgr = new AccountManagement.AccountManager(); account = await acntMgr.GetActiveAccountAsync(); if (account == null) { await Navigation.PushAsync(new Login()); return false; } else { messageList.Clear(); string json; switch (category) { case "All": json = Inbox.ViewInbox(account.SessionID); break; case "Sent": json = Inbox.ViewSent(account.SessionID); break; case "Trashed": json = Inbox.ViewTrash(account.SessionID); break; case "Archived": json = Inbox.ViewArchive(account.SessionID); break; default: json = Inbox.ViewInbox(account.SessionID, category); break; } try { var s = new Server(); var response = await s.GetHttpResultAsync(account.Server, Inbox.url, json); foreach (var m in response.result.messages) messageList.Add(new MessageData(m.from, m.subject, m.body_preview, m.id.ToString())); } catch (Exception e) { var f = e.Message; } } return true; }
async void LoadAccountsIntoPicker() { AccountManagement.AccountManager accountManger = new AccountManagement.AccountManager(); accounts = await accountManager.LoadAccountsAsync(); selectedAccount = await accountManager.GetActiveAccountAsync(); if (accounts != null) { foreach (var a in accounts.AccountList) { accountPicker.Items.Add(a.DisplayName); } } else { await Navigation.PushModalAsync(new LacunaExpress.Pages.AccountPages.Login()); } }
public MapMain() { Resources = Styles.Styles.StyleDictionary; Button cacheStarMapBtn = new Button { Text = "Cache Map", Style = (Style)Styles.Styles.StyleDictionary[Styles.Styles.StyleName.RegularButton.ToString()] //TextColor = Color.White, //BorderWidth = 2, //BorderColor = Color.White, //BackgroundColor = Color.Blue, //FontAttributes = FontAttributes.Bold }; var mainLayout = new StackLayout { BackgroundColor = Color.FromRgb(0, 0, 128), Children = { cacheStarMapBtn } }; Content = mainLayout; if (Device.OS == TargetPlatform.iOS) { mainLayout.Padding = new Thickness(0, 20, 0, 0); } this.Appearing += async(sender, e) => { AccountManagement.AccountManager accountMngr = new AccountManagement.AccountManager(); activeAccount = await accountMngr.GetActiveAccountAsync(); }; cacheStarMapBtn.Clicked += async(sender, e) => { var s = await MapScripts.GetAllStarsInRange300(activeAccount, 0, 0); Data.FileStorage.SaveStarsAsync(s); }; }
public MapMain() { Resources = Styles.Styles.StyleDictionary; Button cacheStarMapBtn = new Button { Text = "Cache Map", Style = (Style)Styles.Styles.StyleDictionary[Styles.Styles.StyleName.RegularButton.ToString()] //TextColor = Color.White, //BorderWidth = 2, //BorderColor = Color.White, //BackgroundColor = Color.Blue, //FontAttributes = FontAttributes.Bold }; var mainLayout = new StackLayout { BackgroundColor = Color.FromRgb (0, 0, 128), Children = { cacheStarMapBtn } }; Content = mainLayout; if (Device.OS == TargetPlatform.iOS) { mainLayout.Padding = new Thickness (0, 20, 0, 0); } this.Appearing += async (sender, e) => { AccountManagement.AccountManager accountMngr = new AccountManagement.AccountManager(); activeAccount = await accountMngr.GetActiveAccountAsync(); }; cacheStarMapBtn.Clicked += async (sender, e) => { var s = await MapScripts.GetAllStarsInRange300(activeAccount, 0, 0); Data.FileStorage.SaveStarsAsync(s); }; }
public PlanetMenu() { var mainLayout = new StackLayout { BackgroundColor = Color.FromRgb(0, 0, 128), Children = { planetPicker, spyOptions, shipOptions, buildingOptions, // tradeOptions, buildingsBtn, planetMapBtn } }; Content = mainLayout; if (Device.OS == TargetPlatform.iOS) { mainLayout.Padding = new Thickness(0, 20, 0, 0); } this.Appearing += async(sender, e) => { AccountManagement.AccountManager accountMngr = new AccountManagement.AccountManager(); activeAccount = await accountMngr.GetActiveAccountAsync(); selectedPlanet = activeAccount.Capital; var plist = activeAccount.Colonies.Values.ToList(); plist.Sort(); foreach (var p in plist) { planetPicker.Items.Add(p); } planetPicker.SelectedIndex = planetPicker.Items.IndexOf(selectedPlanet); }; planetPicker.SelectedIndexChanged += async(sender, e) => { selectedPlanet = planetPicker.Items[planetPicker.SelectedIndex]; }; buildingsBtn.Clicked += async(sender, e) => { await Navigation.PushAsync(new PlanetBuildings(activeAccount, selectedPlanet)); }; spyOptions.Clicked += async(sender, e) => { await Navigation.PushAsync(new SpiesMain(activeAccount, selectedPlanet)); }; buildingOptions.Clicked += async(sender, e) => { await Navigation.PushAsync(new BuildingToolsView(activeAccount, selectedPlanet)); }; shipOptions.Clicked += async(sender, e) => { await Navigation.PushAsync(new ShipTools(activeAccount, selectedPlanet)); }; planetMapBtn.Clicked += async(sender, e) => { await Navigation.PushAsync(new PlanetMap(activeAccount, selectedPlanet)); }; }
public PlanetMenu() { var mainLayout = new StackLayout { BackgroundColor = Color.FromRgb (0, 0, 128), Children = { planetPicker, spyOptions, shipOptions, buildingOptions, // tradeOptions, buildingsBtn, planetMapBtn } }; Content = mainLayout; if (Device.OS == TargetPlatform.iOS) { mainLayout.Padding = new Thickness (0, 20, 0, 0); } this.Appearing += async (sender, e) => { AccountManagement.AccountManager accountMngr = new AccountManagement.AccountManager(); activeAccount = await accountMngr.GetActiveAccountAsync(); selectedPlanet = activeAccount.Capital; var plist = activeAccount.Colonies.Values.ToList(); plist.Sort(); foreach (var p in plist) { planetPicker.Items.Add(p); } planetPicker.SelectedIndex = planetPicker.Items.IndexOf(selectedPlanet); }; planetPicker.SelectedIndexChanged += async (sender, e) => { selectedPlanet = planetPicker.Items[planetPicker.SelectedIndex]; }; buildingsBtn.Clicked += async (sender, e) => { await Navigation.PushAsync(new PlanetBuildings(activeAccount, selectedPlanet)); }; spyOptions.Clicked += async (sender, e) => { await Navigation.PushAsync(new SpiesMain(activeAccount, selectedPlanet)); }; buildingOptions.Clicked += async (sender, e) => { await Navigation.PushAsync(new BuildingToolsView(activeAccount, selectedPlanet)); }; shipOptions.Clicked += async (sender, e) => { await Navigation.PushAsync(new ShipTools(activeAccount, selectedPlanet)); }; planetMapBtn.Clicked += async (sender, e) => { await Navigation.PushAsync(new PlanetMap(activeAccount, selectedPlanet)); }; }
async void GetActiveAccount() { var accm = new AccountManagement.AccountManager(); activeAccount = await accm.GetActiveAccountAsync(); if (activeAccount == null) { await Navigation.PushModalAsync(new Login()); //GetActiveAccount(); } }
async Task<AccountModel> GetActiveAccountAsync() { var accm = new AccountManagement.AccountManager(); var account = await accm.GetActiveAccountAsync(); if (account == null) { await Navigation.PushModalAsync(new Login()); account = await GetActiveAccountAsync(); } return account; }