Esempio n. 1
0
 public RoundControl(int round)
 {
     InitializeComponent();
     this.round = round;
     ColumnSorter.InitListView(lvPrepare);
     ColumnSorter.InitListView(lvParty);
     Observer.Instance.Add(this);
 }
Esempio n. 2
0
        private void TieTable_Load(object sender, EventArgs e)
        {
            List <Member>        list  = MainForm.Instance.Manager.QueryMember("");
            List <History>       list2 = MainForm.Instance.Manager.QueryHistory("");
            SwissTournamentRound round = new SwissTournamentRound();
            int index = 0;

            while (true)
            {
                if (index >= list2.Count)
                {
                    foreach (Member member in list)
                    {
                        round.InsertPlayer(member.Id);
                    }
                    foreach (History history in list2)
                    {
                        round.InsertRoundResult(history.Player1, history.Player2, history.Status, this.round);
                    }
                    round.Sort();
                    Dictionary <int, Tuple <int, int, int, int> > tScore = round.GetTScore();
                    round.rank.ForEach(r =>
                    {
                        string[] items = new string[] { (r.Value + 1).ToString(), (from x in list
                                                                                   where x.Id == r.Key
                                                                                   select x).First <Member>().Name, r.Key.ToString(), tScore[r.Key].Item1.ToString(), tScore[r.Key].Item2.ToString(), tScore[r.Key].Item3.ToString(), tScore[r.Key].Item4.ToString() };
                        this.lvTTable.Items.Add(new ListViewItem(items));
                    });
                    //using (List<KeyValuePair<int, int>>.Enumerator enumerator3 = round.rank.GetEnumerator())
                    //{
                    //    while (enumerator3.MoveNext())
                    //    {
                    //        KeyValuePair<int, int> r;
                    //        string[] items = new string[] { (r.Value + 1).ToString(), (from x in list
                    //            where x.Id == r.Key
                    //            select x).First<Member>().Name, r.Key.ToString(), tScore[r.Key].Item1.ToString(), tScore[r.Key].Item2.ToString(), tScore[r.Key].Item3.ToString(), tScore[r.Key].Item4.ToString() };
                    //        this.lvTTable.Items.Add(new ListViewItem(items));
                    //    }
                    //}
                    ColumnSorter.InitListView(this.lvTTable);
                    return;
                }
                if (list2[index].Round > this.round)
                {
                    index--;
                    list2.RemoveAt(index);
                }
                index++;
            }
        }
Esempio n. 3
0
                public int Compare(object x, object y)
                {
                    int num;

                    if ((x == null) | (y == null))
                    {
                        num = 0;
                    }
                    else
                    {
                        ColumnSorter.SortWrapper wrapper  = (ColumnSorter.SortWrapper)x;
                        ColumnSorter.SortWrapper wrapper2 = (ColumnSorter.SortWrapper)y;
                        num = ColumnSorter.ComparePath(wrapper.sortItem.SubItems[wrapper.sortColumn].Text, wrapper2.sortItem.SubItems[wrapper2.sortColumn].Text) * (this.ascending ? 1 : -1);
                    }
                    return(num);
                }
Esempio n. 4
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     ColumnSorter.InitListView(lvParty);
 }
Esempio n. 5
0
 private void StartForm_Load(object sender, EventArgs e)
 {
     this.refresh();
     ColumnSorter.InitListView(this.lvFiles);
 }