public static void Initialize(Canvas itemCanvas, Dispatcher dispatcher, ComboBox ddlSortMode, ComboBox ddlSortOption) { Initialized = true; var sortingAlgorithmsExtern = GetAlgorithmsAssembly() .GetTypes().Where(x => typeof(SortingAlgorithm).IsAssignableFrom(x) && x != typeof(SortingAlgorithm)) .ToList(); var sortingAlgorithmsExternIntern = Assembly.GetExecutingAssembly() .GetTypes().Where(x => typeof(SortingAlgorithm).IsAssignableFrom(x) && x != typeof(SortingAlgorithm)) .Where(x => sortingAlgorithmsExtern.Any(c => c.Name == x.Name) == false) .ToList(); foreach (var item in sortingAlgorithmsExtern) { SortingAlgorithms.Add((SortingAlgorithm)Activator.CreateInstance(item)); } foreach (var item in sortingAlgorithmsExternIntern) { SortingAlgorithms.Add((SortingAlgorithm)Activator.CreateInstance(item)); } PoeSorter.ddlSortMode = ddlSortMode; PoeSorter.ddlSortOption = ddlSortOption; PoeSorter.Dispatcher = dispatcher; PoeSorter.ItemCanvas = itemCanvas; PoeSorter.Leagues = PoeConnector.FetchLeagues(); PoeSorter.Character = PoeConnector.FetchCharecters(); }
public League(string name) { Name = name; Tabs = PoeConnector.FetchTabs(this); var t = Tabs.FirstOrDefault(); if (t != null && t.Name.Trim() == "1") { Tabs.Remove(t); } }
public static async void SetSelectedTab(Tab tab) { if (tab != null) { // Unselect current tab if (SelectedTab != null) { SelectedTab.IsSelected = false; SelectedTabSorted.IsSelected = false; //if (SelectedTab.Items != null) //{ // SelectedTab.Items.ForEach(x => x.Image.Visibility = Visibility.Hidden); //} ////Remove old sorted tab preview //if (SelectedTabSorted != null) //SelectedTabSorted.Items.ForEach(x => ItemCanvas.Children.Remove(x.Image)); } // Set new selected tab tab.IsSelected = true; SelectedTab = tab; // Download selected tab; if (tab.Items == null) { tab.Items = (await PoeConnector.FetchTabAsync(tab.Index, tab.League)).Items; } tab.Items.ForEach(x => x.Tab = tab); // If the tab still is selected after download is complete. if (tab.IsSelected) { tab.Items.ForEach(x => x.Image.Visibility = Visibility.Visible); SelectSortingAlgoritm(null); } } }