public void SetContext(TournamentView view) { _tournamentView = view; DataContext = _tournamentView; _tournamentView.Capt.LanguageChanged += new EventHandler(Capt_LanguageChanged); }
public PairWindow(TournamentView view, Pair pair, WindowHelper.ResultHandler onResult) { InitializeComponent(); InitPalette(); OnResult = onResult; SetContext(view, pair); _isActivated = true; }
public AboutWindow(TournamentView view, WindowHelper.ResultHandler onResult) { InitializeComponent(); InitPalette(); SetContext(view); InitLangs(); OnResult = onResult; }
public PlayerWindow(TournamentView view, Player player, WindowHelper.ResultHandler onResult) { InitializeComponent(); InitPalette(); OnResult = onResult; SetContext(view, player); }
public ClubWindow(TournamentView view, Club club, string countryCode, WindowHelper.ResultHandler onResult, bool editMode) { InitializeComponent(); InitPalette(); OnResult = onResult; SetContext(view, club, countryCode, editMode); InitLangs(); InitBars(); }
public void SetContext(TournamentView view, Club club, string countryCode, bool editMode) { _tournamentView = view; _club = club; _countryCode = countryCode; _editMode = editMode; DataContext = club; _club.Capt.LanguageChanged += new EventHandler(Capt_LanguageChanged); _club.Capt.SettingsChanged += new EventHandler(Capt_SettingsChanged); }
private void ExecuteClubWindow(TournamentView view, Club club, string countryCode, bool editMode) { ClubWindow dlg = App.GetOpenedWindow(typeof(ClubWindow)) as ClubWindow; if (dlg == null) { dlg = new ClubWindow(view, club, countryCode, OnClubWindowReturn, editMode); } else { dlg.SetContext(view, club, countryCode, editMode); } dlg.ShowWindow(); }
public void SetContext(TournamentView view, Pair pair) { _tournamentView = view; _pair = pair; _pairBak = new Pair(); _pair.CopyTo(_pairBak); DataContext = _pair; _pair.Capt.LanguageChanged += new EventHandler(Capt_LanguageChanged); _pair.Capt.SettingsChanged += new EventHandler(Capt_SettingsChanged); InitLangs(); cmbGameResult.ItemsSource = _tournamentView.ResultKinds; cmbGameResult.SelectedValue = pair.Result; UpdatePlayerComboboxes(); UpdateGameResult(); //Additional buttons btnPrev.DataContext = _tournamentView; btnNext.DataContext = _tournamentView; btnDeletePair.IsEnabled = _pair.BoardNumber > 0; }
public void SetContext(TournamentView view, Player player) { _tournamentView = view; _player = player; _player.AlternativeNameIfEmpty = false; string clubName = _player.Club; var countries = new CountryList(); countries.AddRange(_tournamentView.Countries); cmbCountry.ItemsSource = countries; cmbNationaity.ItemsSource = countries; var grades = new GradeList(); grades.FillByDefault(); cmbGrade.ItemsSource = grades; if (!_player.IsCreated) { _player.Country = _regBc.LoadRegProp("Default Country"); _player.Club = _regBc.LoadRegProp("Default Club"); bool preliminary; if (bool.TryParse(_regBc.LoadRegProp("Default Preliminary"), out preliminary)) { _player.PreliminaryRegistration = preliminary; } else { _player.PreliminaryRegistration = false; } } DataContext = player; _playerBak = new Player(); _player.CopyTo(_playerBak); _player.Capt.LanguageChanged += new EventHandler(Capt_LanguageChanged); _player.Capt.SettingsChanged += new EventHandler(Capt_SettingsChanged); InitBars(); InitLangs(); wpRounds.Children.Clear(); for (int i = 1; i <= _tournamentView.NumberOfRounds; i++) { var ctl = new CheckBox() { Content = Tour.ToRoman(i) }; ctl.IsChecked = _player.NotPlayingInRound.FindIndex(round => round == i) == -1; ctl.Margin = new Thickness(2, 2, 10, 2); wpRounds.Children.Add(ctl); } //Team combobox var items = new List <string>(); items.Clear(); foreach (var item in _tournamentView.Players) { bool found = false; for (int i = 0; i < items.Count; i++) { if (items[i] != null && items[i].ToString() == item.Team) { found = true; break; } } if (!found) { items.Add(item.Team); } } items.Sort(); string s = _player.Team; cmbTeam.Items.Clear(); foreach (var item in items) { cmbTeam.Items.Add(item); } _player.Team = s; cmbTeam.Text = _player.Team; //Coach combobox items = new List <string>(); items.Clear(); foreach (var item in _tournamentView.Players) { bool found = false; for (int i = 0; i < items.Count; i++) { if (items[i] != null && items[i].ToString() == item.Coach) { found = true; break; } } if (!found) { items.Add(item.Coach); } } items.Sort(); s = _player.Coach; cmbCoach.Items.Clear(); foreach (var item in items) { cmbCoach.Items.Add(item); } _player.Coach = s; cmbCoach.Text = _player.Coach; //Additional buttons btnPrev.DataContext = _tournamentView; btnNext.DataContext = _tournamentView; //Local Players Database support UpdateSurnameCombo(); txtStartNumber_TextChanged(null, null); //Restore club that was changed on several event handlers new Thread(delegate() { Thread.CurrentThread.IsBackground = true; this.Dispatcher.BeginInvoke(new MethodInvoker(delegate { _player.Club = clubName; SelectClub(clubName); })); }).Start(); }