/// <summary> /// Fires the CloseFromNextEvent /// </summary> /// <param name="wiz">Sender</param> public int OnCloseFromNext(Wizard wiz) { //Event args thinks that the next pgae will be the one before this one PageEventArgs e = new PageEventArgs(wiz.PageIndex +1, wiz.Pages); //Tell anybody who listens if (CloseFromNext != null) CloseFromNext(wiz, e); //And then tell whomever called me what the prefered page is return e.PageIndex; }
/// <summary> /// Fires the CloseFromNextEvent /// </summary> /// <param name="wiz">Sender</param> public int OnCloseFromNext(Wizard wiz) { //Event args thinks that the next pgae will be the one before this one PageEventArgs e = new PageEventArgs(wiz.PageIndex + 1, wiz.Pages); //Tell anybody who listens if (CloseFromNext != null) { CloseFromNext(wiz, e); } //And then tell whomever called me what the prefered page is return(e.PageIndex); }
private void wizardPageFinish_CloseFromNext(object sender, PageEventArgs e) { Trace.WriteLine(e.ToString()); Structs.Competition comp = new Structs.Competition(); comp.DoFinalShooting = this.chkDoFinalShooting.Checked; comp.FirstPrice = (int)this.numPriceFirst.Value; comp.Name = this.txtName.Text; if (this.radioFieldStandard.Checked) { comp.Type = Structs.CompetitionTypeEnum.Field; comp.NorwegianCount = false; } else if (this.radioFieldNorwegian.Checked) { comp.Type = Structs.CompetitionTypeEnum.Field; comp.NorwegianCount = true; } else if (this.radioFieldMagnum.Checked) { comp.Type = Structs.CompetitionTypeEnum.MagnumField; comp.NorwegianCount = false; } else if (this.radioBanskytte.Checked) { comp.Type = Structs.CompetitionTypeEnum.Precision; comp.NorwegianCount = false; } switch(comp.Type) { case Structs.CompetitionTypeEnum.Field: { comp.PatrolSize = (int)this.numFieldPatrolSize.Value; comp.PatrolTime = (int)this.numFieldPatrolTime.Value; comp.PatrolTimeBetween = (int)this.numFieldPatrolTimeBetween.Value; comp.PatrolTimeRest = (int)this.numFieldPatrolRestTime.Value; comp.PatrolConnectionType = (Structs.PatrolConnectionTypeEnum) DDFieldPatrolConnectionType.SelectedIndex; break; } case Structs.CompetitionTypeEnum.MagnumField: { comp.PatrolSize = (int)this.numFieldPatrolSize.Value; comp.PatrolTime = (int)this.numFieldPatrolTime.Value; comp.PatrolTimeBetween = (int)this.numFieldPatrolTimeBetween.Value; comp.PatrolTimeRest = (int)this.numFieldPatrolRestTime.Value; comp.PatrolConnectionType = (Structs.PatrolConnectionTypeEnum) DDFieldPatrolConnectionType.SelectedIndex; break; } case Structs.CompetitionTypeEnum.Precision: { comp.PatrolSize = (int)this.numPrecisionPatrolSize.Value; //comp.PatrolTime = (int)this.numPrecisionPatrolTime.Value; comp.PatrolTimeBetween = (int)this.numPrecisionPatrolTimeBetween.Value; comp.PatrolTimeRest = 0; comp.PatrolConnectionType = (Structs.PatrolConnectionTypeEnum) DdPrecisionPatrolConnectionType.SelectedIndex; break; } default: { throw new ApplicationException("Not implemented yet"); } } comp.PriceMoneyPercentToReturn = (int)this.numPriceRepay.Value; comp.PriceMoneyShooterPercent = (int)this.numPriceShooters.Value; comp.ShooterFee1 = (int)this.numPriceDeposit1.Value; comp.ShooterFee2 = (int)this.numPriceDeposit2.Value; comp.ShooterFee3 = (int)this.numPriceDeposit3.Value; comp.ShooterFee4 = (int)this.numPriceDeposit4.Value; DateTime starttime = this.dateTimePickerStart.Value; int hour = int.Parse(this.txtStartTime.Text.Split(':')[0]); int minute = int.Parse(this.txtStartTime.Text.Split(':')[1]); starttime = starttime.AddHours(hour); starttime = starttime.AddMinutes(minute); comp.StartTime = starttime; comp.UsePriceMoney = this.chkPriceMoney.Checked; comp.Championship = (Structs.CompetitionChampionshipEnum) ddChampionshipType.SelectedIndex; if (comp.Championship == Structs.CompetitionChampionshipEnum.Nationell || comp.Championship == Structs.CompetitionChampionshipEnum.SM) comp.OneClass = true; else comp.OneClass = false; CommonCode.NewCompetition(comp); this.EnableMain(); }
private void wizardPagePrecisionPatrol_CloseFromBack(object sender, PageEventArgs e) { e.Page = wizardPageCompetitionType; }
private void wizardPageFieldPatrol_CloseFromNext(object sender, PageEventArgs e) { e.Page = this.wizardPagePriceMoney; }
private void wizardPageCompetitionType_CloseFromNext(object sender, PageEventArgs e) { if (!this.radioBanskytte.Checked & !this.radioFieldStandard.Checked & !this.radioFieldNorwegian.Checked & !this.radioFieldMagnum.Checked) { MessageBox.Show("Du måste välja en typ av tävling", "Val måste göras", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = this.wizardPageCompetitionType; } if (this.radioFieldStandard.Checked | this.radioFieldNorwegian.Checked | this.radioFieldMagnum.Checked) { // Send user to field pages e.Page = this.wizardPageFieldPatrol; } else { // Send user to banskytte pages e.Page = this.wizardPagePrecisionPatrol; } }
private void wizardPageTimeDate_CloseFromNext(object sender, PageEventArgs e) { string timeString = txtStartTime.Text; string[] timeStrings = timeString.Split(':'); if (timeStrings.Length == 1) { MessageBox.Show("Det finns inte något kolon i tiden. Ange tiden på formatet HH:MM.", "Felinmatning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = wizardPageTimeDate; return; } if (timeStrings.Length > 2) { MessageBox.Show("Det finns fler än ett kolon i tiden. Ange tiden på formatet HH:MM.", "Felinmatning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = this.wizardPageTimeDate; return; } if (timeStrings[0].Length > 2 | timeStrings[0].Length < 1) { MessageBox.Show("Ange timmar med en eller två siffror. Ange tiden på formatet HH:MM.", "Felinmatning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = this.wizardPageTimeDate; return; } if (timeStrings[1].Length > 2 | timeStrings[1].Length < 1) { MessageBox.Show("Ange minuter med en eller två siffror. Ange tiden på formatet HH:MM.", "Felinmatning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = this.wizardPageTimeDate; return; } try { int.Parse(timeStrings[0]); } catch(System.FormatException) { MessageBox.Show("Ange timmar med en eller två siffror. Ange tiden på formatet HH:MM.", "Felinmatning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = this.wizardPageTimeDate; return; } try { int.Parse(timeStrings[1]); } catch(System.FormatException) { MessageBox.Show("Ange minuter med en eller två siffror. Ange tiden på formatet HH:MM.", "Felinmatning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); e.Page = this.wizardPageTimeDate; return; } }