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; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace EveCalc.UI { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { private readonly EsiClientWrapper client = new EsiClientWrapper(); public MainWindow() { InitializeComponent(); } public ObservableCollection CorpBlueprints = new ObservableCollection(); public ObservableCollection CorpMats = new ObservableCollection(); 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; } } }