public void LoadAppropriatedata() { DefaultSetting(); Helper.ClassName = null; storedclasses = AssemblyInspectorObject.Connection.FetchAllStoredClasses(); if (storedclasses != null) { classCount = storedclasses.Count; } //Populate the TreeView dbtreeviewObject.AddFavouritFolderFromDatabase(); dbtreeviewObject.AddTreeNode(storedclasses, null); SelectFirstClassNode(); propertiesTab = PropertiesTab.Instance; if (classCount == 0) { propertiesTab.ShowClassProperties = false; toolStripButtonAssemblyView.Enabled = toolStripButtonFlatView.Enabled = false; } PopulateSearchStrings(); dbtreeviewObject.Focus(); dbtreeviewObject.Refresh(); OMETrace.WriteFunctionEnd(); instance = this; }
/// <summary> /// Event track the selection of the treeview items /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbtreeviewObject_AfterSelect(object sender, TreeViewEventArgs e) { try { dbTreeView dbTreeviewObj = sender as dbTreeView; OMETrace.WriteFunctionStart(); //Set the class name to get the result SetClassName(e.Node); //Refresh Properties Pane for selected class propertiesTab = PropertiesTab.Instance; propertiesTab.ShowObjectPropertiesTab = false; if (classCount == 0 || (dbTreeviewObj.SelectedNode != null && dbTreeviewObj.SelectedNode.Tag != null && (dbTreeviewObj.SelectedNode.Tag.ToString() == "Fav Folder" || dbTreeviewObj.SelectedNode.Tag.ToString() == "Assembly View"))) { propertiesTab.ShowClassProperties = false; } else { propertiesTab.ShowClassProperties = true; } propertiesTab.RefreshPropertiesTab(0); ((dbTreeView)sender).UpdateTreeNodeSelection(e.Node, toolStripButtonAssemblyView.Checked); OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public Connect() { try { OMETrace.Initialize(); } catch (Exception ex) { ex.ToString(); } try { ExceptionHandler.UpdateExceptionLogginInfo(); ExceptionHandler.Initialize(); } catch (Exception ex) { ex.ToString();//ignore } try { ApplicationManager.CheckLocalAndSetLanguage(); } catch (Exception ex) { ex.ToString();//ignore } }
private void DisplayObjectProperties() { try { OMETrace.WriteFunctionStart(); if (objId != 0) { ArrayList objectProperties = new ArrayList(); ObjectProperties objTable = AssemblyInspectorObject.ObjectProperties.GetObjectProperties(objId); objectProperties.Add(objTable); dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); dbGridViewProperties.Size = panelDatabaseProperties.Size; dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_OBJECTPROPERTIES, objectProperties); if (!panelObjectProperties.Controls.Contains(dbGridViewProperties)) { panelObjectProperties.Controls.Add(dbGridViewProperties); } dbGridViewProperties.Refresh(); } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
private void DisplayObjectProperties() { try { OMETrace.WriteFunctionStart(); if (m_selectedObject != null) { ArrayList objectProperties = new ArrayList(); ObjectPropertiesTable objTable = dbInteraction.GetObjectProperties(m_selectedObject); objectProperties.Add(objTable); dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); dbGridViewProperties.Size = panelDatabaseProperties.Size; dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_OBJECTPROPERTIES, objectProperties); if (!panelObjectProperties.Controls.Contains(dbGridViewProperties)) panelObjectProperties.Controls.Add(dbGridViewProperties); dbGridViewProperties.Refresh(); } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// RowAdded: sets the height of the datagridview when row is added /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { try { OMETrace.WriteFunctionStart(); if (dbDataGridView.RowCount > 0) { int height = dbDataGridView.ColumnHeadersHeight + dbDataGridView.RowTemplate.Height + (dbDataGridView.RowTemplate.Height * dbDataGridView.RowCount); if (height > 106) { dbDataGridView.Height = height; Height = panelTop.Height + height; } } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
//public static string Default_LanguagePreference //{ // get // { // if (AppConfigHelper.m_Default_LanguagePreference == string.Empty) // { // AppConfigHelper.m_Default_LanguagePreference = // (string)AppConfigHelper.GetValueFromConfig( // Preferences.KEY_DEFAULT_LANGUAGE_PREFERENCE, typeof(string), "English"); // } // return AppConfigHelper.m_Default_LanguagePreference; // } // set { AppConfigHelper.m_Default_LanguagePreference = value; } //} #endregion Properties #region Public Static Functions #region XML Documentation GetValueFromConfig /// <summary> /// Given a key this function retrieves the value associated with the key /// </summary> /// <param name="key">key denotes the key in a application configuration file</param> /// <param name="type">type of the value to be retrieved</param> /// <param name="defaultValue">value to be returned if the function fails to retrieve the value from the configuration file</param> /// <returns>Returns value associated with the specified key</returns> #endregion public static object GetValueFromConfig(string key, Type type, object defaultValue) { string strValue = ConfigurationManager.AppSettings[key]; object objValue = null; try { if (string.IsNullOrEmpty(strValue)) { //OMETrace.WriteLine(Helper.GetResourceString(KEY_MISSING_MESSAGE) + key); strValue = defaultValue.ToString(); } objValue = Convert.ChangeType(strValue, type); if (objValue == null) { objValue = defaultValue; } } catch (OMEException objAIException) { OMETrace.WriteLine(objAIException.Message); objValue = defaultValue; } catch (Exception objException) { OMETrace.WriteLine(objException.Message); objValue = defaultValue; } return(objValue); }
//TreeView Event Handlers /// <summary> /// Event handles the expand event and get the child objects for expanded node /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbtreeviewObject_AfterExpand(object sender, TreeViewEventArgs e) { try { OMETrace.WriteFunctionStart(); //After adding child nodes dont add again if (e.Node.Parent != null && e.Node.Parent.Tag != null && e.Node.Parent.Tag.ToString() == "Fav Folder") { e.Node.TreeView.SelectedNode = e.Node; } if (!Helper.OnTreeViewAfterExpand(sender, e)) { return; } //Get the name of selected item with the namespace string nodeName = e.Node.Name.LastIndexOf(CONST_COMMA_CHAR) == -1 ? e.Node.Tag.ToString() : e.Node.Name; Hashtable storedfields = AssemblyInspectorObject.Connection.FetchStoredFields(nodeName); dbtreeviewObject.AddTreeNode(storedfields, e.Node); OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } finally { SetClassName(e.Node); } }
/// <summary> /// Set ClassName when the treenode selected /// </summary> /// <param name="node"></param> private void SetClassName(TreeNode node) { try { OMETrace.WriteFunctionStart(); if (node.Parent == null && node.Tag != null && (node.Tag.ToString() == "Fav Folder" || node.Tag.ToString() == "Assembly View")) { PropertiesTab.Instance.ShowClassProperties = false; return; } PropertiesTab.Instance.ShowClassProperties = true; //Check Selected view and set the class name accordingly if (toolStripButtonAssemblyView.Checked || (node.Parent != null) && (node.Parent.Tag.ToString() == "Fav Folder" || node.Tag.ToString() == "Assembly View")) { if (node.FullPath.IndexOf(CONST_BACK_SLASH_CHAR) != -1) { string className = node.FullPath.Split(CONST_BACK_SLASH_CHAR)[1]; if (className.IndexOf(CONST_BACK_SLASH_CHAR) != -1) { className = className.Split(CONST_BACK_SLASH_CHAR)[0]; } Helper.ClassName = className; } else { Helper.ClassName = node.FullPath; } dbAssemblyTreeView.SelectedNode = node; } else { if (Helper.ClassName != null) { if (!Helper.ClassName.Equals(node.FullPath.Split(CONST_BACK_SLASH_CHAR)[0])) { Helper.ClassName = node.FullPath.Split(CONST_BACK_SLASH_CHAR)[0]; } } else { Helper.ClassName = node.FullPath.Split(CONST_BACK_SLASH_CHAR)[0]; } dbtreeviewObject.SelectedNode = node; } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
private void DisplayClassProperties() { try { OMETrace.WriteFunctionStart(); if (Helper.ClassName != null) { if (OMEInteraction.GetCurrentConnParams() != null) { if (OMEInteraction.GetCurrentConnParams() != null) { buttonSaveIndex.Enabled = !OMEInteraction.GetCurrentConnParams().ConnectionReadOnly&& !AssemblyInspectorObject.Connection.CheckForClientServer(); labelNoOfObjects.Text = "Number of objects : " + AssemblyInspectorObject.ClassProperties.GetObjectCountForAClass(Helper.ClassName); dbGridViewProperties.Size = Size; dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); ArrayList fieldPropertiesList = GetFieldsForAllClass(); dbGridViewProperties.ReadOnly = false; dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_CLASSPOPERTY, fieldPropertiesList); //Enable Disable IsIndexed Checkboxes foreach (DataGridViewRow row in dbGridViewProperties.Rows) { ProxyType type = row.Cells["Type"].Value as ProxyType; if (type.IsEditable && (type.IsPrimitive || type.IsNullable)) { row.Cells[2].ReadOnly = false; } else { row.Cells[2].ReadOnly = true; } } if (!panelForClassPropTable.Controls.Contains(dbGridViewProperties)) { panelForClassPropTable.Controls.Add(dbGridViewProperties); } dbGridViewProperties.Dock = DockStyle.Fill; } } } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Shows all the objects of selected class /// </summary> private void ShowAllObjects() { try { OMETrace.WriteFunctionStart(); ShowObjectsForAClass(); OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// DataGridView KeyDown: removed selected row if delete key is pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_KeyDown(object sender, KeyEventArgs e) { try { OMETrace.WriteFunctionStart(); if (e.KeyCode == Keys.Delete) { if (dbDataGridView.Rows.Count > 0) { //Deletes the multiple selected rows if (dbDataGridView.SelectedRows.Count > 1) { List <DataGridViewRow> selectedRows = new List <DataGridViewRow>(); int rowCount = dbDataGridView.Rows.Count; for (int i = 0; i < rowCount; i++) { if (dbDataGridView.Rows[i].Selected) { selectedRows.Add(dbDataGridView.Rows[i]); } } for (int i = 0; i < selectedRows.Count; i++) { dbDataGridView.Rows.Remove(selectedRows[i]); } selectedRows.Clear(); } else //Deletes single selected rows { dbDataGridView.Rows.RemoveAt(dbDataGridView.SelectedCells[0].OwningRow.Index); } e.Handled = true; } } else { e.Handled = false; } OMETrace.WriteTraceBlockStartEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
private void DisplayClassProperties() { try { OMETrace.WriteFunctionStart(); if (Helper.ClassName != null) { if (dbInteraction.GetCurrentRecentConnection() != null) if (dbInteraction.GetCurrentRecentConnection().ConnParam != null) { buttonSaveIndex.Enabled = dbInteraction.GetCurrentRecentConnection().ConnParam.Host == null; labelNoOfObjects.Text = "Number of objects : " + dbInteraction.NoOfObjectsforAClass(Helper.ClassName); dbGridViewProperties.Size = Size; dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); ArrayList fieldPropertiesList = GetFieldsForAllClass(); dbGridViewProperties.ReadOnly = false; dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_CLASSPOPERTY, fieldPropertiesList); //Enable Disable IsIndexed Checkboxes foreach (DataGridViewRow row in dbGridViewProperties.Rows) { IType type = row.Cells["Type"].Value as IType; if (type.IsEditable) { row.Cells[2].ReadOnly = false; } else row.Cells[2].ReadOnly = true; } if (!panelForClassPropTable.Controls.Contains(dbGridViewProperties)) panelForClassPropTable.Controls.Add(dbGridViewProperties); dbGridViewProperties.Dock = DockStyle.Fill; } } else buttonSaveIndex.Enabled = false; OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Log the custom/user exception to the specified log sink /// </summary> /// <param name="objectException"></param> public static void HandleException(OMEException objectException) { string str = string.Empty; string message = string.Empty; str = ExceptionHandler.HandleException(objectException, 1); message = objectException.Message.ToString(); if (String.IsNullOrEmpty(objectException.ErrorCode)) { message = objectException.ExMessage; } OMETrace.WriteLine(string.Empty); OMETrace.WriteLine(message); OMETrace.WriteLine(objectException.StackTrace); }
/// <summary> /// Validate/Commit value to control when vlaue changed/enter in datagridview value column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { OMETrace.WriteFunctionStart(); string valueColumn = Helper.GetResourceString(Constants.QUERY_GRID_VALUE); string fieldName = dbDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString(); string classname = dbDataGridView.Rows[e.RowIndex].Cells[Constants.QUERY_GRID_CALSSNAME_HIDDEN].Value.ToString(); ProxyType type = dbDataGridView.Rows[e.RowIndex].Cells[5].Value as ProxyType; object value = dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value; if (dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value != null && !string.IsNullOrEmpty(dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value.ToString())) { bool isValid = Validations.ValidateDataType(classname, fieldName, value); if (!isValid) { //reset the previous value if value is not valid dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = m_previousCellValue; } else { //set the changed value if value is valid if (AssemblyInspectorObject.DataType.CheckTypeIsSame(type.DisplayName, typeof(DateTime)) && e.ColumnIndex == 2) { DateTime dt = DateTime.Parse(Convert.ToDateTime(value).ToString("MM/dd/yyyy hh:mm:ss tt")); dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = dt.ToString(); } else { dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = value.ToString(); } } m_previousCellValue = string.Empty; OMETrace.WriteFunctionEnd(); } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// Show error messege /// </summary> /// <param name="objException"></param> public static void ShowOMEMessage(OMEException objException) { string str = string.Empty; string message = string.Empty; str = ExceptionHandler.HandleException(objException, 1); message = objException.Message.ToString(); if (String.IsNullOrEmpty(objException.ErrorCode)) { message = objException.ExMessage; } OMETrace.WriteLine(string.Empty); OMETrace.WriteLine(message); OMETrace.WriteLine(objException.StackTrace); MessageBox.Show(str, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); }
/// <summary> /// Validate/Commit value to control when vlaue changed/enter in datagridview value column /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { OMETrace.WriteFunctionStart(); string valueColumn = Helper.GetResourceString(Constants.QUERY_GRID_VALUE); IType type = dbDataGridView.Rows[e.RowIndex].Cells[5].Value as IType; object value = dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value; if (dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value != null && !string.IsNullOrEmpty(dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value.ToString())) { //gridQuery.Rows[j].Cells[Constants.QUERY_GRID_FIELDTYPE_HIDDEN].Value //Validate the entered value bool isValid = Validations.ValidateDataType(FieldTypeForConstraint(dbDataGridView.CurrentCell.OwningRow), value); if (!isValid) { //reset the previous value if value is not valid dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = m_previousCellValue; } else { //set the changed value if value is valid if (type.IsSameAs(typeof(DateTime)) && e.ColumnIndex == 2) { DateTime dt = DateTime.Parse(Convert.ToDateTime(value).ToString("MM/dd/yyyy hh:mm:ss tt")); dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = dt.ToString(); } else { dbDataGridView.Rows[e.RowIndex].Cells[valueColumn].Value = value.ToString(); } } m_previousCellValue = string.Empty; OMETrace.WriteFunctionEnd(); } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public void LoadAppropriatedata() { DefaultSetting(); Helper.ClassName = null; dbInteractionObject = new dbInteraction(); storedclasses = dbInteractionObject.FetchAllStoredClasses(); if (storedclasses != null) { classCount = storedclasses.Count; } //Assembly view disabled for java db. I don't know any other way ICollection keysCollection = storedclasses.Keys; foreach (string str in keysCollection) { if (!str.Contains(",")) { toolStripButtonAssemblyView.Enabled = false; break; } } //Populate the TreeView dbtreeviewObject.AddFavouritFolderFromDatabase(); dbtreeviewObject.AddTreeNode(storedclasses, null); SelectFirstClassNode(); propertiesTab = PropertiesTab.Instance; if (classCount == 0) { propertiesTab.ShowClassProperties = false; toolStripButtonAssemblyView.Enabled = toolStripButtonFlatView.Enabled = false; } recConnection = dbInteraction.GetCurrentRecentConnection(); PopulateSearchStrings(); dbtreeviewObject.Focus(); dbtreeviewObject.Refresh(); OMETrace.WriteFunctionEnd(); instance = this; }
//Object Browser Event Handler private void ObjectBrowser_Load(object sender, EventArgs e) { try { OMETrace.WriteFunctionStart(); CheckForIllegalCrossThreadCalls = false; SetLiterals(); InitalizeBackgroundWorker(); InitializeAssemblyTreeView(); Initalizedbtreeviewobject(); SetObjectBrowserImages(); LoadAppropriatedata(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public void DisplayDatabaseProperties() { try { OMETrace.WriteFunctionStart(); dbGridViewProperties.Size = panelDatabaseProperties.Size; dbGridViewProperties.Rows.Clear(); dbGridViewProperties.Columns.Clear(); dbGridViewProperties.PopulateDisplayGrid(Constants.VIEW_DBPROPERTIES, null); dbGridViewProperties.Rows.Add(1); if (AssemblyInspectorObject.Connection.GetTotalDbSize() == -1) { dbGridViewProperties.Rows[0].Cells[0].Value = "NA for Client/Server"; } else { dbGridViewProperties.Rows[0].Cells[0].Value = AssemblyInspectorObject.Connection.GetTotalDbSize() + " bytes"; } dbGridViewProperties.Rows[0].Cells[1].Value = AssemblyInspectorObject.Connection.NoOfClassesInDb().ToString(); if (AssemblyInspectorObject.Connection.GetFreeSizeOfDb() == -1) { dbGridViewProperties.Rows[0].Cells[2].Value = "NA for Client/Server"; } else { dbGridViewProperties.Rows[0].Cells[2].Value = AssemblyInspectorObject.Connection.GetFreeSizeOfDb() + " bytes"; } if (!panelDatabaseProperties.Controls.Contains(dbGridViewProperties)) { panelDatabaseProperties.Controls.Add(dbGridViewProperties); } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
/// <summary> /// RowRemoved: resets the height of the grid if row removed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e) { try { OMETrace.WriteFunctionStart(); if (dbDataGridView.Rows.Count == 0) { if (OnRowsRemoved != null) { OnRowsRemoved(sender, e); } } else //set the opertator column of the first row readonly false { dbDataGridView.Rows[0].Cells[3].ReadOnly = false; } if (dbDataGridView.RowCount > 0) { int height = dbDataGridView.ColumnHeadersHeight + dbDataGridView.RowTemplate.Height + (dbDataGridView.RowTemplate.Height * dbDataGridView.RowCount); if (dbDataGridView.Height > 106) { dbDataGridView.Height = height; Height = panelTop.Height + height; } } else { dbDataGridView.Height = 106; Height = panelTop.Height + dbDataGridView.Height; } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
static void InitalizeException() { try { OMETrace.Initialize(); } catch (Exception ex) { ex.ToString(); } try { ExceptionHandler.Initialize(); } catch (Exception ex) { ex.ToString(); //ignore } }
/// <summary> /// Handles the multiselection of the rows in DataGridView /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dbDataGridView_OnDBGridCellClick(object sender, dbDataGridViewEventArgs e) { try { DataGridViewCell cell = (DataGridViewCell)e.Data; int rowIndex = cell.RowIndex; if (rowIndex == Constants.INVALID_INDEX_VALUE) { OMETrace.WriteTraceInvalidCondition(Constants.TRACEMESSAGE_INVALIDROW_INDEX); return; } dbDataGridView.CurrentRow.Selected = false; dbDataGridView.Rows[rowIndex].Selected = true; } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public string ConnectToDatabase(ConnectionDetails currConnectionDetails, bool checkCustomConfig) { string exceptionString = dbInteraction.ConnectoToDB(currConnectionDetails, checkCustomConfig); try { OMETrace.Initialize(); } catch (Exception ex) { ex.ToString(); //ignore } try { ExceptionHandler.Initialize(); } catch (Exception ex) { ex.ToString(); //ignore } return(exceptionString); }
/// <summary> /// Load Event of DataGridView /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DataGridViewGroup_Load(object sender, EventArgs e) { try { OMETrace.WriteFunctionStart(); //Populate the Query Group operator combobox string[] operatorList = QueryHelper.GetOperators(); dbDataGridView.PopulateDisplayGrid(Constants.VIEW_QUERYBUILDER, null); comboBoxOperator.Items.AddRange(operatorList); comboBoxOperator.SelectedIndex = 0; dbDataGridView.MultiSelect = true; dbDataGridView.OnDBGridCellClick += dbDataGridView_OnDBGridCellClick; //Build context menu specific to rows dbDataGridView.BuildRowContextMenu(); OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
internal static string GetFullPath(TreeNode treenode) { StringBuilder fullpath = new StringBuilder(string.Empty); TreeNode treenodeParent; List <string> stringParent = new List <string>(); string parentName = string.Empty; try { OMETrace.WriteFunctionStart(); treenodeParent = treenode.Parent; while (treenodeParent != null && treenodeParent.Tag.ToString() != "Fav Folder" && treenodeParent.Tag.ToString() != "Assembly View") { if (treenodeParent.Name.LastIndexOf(",") != -1) { char[] splitChar = { ',' }; //Set the base class name for selected field BaseClass = treenodeParent.Name; //get parent name from node text parentName = treenodeParent.Name.Split(splitChar)[0]; int classIndex = parentName.LastIndexOf('.'); //get the parent name of selected node parentName = parentName.Substring(classIndex + 1, parentName.Length - classIndex - 1); } else { BaseClass = treenodeParent.Name; int classIndex = treenodeParent.Name.LastIndexOf('.'); //get the parent name of selected node parentName = treenodeParent.Name.Substring(classIndex + 1, treenodeParent.Name.Length - classIndex - 1); } if (!string.IsNullOrEmpty(parentName)) { stringParent.Add(parentName); } if (treenodeParent.Parent != null) { treenodeParent = treenodeParent.Parent; } else { break; } } //Prepare fullpath of the selected node for (int i = stringParent.Count; i > 0; i--) { string parent = stringParent[i - 1] + "."; fullpath.Append(parent); } OMETrace.WriteFunctionEnd(); } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } return(fullpath.Append(treenode.Name).ToString()); }