public KursState Less(KursState State) { if (State == KursState.forth) { MessageBox.Show("4 курс -> 3 курс"); State = KursState.third; return(State); } else if (State == KursState.third) { MessageBox.Show("3 курс -> 2 курс"); State = KursState.second; return(State); } else if (State == KursState.second) { MessageBox.Show("2 курс -> 1 курс"); State = KursState.first; return(State); } else { return(State); } }
//демонстрация State private void numericUpDown2_ValueChanged(object sender, EventArgs e) { if (numericUpDown2.Value > countKurs) { Kurs k = new Kurs(KState); KState = k.More(KState); countKurs = (int)numericUpDown2.Value; } else { Kurs k = new Kurs(KState); KState = k.Less(KState); countKurs = (int)numericUpDown2.Value; } }
public Kurs(KursState st) { State = st; }