public TimeSeriesPropertiesDialog(BaseTimeSeries timeSeriesData) { this.timeSeriesData = timeSeriesData; InitializeComponent(); this.tabControl1.TabPages["tabPageGeneral"].Controls["TextBoxID"].Text = timeSeriesData.Name; this.tabControl1.TabPages["tabPageGeneral"].Controls["textBoxDescription"].Text = timeSeriesData.Description; this.tabControl1.TabPages["unitTabPage"].Controls["unitIDTextBox"].Text = timeSeriesData.Unit.ID; this.tabControl1.TabPages["unitTabPage"].Controls["UnitDescriptionTextBox"].Text = timeSeriesData.Unit.Description; this.tabControl1.TabPages["unitTabPage"].Controls["ConcersionToSITextBox"].Text = timeSeriesData.Unit.ConversionFactorToSI.ToString(); this.tabControl1.TabPages["unitTabPage"].Controls["offSetToSITextBox"].Text = timeSeriesData.Unit.OffSetToSI.ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["DimensionLengthComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.Length).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["DimensionMassComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.Mass).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["DimensionTimeComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.Time).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["dimensionElectricCurrentComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.ElectricCurrent).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["DimensionTemeratureComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.Temperature).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["DimensionAmountOfSubstanceComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.AmountOfSubstance).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["LuminousIntensityComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.LuminousIntensity).ToString(); this.tabControl1.TabPages["dimensionTabPage"].Controls["DimensionCurrencyComboBox"].Text = timeSeriesData.Unit.Dimension.GetPower(DimensionBase.Currency).ToString(); //if (this.timeSeriesData.TimeSeriesType == TimeSeriesType.TimeStampBased) //{ // ((RadioButton)this.tabControl1.TabPages["tabPageGeneral"].Controls["radioButtonIsTimeStamp"]).Checked = true; // ((RadioButton)this.tabControl1.TabPages["tabPageGeneral"].Controls["radioButtonIsTimeSpan"]).Checked = false; //} //else //{ // ((RadioButton)this.tabControl1.TabPages["tabPageGeneral"].Controls["radioButtonIsTimeStamp"]).Checked = false; // ((RadioButton)this.tabControl1.TabPages["tabPageGeneral"].Controls["radioButtonIsTimeSpan"]).Checked = true; //} }
private void buttonOK_Click(object sender, EventArgs e) { DateTime dp = this.dateTimePicker1.Value; DateTime start = new DateTime(dp.Year, dp.Month, dp.Day, dp.Hour, dp.Minute, dp.Second); string name = this.IdTextBox.Text; int timeStepLength = Convert.ToInt32(this.textBoxTimeStepLength.Text); int numberOfTimesteps = Convert.ToInt32(this.textBoxNumberOfTimeSteps.Text); double defaultValue = Convert.ToDouble(this.DefaultValueTextBox.Text); TimestepUnit timeStepUnit = new TimestepUnit(); if (this.comboBoxTimeStepLength.Text == "Years") { timeStepUnit = TimestepUnit.Years; } else if (this.comboBoxTimeStepLength.Text == "Months") { timeStepUnit = TimestepUnit.Months; } else if (this.comboBoxTimeStepLength.Text == "Days") { timeStepUnit = TimestepUnit.Days; } else if (this.comboBoxTimeStepLength.Text == "Hours") { timeStepUnit = TimestepUnit.Hours; } else if (this.comboBoxTimeStepLength.Text == "Minutes") { timeStepUnit = TimestepUnit.Minutes; } else if (this.comboBoxTimeStepLength.Text == "Seconds") { timeStepUnit = TimestepUnit.Seconds; } else { throw new System.Exception("invalid timestep length unit"); } if (this.timestampBasedRadioButton.Checked) { timeSeries = new TimestampSeries(name, start, numberOfTimesteps, timeStepLength, timeStepUnit, defaultValue); } else if (this.timespanBasedRadioButton.Checked) { timeSeries = new TimespanSeries(name, start, numberOfTimesteps, timeStepLength, timeStepUnit, defaultValue); } else { throw new Exception("Unexpected exception in TimeSeriesCreationDialog"); } this.Close(); }
private void OkButton_Click(object sender, EventArgs e) { selectedTimeSeries = timeSeriesGroup.Items[itemSelectionComboBox.SelectedIndex]; Close(); }
public SinkSourceBoundary(BaseTimeSeries ts) : this() { TS = ts; }
private void Summarize(int MaxCount, BaseTimeSeries bts) { TimespanSeries tspan = bts as TimespanSeries; TimestampSeries tstam = bts as TimestampSeries; if (tspan != null) { if (tspan.Items.Count > MaxCount) { List<TimespanValue> temp = new List<TimespanValue>(); DateTime Start = tspan.Items.First().StartTime; DateTime End = tspan.Items.Last().EndTime; double periodDays = End.Subtract(Start).TotalDays / MaxCount; for (int i = 0; i < MaxCount; i++) { TimespanValue TValue = new TimespanValue(Start.AddDays(i * periodDays), Start.AddDays((i + 1) * periodDays), 0); TValue.Value = tspan.GetValue(TValue.StartTime, TValue.EndTime); temp.Add(TValue); } tspan.Items.Clear(); foreach (var v in temp) tspan.Items.Add(v); } } if (tstam != null) { if (tstam.Items.Count > MaxCount) { List<TimestampValue> temp = new List<TimestampValue>(); DateTime Start = tstam.Items.First().Time; DateTime End = tstam.Items.Last().Time; double periodDays = End.Subtract(Start).TotalDays / MaxCount; for (int i = 0; i < MaxCount; i++) { TimestampValue TValue = new TimestampValue(Start.AddDays(i * periodDays), 0); TValue.Value = tstam.GetValue(TValue.Time); temp.Add(TValue); } tstam.Items.Clear(); foreach (var v in temp) tstam.Items.Add(v); } } }