public void Add(Seat seat) { Array.Resize(ref _table, _table.Length + 1); _table[_length] = seat; _length += 1; Sort(_table); }
public MainForm() { StartMenu menu = new StartMenu(); menu.ShowDialog(); InitializeComponent(); #region Создаение мест за столом _seat0 = new Seat(LabelBox0, LabelSeat0FirstCard, LabelSeat0SecondCard, LabelSeat0BU, labelSeat0BetBox, 0); _seat1 = new Seat(LabelBox1, LabelSeat1FirstCard, LabelSeat1SecondCard, LabelSeat1BU, labelSeat1BetBox, 1); _seat2 = new Seat(LabelBox2, LabelSeat2FirstCard, LabelSeat2SecondCard, LabelSeat2BU, labelSeat2BetBox, 2); _seat3 = new Seat(LabelBox3, LabelSeat3FirstCard, LabelSeat3SecondCard, LabelSeat3BU, labelSeat3BetBox, 3); _seat4 = new Seat(LabelBox4, LabelSeat4FirstCard, LabelSeat4SecondCard, LabelSeat4BU, labelSeat4BetBox, 4); _seat5 = new Seat(LabelBox5, LabelSeat5FirstCard, LabelSeat5SecondCard, LabelSeat5BU, labelSeat5BetBox, 5); _seat6 = new Seat(LabelBox6, LabelSeat6FirstCard, LabelSeat6SecondCard, LabelSeat6BU, labelSeat6BetBox, 6); _seat7 = new Seat(LabelBox7, LabelSeat7FirstCard, LabelSeat7SecondCard, LabelSeat7BU, labelSeat7BetBox, 7); _seat8 = new Seat(LabelBox8, LabelSeat8FirstCard, LabelSeat8SecondCard, LabelSeat8BU, labelSeat8BetBox, 8); _table = new Table(_seat0, _seat1, _seat2, _seat3, _seat4, _seat5, _seat6, _seat7, _seat8, ButtonFold, ButtonCall, ButtonRaise); #endregion }
public Table(Seat first, Seat second, Seat third, Seat fourth, Seat fifth, Seat sixth, Seat seventh, Seat eighth, Seat nineth, Button fold, Button call, Button raise) { _allSeats[0] = first; _allSeats[1] = second; _allSeats[2] = third; _allSeats[3] = fourth; _allSeats[4] = fifth; _allSeats[5] = sixth; _allSeats[6] = seventh; _allSeats[7] = eighth; _allSeats[8] = nineth; _buttonFold = fold; _buttonCall = call; _buttonRaise = raise; ReadFromFile(); DeffineConstructersStartIndex(); RunConstructerMode(); }
private void PostBlinds(Seat[] table) { for (int i = 0; i < table.Length; i++) { if (table[i].Button.Visible = true) { if (i == table.Length - 2) { table[i + 1].BetBox.Visible = true; table[i + 1].BetBox.Text = "0.5"; table[0].BetBox.Visible = true; table[0].BetBox.Text = "1"; } else if (i == table.Length - 1) { table[0].BetBox.Visible = true; table[0].BetBox.Text = "0.5"; table[1].BetBox.Visible = true; table[1].BetBox.Text = "1"; } else { table[i + 1].BetBox.Visible = true; table[i + 1].BetBox.Text = "0.5"; table[i + 2].BetBox.Visible = true; table[i + 2].BetBox.Text = "1"; } } } }
private void Sort(Seat[] table) { Seat[] swap = new Seat[1]; for (int i = 1; i < table.Length; i++) { var j = i; while (j > 0 && table[j].Index < table[j - 1].Index) { swap[0] = table[j]; table[j] = table[j - 1]; table[j - 1] = swap[0]; j--; } } }
public void Remove(int index) { Seat[] temp = new Seat[0]; for (int i = 0, j = 0; i < _table.Length; i++) { if (_table[i].IsFolded != true) { Array.Resize(ref temp, temp.Length + 1); temp[j] = _table[i]; j++; } } _table = new Seat[temp.Length]; for (int i = 0; i < temp.Length; i++) { _table[i] = temp[i]; } _length = _table.Length; }