/// <summary>Constructor</summary> internal Tag(Bentley.MicroStation.AddIn addIn, TaggingMode oTagmode) { m_addIn = addIn; m_tagmode = oTagmode; InitializeComponent(); //WS: the schema file must reside the same location with this Addin .dll string strAssemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string strSchemaPath = Path.Combine(strAssemblyFolder, "JansenGeoTags.01.00.ecschema.xml"); oECAdaptor = new ECAdaptor(); //WS: check if Geotag schema is in the dgn; if not, load it. if (!oECAdaptor.SchemaLoadedInModel("JansenGeoTags.01.00")) { if (!LoadECSchema(strSchemaPath)) { MessageBox.Show("Failed importing GeoTag Schema."); return; } } string severName = "azrhbjvsqlprd01.hbjv.local"; string TagDBName = "BHPB_STRTagDB"; string connectionString = "Data Source=" + severName + ";Initial Catalog=" + TagDBName + ";Integrated Security=SSPI;"; sqlConnection = new SqlConnection(connectionString); //WS: check functioin code list, if (AddInMain.oListFunctionCode != null) { LoadCmbboxFromList(cmbFunCode, AddInMain.oListFunctionCode); } else { AddInMain.oListFunctionCode = new List <string>(); if (!LoadcmbFuncodeFromDB(cmbFunCode, sqlConnection, ref AddInMain.oListFunctionCode)) { MessageBox.Show("Failed to load Function Code from DB."); return; } } //WS: load FBS from ProjectWise. "210536" is the "FBS" folder id, which is at "Standards - Site/Attribute Lookup List/FBS" if (!LoadcmbFBS(cmbUnit, 210536, AddInMain.ComApp.ActiveDesignFile.FullName)) { MessageBox.Show("Failed to load FBS."); return; } }
/// <summary> /// Show the form if it is not already displayed /// </summary> internal static void ShowForm(Bentley.MicroStation.AddIn addIn, TaggingMode oTagmode) { //WS: if the form is opened, close it first and then re-open based on tagging mode. if (null != s_current) { s_current.m_windowContent.Close(); s_current = null; } s_current = new Tag(addIn, oTagmode); s_current.AttachAsTopLevelForm(addIn, true); s_current.AutoOpen = true; //WS: seems not appropriate here //s_current.AutoOpenKeyin = "mdl load GeoTag"; s_current.NETDockable = true; if (oTagmode == TaggingMode.ApplyNewTag) { s_current.cmbUnit.Enabled = true; s_current.cmbFunCode.Enabled = true; s_current.btnApply.Visible = true; s_current.btnRefresh.Visible = true; s_current.lblNextNewTag.Text = "Next New Tag"; s_current.lblTagValue.Text = "<New Tag>"; s_current.btnSelect.Visible = false; s_current.btnEdit.Visible = false; s_current.btnDrop.Visible = false; s_current.lblApplyOld.Visible = false; s_current.lblDrop.Visible = false; s_current.lblSelect.Visible = false; } if (oTagmode == TaggingMode.EditOldTag) { s_current.cmbUnit.Enabled = false; s_current.cmbFunCode.Enabled = false; s_current.btnApply.Visible = false; s_current.btnRefresh.Visible = false; s_current.lblNextNewTag.Text = "Existing Tag"; s_current.lblTagValue.Text = "<Old Tag>"; s_current.btnSelect.Visible = true; s_current.btnEdit.Visible = true; s_current.btnDrop.Visible = true; s_current.lblApplyOld.Visible = true; s_current.lblDrop.Visible = true; s_current.lblSelect.Visible = true; } BWW windowManager = BWW.GetForMicroStation(); s_current.m_windowContent = windowManager.DockPanel(s_current, s_current.Name, s_current.Name, Bentley.Windowing.DockLocation.Floating); s_current.m_windowContent.CanDockHorizontally = false; // limit to left and right docking }