private void EmitEvent(Character e) { EventHandler<Character> handler = OnSelect; if (handler != null) { handler(this, e); } }
public CharacterDisplay(Character character) { this.InitializeComponent(); this.character = character; this.CharacterName.Text = character.Name; this.CharacterDescription.Text = character.Corp + "\n" + character.Ballance.ToString("n", EVE_SaleTools.Settings.numberFormat) + " ISK"; this.CharacterImage.Source = character.Image; }
async protected override void OnNavigatedTo(NavigationEventArgs e) { activeCharacter = e.Parameter as Character; // load all transaction items var sqlite = new SQLiteAsyncConnection(activeCharacter.CharID + ".sqlite"); List<Transaction> items = await sqlite.QueryAsync<Transaction>("SELECT * FROM 'Transaction' GROUP BY TypeID ORDER BY TypeName"); this.Itemlist.ItemsSource = items; this.Categories.AddItems(items); this.Categories.ItemSelect += this.LoadData; SolidColorBrush line_sales = new SolidColorBrush(Color.FromArgb(255, 116, 195, 101)); Style point_sales = new Style(); point_sales.TargetType = typeof(DataPoint); point_sales.Setters.Add(new Setter(BackgroundProperty, line_sales)); (LineChart.Series[0] as LineSeries).Background = line_sales; (LineChart.Series[0] as LineSeries).DataPointStyle = point_sales; SolidColorBrush line_salesAvg = new SolidColorBrush(Color.FromArgb(255, 34, 139, 34)); Style point_salesAvg = new Style(); point_salesAvg.TargetType = typeof(DataPoint); point_salesAvg.Setters.Add(new Setter(BackgroundProperty, line_salesAvg)); point_salesAvg.Setters.Add(new Setter(WidthProperty, 0)); point_salesAvg.Setters.Add(new Setter(HeightProperty, 0)); (LineChart.Series[1] as LineSeries).Background = line_salesAvg; (LineChart.Series[1] as LineSeries).DataPointStyle = point_salesAvg; SolidColorBrush line_buys = new SolidColorBrush(Color.FromArgb(255, 196, 2, 51)); Style point_buys = new Style(); point_buys.TargetType = typeof(DataPoint); point_buys.Setters.Add(new Setter(BackgroundProperty, line_buys)); (LineChart.Series[2] as LineSeries).Background = line_buys; (LineChart.Series[2] as LineSeries).DataPointStyle = point_buys; SolidColorBrush line_buysAvg = new SolidColorBrush(Color.FromArgb(255, 237, 28, 36)); Style point_buysAvg = new Style(); point_buysAvg.TargetType = typeof(DataPoint); point_buysAvg.Setters.Add(new Setter(BackgroundProperty, line_buysAvg)); point_buysAvg.Setters.Add(new Setter(WidthProperty, 0)); point_buysAvg.Setters.Add(new Setter(HeightProperty, 0)); (LineChart.Series[3] as LineSeries).Background = line_buysAvg; (LineChart.Series[3] as LineSeries).DataPointStyle = point_buysAvg; }
/// <summary> /// Load character data /// <param name="apiKey">the api key</param> /// <param name="vCode">the verification code</param> /// <returns>all characters</returns> /// </summary> static async public Task<Character[]> Load(string apiKey, string vCode) { // build request string String request = CharacterLoader.apiBaseUrl + "account/Characters.xml.aspx?keyID=" + apiKey + "&vCode=" + vCode; // load data as xml string HttpResponseMessage response = await new HttpClient().GetAsync(request); string xml_data = await response.Content.ReadAsStringAsync(); // parse as xml and fetch data XDocument characterdata = XDocument.Parse(xml_data); var characters = from character in characterdata.Descendants("row") select new { Name = character.Attribute("name").Value, CharID = character.Attribute("characterID").Value, Corp = character.Attribute("corporationName").Value }; // load data for each character Character[] charlist = new Character[characters.Count()]; int index = 0; // create a a new character for each one foreach (var character in characters) { Character charcter = new Character( character.Name, await CharacterLoader.FetchImage(character.CharID, 256), character.CharID, character.Corp, await CharacterLoader.FetchWalletData(apiKey, vCode, character.CharID)); charlist[index++] = charcter; } return charlist; }
private void SelectCharacter(object sender, Character character) { this.Frame.Navigate(typeof(EVE_SaleTools.Pages.LoadTransactions), character); }