public void NextStage() { int numStages = Stages.Count(); if (numStages == 1) { return; } for (int i = 0; i < numStages; i++) { if (Stages[i].Order == SelectedStage.Order) { if (i == numStages) { SelectedStage = Stages[0]; } else { SelectedStage = Stages[(i + 1) % (numStages)]; } break; } } }
public void PreviousStage() { int numStages = Stages.Count(); if (numStages == 1) { return; } for (int i = 0; i < numStages; i++) { if (Stages[i].Order == SelectedStage.Order) { if (i == 0) { SelectedStage = Stages.Last(); } else { SelectedStage = Stages[(i - 1) % (numStages)]; } break; } } }
public void NewStage() { var stage = new NewConversationStage(); stage.associatedConvo = this; if (Stages.Count() > 0) { stage.txtId.Text = (this.Stages.Select(a => a.StageId).Max() + 10).ToString(); } else { stage.txtId.Text = "10"; } stage.ShowDialog(); if (stage.DialogResult == true) { var res = new ConversationStage(); res.StageId = Convert.ToInt32(stage.txtId.Text); res.StageName = stage.txtFriendlyName.Text; Stages.Add(res); Stages = new ObservableCollection <ConversationStage>(Stages.OrderBy(a => a.StageId)); SelectedStage = res; } }