private void ThreeDimLayerBtn_Click(object sender, RoutedEventArgs e) { DGObjectsDefinition DObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition; if (DObjsDef == null) { return; } if (_u3dLayer == null) { PromptTB.Text = "Click the button again until the 3D model is loaded."; Preview3DLayerBtn_Click(this, null); return; } Select3DEMapLayersWindow select3DEMapLayersWnd = new Select3DEMapLayersWindow(_u3dLayer); select3DEMapLayersWnd.Owner = this; select3DEMapLayersWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; bool?ok = select3DEMapLayersWnd.ShowDialog(); if (ok != null && ok.Value == true) { if (select3DEMapLayersWnd.SelectLayerName != null) { Layer3DNameTB.Text = select3DEMapLayersWnd.SelectLayerName; DObjsDef.Layer3DName = select3DEMapLayersWnd.SelectLayerName; } } }
public bool LoadSecondlining(DGObjects objs) { DGObjectsDefinition def = objs.definition; if (def == null) { return(false); } bool success = _dbLoader.ReadSecondlining(objs, def.TableNameSQL, def.ConditionSQL, def.OrderSQL); return(success); }
// Summary: // Re-read monitoring point. // This is usually for loading all the monitoring records. // public bool ReloadMonPoints(DGObjects objs, string conditionSQL) { DGObjectsDefinition def = objs.definition; if (def == null) { return(false); } bool success = _dbLoader.RereadMonPoints(objs, def.TableNameSQL, conditionSQL, def.OrderSQL); return(success); }
private void DObjsLB_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Check if this is triggered by clearing event if (DObjsLB.ItemsSource == null) { DObjsDefGrid.DataContext = null; return; } KeyValuePair <string, DGObjectsDefinition> item = (KeyValuePair <string, DGObjectsDefinition>)DObjsLB.SelectedItem; DGObjectsDefinition DObjsDef = item.Value; DObjsDefGrid.DataContext = DObjsDef; }
private void PreviewTableBtn_Click(object sender, RoutedEventArgs e) { string dbFile = _prjDef.LocalFilePath + "\\" + _prjDef.LocalDatabaseName; DGObjectsDefinition dObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition; if (dObjsDef == null) { return; } DataSet dataSet = DbHelper.LoadTable(dbFile, dObjsDef.TableNameSQL, dObjsDef.ConditionSQL, dObjsDef.OrderSQL); PreviewTableWindow previewTblWnd = new PreviewTableWindow(TableNameTB.Text, dataSet); previewTblWnd.Owner = this.Owner; previewTblWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; previewTblWnd.Show(); }
// Convert an instance of DGObjecsDefinition class to XElement // public static XElement DGObjDef2XElement(DGObjectsDefinition objDef) { XElement xe = new XElement(objDef.Type); xe.Add(new XAttribute("Name", objDef.Name)); // NOTE: remove "dbo_" prefix of the table name!!! // string tableName = objDef.TableNameSQL.Replace(DbHelper.TablePrefix, ""); xe.Add(new XAttribute("TableNameSQL", tableName)); if (objDef.DefNamesSQL != null) { xe.Add(new XAttribute("DefNamesSQL", objDef.DefNamesSQL)); } if (objDef.ConditionSQL != null) { xe.Add(new XAttribute("ConditionSQL", objDef.ConditionSQL)); } if (objDef.OrderSQL != null) { xe.Add(new XAttribute("OrderSQL", objDef.OrderSQL)); } xe.Add(new XAttribute("HasGeometry", objDef.HasGeometry)); if (objDef.GISLayerName != null) { xe.Add(new XAttribute("GISLayerName", objDef.GISLayerName)); } xe.Add(new XAttribute("Has3D", objDef.Has3D)); if (objDef.Layer3DName != null) { xe.Add(new XAttribute("Layer3DName", objDef.Layer3DName)); } return(xe); }
private void AddDObj_Click(object sender, RoutedEventArgs e) { // In case there is no domain, just return. if (DomainListLB.Items.Count == 0) { return; } Dictionary <string, DGObjectsDefinition> objsDefinitions = DObjsLB.ItemsSource as Dictionary <string, DGObjectsDefinition>; AddDObjWindow addDObjWnd = new AddDObjWindow(objsDefinitions); addDObjWnd.Owner = this; addDObjWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; bool?ok = addDObjWnd.ShowDialog(); if (ok != null && ok.Value == true) { string name = addDObjWnd.DObjName; DGObjectsDefinition dObjDef = new DGObjectsDefinition(); dObjDef.Name = name; objsDefinitions.Add(name, dObjDef); // force update UI int index = DObjsLB.SelectedIndex; DObjsLB.ItemsSource = null; DObjsLB.ItemsSource = objsDefinitions; if (index != -1) { DObjsLB.SelectedIndex = index; } else { DObjsLB.SelectedIndex = 0; } } }
private void TableNameSQLBtn_Click(object sender, RoutedEventArgs e) { DGObjectsDefinition DObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition; if (DObjsDef == null) { return; } string dbFile = _prjDef.LocalFilePath + "\\" + _prjDef.LocalDatabaseName; List <string> names = DbHelper.GetDbTablenames(dbFile); SelectTableNamesWindow selectTableNamesWnd = new SelectTableNamesWindow(names, TableNameTB.Text); selectTableNamesWnd.Owner = this; selectTableNamesWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; bool?ok = selectTableNamesWnd.ShowDialog(); if (ok != null && ok.Value == true) { TableNameTB.Text = selectTableNamesWnd.SelectedName; DObjsDef.TableNameSQL = selectTableNamesWnd.SelectedName; } }
private void TwoDimLayerBtn_Click(object sender, RoutedEventArgs e) { DGObjectsDefinition DObjsDef = DObjsDefGrid.DataContext as DGObjectsDefinition; if (DObjsDef == null) { return; } SelectEMapLayersWindow selectEMapLayersWnd = new SelectEMapLayersWindow(_eMapLayersList); selectEMapLayersWnd.Owner = this; selectEMapLayersWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; bool?ok = selectEMapLayersWnd.ShowDialog(); if (ok != null && ok.Value == true) { if (selectEMapLayersWnd.SelectedLayerName != null) { LayerNameTB.Text = selectEMapLayersWnd.SelectedLayerName; DObjsDef.GISLayerName = selectEMapLayersWnd.SelectedLayerName; } } }