void ReleaseDesignerOutlets() { if (HeroPicker != null) { HeroPicker.Dispose(); HeroPicker = null; } if (ResultLabel != null) { ResultLabel.Dispose(); ResultLabel = null; } if (SubmitButton != null) { SubmitButton.Dispose(); SubmitButton = null; } if (VillainPicker != null) { VillainPicker.Dispose(); VillainPicker = null; } }
private async Task PopulateCharacters() { IEnumerable <Character> allCharacters = await _characterService.GetCharacters(); _heroPickerViewModel.Characters = allCharacters.Where(character => character.Type == CharacterType.Hero).ToList(); _villainPickerViewModel.Characters = allCharacters.Where(character => character.Type == CharacterType.Villain).ToList(); InvokeOnMainThread(() => { HeroPicker.ReloadAllComponents(); VillainPicker.ReloadAllComponents(); }); }
public Form1() { Model = new Model(); InitializeComponent(); Groups(); imageResource = new ImageResource(this.imageList1) { Resource = "UI/Icons/" }; imageResource.ImageSizeChange(Settings.Default.IconSize); largeImageResource = new ImageResource(this.imageList2) { Resource = "UI/Images/" }; largeImageResource.Load(largeImageResource.Resource); contextMenu = new ContextMenuComponent(metroContextMenu1) { GetStatistic = (x) => Model.Hero.Statistic(x) }; playerPick = new PlayerPickInfo(playerpickButton) { GetImage = imageResource.Bitmap, GetHeroId = (x) => Model.Hero.Select(x).Item[0].Id }; forecastResultComponent = new ForecastResultComponent(metroListView1, btn_forecast) { Compute = Model.ForecastService.Select(x => x).ToList(), GetHeroes = () => Model.Hero, GetPlayersPick = playerPick.GetPlayerPics, MatchupWith = Model.Statistic.MatchUp.With, MatchupAgainst = Model.Statistic.MatchUp.Against }; filterTab = new FilterTab(cont_Filter, btn_FilterVisibleChange); filterTab.Collapse(); statfilterTab = new FilterTab(splitContainer2, bunifuTileButton1); statfilterTab.Collapse(); heroFilter = new HeroFilter(groupCheckBox, subgroupCheckBox, franchiseCheckBox, metroTextBox9); heroStatFilter = new HeroFilter(groupStatCheckBox, subgroupStatCheckBox, franchiseStatCheckBox, metroTextBox1); heroPicker = new HeroPicker(listView1) { GetImageId = imageResource.Index, GetHeroes = () => Model.Hero }; heroSelector = new HeroSelector(listView2) { GetImageId = imageResource.Index, GetHeroes = () => Model.Hero, GetFranchiseFilter = heroFilter.GetFranchiseFilter, GetGroupFilter = heroFilter.GetGroupsFilter, GetSubGroupFilter = heroFilter.GetSubGroupFilter, GetTextFilter = heroFilter.GetTextFilter }; heroComponent = new HeroComponent(controls) { GetImage = imageResource.Bitmap, GetLargeImage = largeImageResource.Bitmap, GetHero = (x) => Model.Hero.Select(x).Item[0] }; renderSettings = new RenderSettings(metroComboBox1, metroTextBox15, metroCheckBox2, numericUpDown1) { GetRenderType = () => imageResource.RenderType.ToArray() }; renderSettings.Init(); styleManager = new StyleManager(controls, metroContextMenu1, metroStyleManager1, this); themeSelector = new ThemeSelector(metroComboBox2, metroComboBox3); statComponent = new StatComponent(zedGraphControl1) { Hero = x => Model.Hero.Item[x].Hero, HeroesAvgStatistic = () => Model.Statistic.HeroStatistic.All().Item1, HeroGameCount = x => Model.Hero.Select(x).Item[0].Statistic.count, Image = imageResource.Bitmap, Style = () => styleManager.Style, Filter = () => { return(Model.Hero. Select(heroStatFilter.GetGroupsFilter()). Select(heroStatFilter.GetSubGroupFilter()). Select(heroStatFilter.GetFranchiseFilter()). Select(heroStatFilter.GetTextFilter()).Select(X => X.Id).ToList()); } }; statComponent.Init(); statGraph = new StatGraph(metroComboBox4) { GetSupportHeroStatistic = () => statComponent.HeroStat }; statGraph.HeroesSelectionChanged += statComponent.ComputeHeroesStat; statGraph.Init(); heroSelector.SelectionChanged += contextMenu.SelectPlayer; heroPicker.SelectionChanged += heroComponent.Render; playerPick.PickChanged += contextMenu.ChangeElement; contextMenu.OnPlayerPicked += playerPick.SetPick; heroFilter.OnGroupChanged += heroSelector.Render; heroFilter.OnSubGroupChanged += heroSelector.Render; heroFilter.OnFranchiseChanged += heroSelector.Render; heroFilter.OnTextСhanged += heroSelector.Render; heroStatFilter.OnGroupChanged += statComponent.ComputeHeroesStat; heroStatFilter.OnSubGroupChanged += statComponent.ComputeHeroesStat; heroStatFilter.OnFranchiseChanged += statComponent.ComputeHeroesStat; heroStatFilter.OnTextСhanged += statComponent.ComputeHeroesStat; themeSelector.OnThemeChanged += styleManager.ChangeTheme; themeSelector.OnStyleChanged += styleManager.ChangeStyle; renderSettings.OnBackgroundChanged += styleManager.SetBackground; renderSettings.OnTransparentChanged += styleManager.TransparentChange; renderSettings.OnBackgroundChanged += heroPicker.ChangeBackGround; renderSettings.OnRenderModeChanged += heroPicker.RenderModeChange; renderSettings.OnImageSizeChanged += heroPicker.ItemSizeChange; renderSettings.OnBackgroundChanged += heroSelector.ChangeBackGround; renderSettings.OnRenderModeChanged += heroSelector.RenderModeChange; renderSettings.OnImageSizeChanged += heroSelector.ItemSizeChange; renderSettings.OnImageSizeChanged += imageResource.ImageSizeChange; LoadToolTip(); Render(); }