/// <summary> /// Class constructor /// </summary> /// <param name="dataList">Datalist to work with</param> /// <param name="editedInterval">Edited interval category</param> /// <param name="rm">resource manager</param> public EditExistingInterval(FerdaSmartDataList dataList, Category editedInterval, ResourceManager rm) : base(dataList, rm) { this.datalist = dataList; this.interval = new Category(); this.interval.CatType = CategoryType.Interval; this.interval.Name = editedInterval.Name; this.interval.Frequency = editedInterval.Frequency; foreach (Interval inter in editedInterval.GetIntervals()) { this.interval.AddInterval(inter); } this.currentCategory = editedInterval; this.index = datalist.GetIndex(this.currentCategory); this.TextBoxCategoryName.Text = editedInterval.Name; Interval tempInterval = (Interval)editedInterval.GetIntervals()[0]; switch (tempInterval.intervalType) { case IntervalType.Long: this.TextBoxLeftBound.Text = tempInterval.lowerBound.ToString(); this.TextBoxRightBound.Text = tempInterval.upperBound.ToString(); break; case IntervalType.Float: this.TextBoxLeftBound.Text = tempInterval.lowerBoundFl.ToString(); this.TextBoxRightBound.Text = tempInterval.upperBoundFl.ToString(); break; default: throw new Exception("Switch branch not implemented"); } foreach (Interval inter in editedInterval.GetIntervals()) { this.ListBoxIntervals.Items.Add(inter.ToString()); if (this.ListBoxIntervals.Items.Count > 0) { this.ListBoxIntervals.SelectedIndex = 0; } } this.CheckIntervalTypesConsistency(); this.ButtonCancel.Click -= new System.EventHandler(this.CancelButton_Click); this.ButtonCancel.Click += new System.EventHandler(this.ButtonNewCancel_Click); //initialiazing controls according to the interval if (tempInterval.lowerBoundType == IntervalBoundType.Infinity) { this.RadioMinusInfinity.Checked = true; } else { if (tempInterval.lowerBoundType == IntervalBoundType.Round) { this.RadioLeftBoundRound.Checked = true; } else { this.RadioLeftBoundSharp.Checked = true; } } if (tempInterval.upperBoundType == IntervalBoundType.Infinity) { this.RadioPlusInfinity.Checked = true; } else { if (tempInterval.upperBoundType == IntervalBoundType.Round) { this.RadioRightBoundRound.Checked = true; } else { this.RadioRightBoundSharp.Checked = true; } } this.datalist.RemoveCategory(index); InitializeComponent(); }