protected override void OnRowsDeleted(object sender, DataSheetRowEventArgs e) { base.OnRowsDeleted(sender, e); this.SyncronizeFilterCriteria(sender); this.GetFlowDiagram().RefreshDiagram(); }
protected override void OnRowsAdded(object sender, DataSheetRowEventArgs e) { base.OnRowsAdded(sender, e); this.m_AllowRowChangeEvents = false; DataTable dt = this.GetData(); Dictionary <string, bool> d = CreateExistingNamesDictionary(dt); foreach (DataRow dr in dt.Rows) { if (dr.RowState == DataRowState.Deleted) { continue; } if (dr[Strings.DATASHEET_NAME_COLUMN_NAME] == DBNull.Value) { string slxname = this.GetSlxName(dr); string slyname = this.GetSlyName(dr); string n = GetNextName(slxname + ":" + slyname, d); dr[Strings.DATASHEET_NAME_COLUMN_NAME] = n; dr[Strings.DATASHEET_IS_AUTO_NAME_COLUMN_NAME] = Booleans.BoolToInt(true); d.Add(n, true); } } this.m_AllowRowChangeEvents = true; }
protected override void OnRowsDeleted(object sender, DataSheetRowEventArgs e) { base.OnRowsDeleted(sender, e); if (this.ShouldEnableView()) { this.EnableControls(); } }
protected override void OnRowsAdded(object sender, DataSheetRowEventArgs e) { Dictionary <int, string> AutoGroups = new Dictionary <int, string>(); Dictionary <int, int> AutoTypeGroups = new Dictionary <int, int>(); string IdColName = this.PrimaryKeyColumn.Name; using (DataStore store = this.Library.CreateDataStore()) { foreach (DataRow dr in this.m_TTData.Rows) { if (dr.RowState != DataRowState.Added) { continue; } int ThisId = Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture); string AutoGroupName = GetAutoGeneratedGroupName(dr); if (this.m_TGDataSheet.ValidationTable.ContainsValue(AutoGroupName)) { continue; } int AutoGroupId = Library.GetNextSequenceId(store); AutoGroups.Add(AutoGroupId, AutoGroupName); AutoTypeGroups.Add(ThisId, AutoGroupId); } } Debug.Assert(AutoTypeGroups.Count == AutoGroups.Count); if (AutoGroups.Count > 0) { this.m_TGDataSheet.BeginAddRows(); this.m_TTGDataSheet.BeginAddRows(); foreach (int gid in AutoGroups.Keys) { this.CreateTransitionGroup(gid, AutoGroups[gid]); } using (DataStore store = this.Library.CreateDataStore()) { foreach (int tid in AutoTypeGroups.Keys) { this.CreateTransitionTypeGroup(tid, AutoTypeGroups[tid]); } } this.m_TGDataSheet.EndAddRows(); this.m_TTGDataSheet.EndAddRows(); } base.OnRowsAdded(sender, e); }
protected override void OnRowsDeleted(object sender, DataSheetRowEventArgs e) { base.OnRowsDeleted(sender, e); if (this.GetData().DefaultView.Count == 0) { DataSheet PropsDataSheet = this.GetDataSheet(Strings.DATASHEET_SPPIC_NAME); PropsDataSheet.GetData(); PropsDataSheet.ClearData(); } }
protected override void OnRowsAdded(object sender, DataSheetRowEventArgs e) { base.OnRowsAdded(sender, e); var ThisData = this.GetData(); DataSheet dsProp = this.GetDataSheet(Strings.DATASHEET_SPPIC_NAME); DataRow drProp = dsProp.GetDataRow(); if (drProp == null && ThisData.DefaultView.Count > 0) { dsProp.BeginAddRows(); drProp = dsProp.GetData().NewRow(); DataRow FirstRow = ThisData.DefaultView[0].Row; StochasticTimeRaster FirstRast = this.LoadRaster(FirstRow, Strings.DATASHEET_SPIC_STRATUM_FILE_COLUMN_NAME); if (FirstRast.IntCells == null) { FirstRast.LoadData(); } drProp[Strings.DATASHEET_SPPIC_NUM_ROWS_COLUMN_NAME] = FirstRast.Height; drProp[Strings.DATASHEET_SPPIC_NUM_COLUMNS_COLUMN_NAME] = FirstRast.Width; drProp[Strings.DATASHEET_SPPIC_NUM_CELLS_COLUMN_NAME] = FirstRast.GetNumberValidCells(); drProp[Strings.DATASHEET_SPPIC_XLLCORNER_COLUMN_NAME] = FirstRast.XllCorner; drProp[Strings.DATASHEET_SPPIC_YLLCORNER_COLUMN_NAME] = FirstRast.YllCorner; drProp[Strings.DATASHEET_SPPIC_CELL_SIZE_COLUMN_NAME] = FirstRast.CellSize; drProp[Strings.DATASHEET_SPPIC_CELL_SIZE_UNITS_COLUMN_NAME] = FirstRast.CellSizeUnits; drProp[Strings.DATASHEET_SPPIC_SRS_COLUMN_NAME] = FirstRast.Projection; drProp[Strings.DATASHEET_SPPIC_CELL_AREA_OVERRIDE_COLUMN_NAME] = false; string amountlabel = null; TerminologyUnit destUnitsVal = 0; double cellArea = System.Math.Pow((double)FirstRast.CellSize, 2); TerminologyUtilities.GetAmountLabelTerminology(this.Project.GetDataSheet(Strings.DATASHEET_TERMINOLOGY_NAME), ref amountlabel, ref destUnitsVal); drProp[Strings.DATASHEET_SPPIC_CELL_AREA_COLUMN_NAME] = CalcCellArea(cellArea, FirstRast.CellSizeUnits, destUnitsVal); dsProp.Changes.Add(new ChangeRecord(this, "Added raster metadata")); dsProp.GetData().Rows.Add(drProp); dsProp.EndAddRows(); } }
protected override void OnModifyingRows(object sender, DataSheetRowEventArgs e) { this.m_PrevNames.Clear(); string IdColName = this.PrimaryKeyColumn.Name; foreach (DataRow dr in this.m_TTData.Rows) { if (dr.RowState == DataRowState.Deleted) { continue; } int TypeId = Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture); string TypeName = Convert.ToString(dr[Strings.DATASHEET_NAME_COLUMN_NAME, DataRowVersion.Current], CultureInfo.InvariantCulture); this.m_PrevNames.Add(TypeId, TypeName); } base.OnModifyingRows(sender, e); }
protected override void OnRowsModified(object sender, DataSheetRowEventArgs e) { base.OnRowsModified(sender, e); DTAnalyzer Analyzer = new DTAnalyzer(this.GetData(), this.Project); if (this.ResolveDeterministicTransitions(Analyzer)) { this.Changes.Add(new ChangeRecord(this, "DT OnRowsModified Modified DT Rows")); } if (this.ResolveProbabilisticTransitions(Analyzer)) { this.GetDataSheet(Strings.DATASHEET_PT_NAME).Changes.Add(new ChangeRecord(this, "DT OnRowsModified Deleted PT Rows")); } #if DEBUG this.VALIDATE_DETERMINISTIC_TRANSITIONS(); this.VALIDATE_PROBABILISTIC_TRANSITIONS(); #endif }
protected override void OnRowsModified(object sender, DataSheetRowEventArgs e) { base.OnRowsModified(sender, e); this.GetFlowDiagram().RefreshDiagram(); }
private void OnTTGRowsAdded(object sender, DataSheetRowEventArgs e) { if (this.m_InTTGRowsAdded) { return; } this.m_InTTGRowsAdded = true; Dictionary <string, bool> MissingTypeGroups = new Dictionary <string, bool>(); Dictionary <string, bool> ExistingTypeGroups = CreateTTG_ID_Dictionary(); string IdColName = this.PrimaryKeyColumn.Name; using (DataStore store = this.Library.CreateDataStore()) { foreach (DataRow dr in this.m_TTData.Rows) { if (dr.RowState == DataRowState.Deleted) { continue; } string AutoGroupName = GetAutoGeneratedGroupName(dr); if (!this.m_TGDataSheet.ValidationTable.ContainsValue(AutoGroupName)) { Debug.Assert(false); continue; } int ttid = Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture); var tgid = this.m_TGDataSheet.ValidationTable.GetValue(AutoGroupName); var Key = Create_TT_TG_Key(ttid, tgid); if (ExistingTypeGroups.ContainsKey(Key)) { continue; } Debug.Assert(!MissingTypeGroups.ContainsKey(Key)); if (!MissingTypeGroups.ContainsKey(Key)) { MissingTypeGroups.Add(Key, true); } } if (MissingTypeGroups.Count > 0) { this.m_TTGDataSheet.BeginAddRows(); foreach (string Key in MissingTypeGroups.Keys) { string[] s = Key.Split('-'); this.CreateTransitionTypeGroup( int.Parse(s[0], CultureInfo.InvariantCulture), int.Parse(s[1], CultureInfo.InvariantCulture)); } this.m_TTGDataSheet.EndAddRows(); } } this.m_InTTGRowsAdded = false; }
protected override void OnRowsModified(object sender, DataSheetRowEventArgs e) { List <DataRow> ModifyRows = new List <DataRow>(); string IdColName = this.PrimaryKeyColumn.Name; Dictionary <string, DataRow> GroupRows = this.CreateTGRowDictionary(); Dictionary <string, bool> ExistingNames = new Dictionary <string, bool>(); foreach (string k in GroupRows.Keys) { ExistingNames.Add(k, true); } foreach (DataRow dr in this.m_TTData.Rows) { if (dr.RowState == DataRowState.Deleted) { continue; } int id = Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture); if (!this.m_PrevNames.ContainsKey(id)) { continue; } string OldName = this.m_PrevNames[id]; string OldAutoGroupName = GetAutoGeneratedGroupName(OldName); if (!GroupRows.ContainsKey(OldAutoGroupName)) { continue; } string NewName = Convert.ToString(dr[Strings.DATASHEET_NAME_COLUMN_NAME], CultureInfo.InvariantCulture); Debug.Assert(DataTableUtilities.GetDataBool(GroupRows[OldAutoGroupName], Strings.IS_AUTO_COLUMN_NAME)); if (OldName != NewName) { ModifyRows.Add(dr); } } if (ModifyRows.Count > 0) { this.m_TGDataSheet.BeginModifyRows(); foreach (DataRow dr in ModifyRows) { string OldName = this.m_PrevNames[Convert.ToInt32(dr[IdColName], CultureInfo.InvariantCulture)]; string NewName = Convert.ToString(dr[Strings.DATASHEET_NAME_COLUMN_NAME], CultureInfo.InvariantCulture); Debug.Assert(OldName != NewName); Debug.Assert(!GroupRows.ContainsKey(GetAutoGeneratedGroupName(NewName))); string OldAutoGroupName = GetAutoGeneratedGroupName(OldName); string NewAutoGroupName = GetAutoGeneratedGroupName(NewName); GroupRows[OldAutoGroupName][Strings.DATASHEET_NAME_COLUMN_NAME] = NewAutoGroupName; } this.m_TGDataSheet.EndModifyRows(); } base.OnRowsModified(sender, e); }
protected override void OnRowsModified(object sender, DataSheetRowEventArgs e) { base.OnRowsModified(sender, e); ChartingUtilities.SetTSTClassUpdateTag(this.Project); }