Blueprint loading works

This commit is contained in:
2021-01-30 22:46:48 +01:00
parent 295f63669d
commit 1ab244f7c5
21 changed files with 710 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
using System;
using EveCalc.Shared.Logic;
using EveCalc.Shared.ObjectModel;
using EveCalc.Shared.Views;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -20,9 +24,52 @@ namespace EveCalc.UI
/// </summary>
public partial class MainWindow : Window
{
private readonly EsiClientWrapper client = new EsiClientWrapper();
public MainWindow()
{
InitializeComponent();
}
public ObservableCollection<Blueprint> CorpBlueprints = new ObservableCollection<Blueprint>();
public ObservableCollection<object> CorpMats = new ObservableCollection<object>();
private void MnuLogin_Click(object sender, RoutedEventArgs e)
{
var url = this.client.GetLoginUrl();
var browser = new BrowserView(url);
if (browser.ShowDialog() == true)
{
this.client.SetAuthCode(browser.AuthCode);
}
MessageBox.Show("Login ok");
}
private async void MnuLoadBlueprints_Click(object sender, RoutedEventArgs e)
{
this.CorpBlueprints.Clear();
var result = await this.client.GetCorpBlueprints();
foreach (var blueprint in result)
{
this.CorpBlueprints.Add(blueprint);
}
this.LvwBlueprints.ItemsSource = null;
this.LvwBlueprints.ItemsSource = this.CorpBlueprints;
}
private async void MnuLoadMats_Click(object sender, RoutedEventArgs e)
{
this.CorpMats.Clear();
var result = await this.client.GetCorpMats();
//foreach (var mat in result)
//{
// this.CorpMats.Add(mat);
//}
this.LvwMats.ItemsSource = null;
this.LvwMats.ItemsSource = this.CorpMats;
}
}
}