void HandleColorClicked(object sender, EventArgs e) { ToggleButton button = sender as ToggleButton; if (!button.Active) { return; } if (button == homecolor1button) { homecolor2button.Active = false; hometemplate.ActiveColor = 0; hometemplate.UpdateColors(); } else if (button == homecolor2button) { homecolor1button.Active = false; hometemplate.ActiveColor = 1; hometemplate.UpdateColors(); } else if (button == awaycolor1button) { awaycolor2button.Active = false; awaytemplate.ActiveColor = 0; awaytemplate.UpdateColors(); } else if (button == awaycolor2button) { awaycolor1button.Active = false; awaytemplate.ActiveColor = 1; awaytemplate.UpdateColors(); } drawingarea.QueueDraw(); }
void HandleColorSet(object sender, EventArgs e) { if (ignoreChanges) { return; } if (sender == colorbutton1) { template.Colors [0] = Misc.ToLgmColor(colorbutton1.Color); template.UpdateColors(); drawingarea.QueueDraw(); } else { template.Colors [1] = Misc.ToLgmColor(colorbutton2.Color); } Edited = true; }
public void LoadTeams() { int [] homeF = null, awayF = null; int playerSize, colSize, border; NTeams = 0; SetFieldBackground(); ClearPlayers(); homePlayingPlayers = awayPlayingPlayers = null; homePlayers = new List <LMPlayerView> (); awayPlayers = new List <LMPlayerView> (); if (ViewModel.HomeTeam != null) { homeTeam = ViewModel.HomeTeam.Model; homeTeam.UpdateColors(); homePlayingPlayers = GetPlayersViews(ViewModel.HomeTeam.FieldPlayersList, TeamType.LOCAL); homeBenchPlayers = GetPlayersViews(ViewModel.HomeTeam.BenchPlayersList, TeamType.LOCAL); homePlayers.AddRange(homePlayingPlayers); homePlayers.AddRange(homeBenchPlayers); homeF = homeTeam.Formation; if (ViewModel.HomeTeam.Icon == null) { homeButton.BackgroundImage = App.Current.ResourcesLocator.LoadImage(StyleConf.DefaultShield); } else { homeButton.BackgroundImage = ViewModel.HomeTeam.Icon; } NTeams++; } if (ViewModel.AwayTeam != null) { awayTeam = ViewModel.AwayTeam.Model; awayTeam.UpdateColors(); awayPlayingPlayers = GetPlayersViews(ViewModel.AwayTeam.FieldPlayersList, TeamType.VISITOR); awayBenchPlayers = GetPlayersViews(ViewModel.AwayTeam.BenchPlayersList, TeamType.VISITOR); awayPlayers.AddRange(awayPlayingPlayers); awayPlayers.AddRange(awayBenchPlayers); awayF = awayTeam.Formation; if (ViewModel.AwayTeam.Icon == null) { awayButton.BackgroundImage = App.Current.ResourcesLocator.LoadImage(StyleConf.DefaultShield); } else { awayButton.BackgroundImage = ViewModel.AwayTeam.Icon; } NTeams++; } colSize = ColumnSize; playerSize = colSize * 90 / 100; BenchWidth(colSize, field.Height, playerSize); field.LoadTeams(ViewModel.Background, homeF, awayF, homePlayingPlayers, awayPlayingPlayers, playerSize, NTeams); homeBench.BenchPlayers = homeBenchPlayers; awayBench.BenchPlayers = awayBenchPlayers; homeBench.Height = awayBench.Height = field.Height; border = App.Current.Style.TeamTaggerBenchBorder; if (homeTeam == null || awayTeam == null) { if (homeTeam != null) { homeBench.Position = new Point(border, 0); field.Position = new Point(border + homeBench.Width + border, 0); } else { field.Position = new Point(border, 0); awayBench.Position = new Point(border + field.Width + border, 0); } } else { homeBench.Position = new Point(border, 0); field.Position = new Point(homeBench.Width + 2 * border, 0); awayBench.Position = new Point(awayBench.Width + field.Width + 3 * border, 0); } Update(); }