Exemplo n.º 1
0
 private void BindMatches()
 {
     this.dgMatches.DataSource = (object)TournMatchArray.GetDataTable(this.Matches, false, this.Tournament.TableOffset, this.Tournament.Players);
     this.dgMatches.Columns["MatchObject"].Visible     = false;
     this.dgMatches.Columns["Player 1 Object"].Visible = false;
     this.dgMatches.Columns["Player 2 Object"].Visible = false;
     this.dgMatches.Columns["Result"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
     foreach (DataGridViewRow row in (IEnumerable)this.dgMatches.Rows)
     {
         if (row.Cells["MatchObject"].Value != null)
         {
             ITournMatch tournMatch = (ITournMatch)row.Cells["MatchObject"].Value;
             row.Cells["Result"].Value = (object)tournMatch.StatusText;
         }
     }
 }
Exemplo n.º 2
0
 private ITournMatchArray GetMatches()
 {
     if (this.rdoAllMatches.Checked)
     {
         ITournMatchArray byRound         = this.TargetTournament.Matches.GetByRound(this.Round);
         ITournMatchArray tournMatchArray = (ITournMatchArray) new TournMatchArray();
         foreach (ITournMatch match in (IEnumerable <ITournMatch>)byRound)
         {
             if (match.Players.FindById(Player.BYE_ID) == null)
             {
                 tournMatchArray.AddMatch(match);
             }
         }
         return(tournMatchArray);
     }
     try
     {
         TournMatchArray tournMatchArray = new TournMatchArray();
         char[]          separator       = new char[1] {
             '-'
         };
         string[] strArray1 = this.txtSpecificMatches.Text.Split(new char[1]
         {
             ','
         }, StringSplitOptions.RemoveEmptyEntries);
         if (strArray1.Length == 0)
         {
             return((ITournMatchArray)tournMatchArray);
         }
         foreach (string str in strArray1)
         {
             string[] strArray2 = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);
             if (strArray2.Length != 0)
             {
                 int result1 = 0;
                 int result2 = 0;
                 if (!int.TryParse(strArray2[0], out result1))
                 {
                     throw new Exception("Invalid print range");
                 }
                 if (strArray2.Length >= 2)
                 {
                     int.TryParse(strArray2[1], out result2);
                 }
                 int table = result1;
                 do
                 {
                     ITournMatch byRoundTable = this.TargetTournament.Matches.GetByRoundTable(this.Round, table);
                     if (byRoundTable != null)
                     {
                         tournMatchArray.AddMatch(byRoundTable);
                     }
                     ++table;
                 }while (table <= result2);
             }
         }
         return((ITournMatchArray)tournMatchArray);
     }
     catch (Exception ex)
     {
     }
     return((ITournMatchArray) new TournMatchArray());
 }