Skip to content

Commit 890bdb2

Browse files
committed
Updated ribbon event procedures
1 parent b57097c commit 890bdb2

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

VB/Ribbon.xml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
size="large"
3939
onAction="OnAction"
4040
getImage="GetButtonImage"
41-
screentip="This will ping the visible servers in the selected data table."
41+
screentip="Ping Servers"
42+
supertip="This will ping the visible servers in the selected data table."
4243
/>
4344
<separator
4445
id="separator2"
@@ -51,7 +52,8 @@
5152
getItemCount="GetItemCount"
5253
getItemLabel="GetItemLabel"
5354
sizeString= "XXXXXXXXXXXXXXXXXXXX"
54-
screentip="This is the column name for the server column."
55+
screentip="Server Name"
56+
supertip="This is the column name for the server column."
5557
/>
5658
<comboBox
5759
id="cboPingName"
@@ -61,7 +63,8 @@
6163
getItemCount="GetItemCount"
6264
getItemLabel="GetItemLabel"
6365
sizeString= "XXXXXXXXXXXXXXXXXXXX"
64-
screentip="This is the column name for the ping column. If the column doesn't exist, it will be created."
66+
screentip="Ping Results"
67+
supertip="This is the column name for the ping column. If the column doesn't exist, it will be created."
6568
/>
6669
</group>
6770
<group
@@ -89,7 +92,8 @@
8992
getItemCount="GetItemCount"
9093
getItemLabel="GetItemLabel"
9194
sizeString= "XXXXXXXXXXXXXXXXXXXX"
92-
screentip="This is the column name for the server column."
95+
screentip="Server Name"
96+
supertip="This is the column name for the server column."
9397
/>
9498
<comboBox
9599
id="cboRdgDescription"
@@ -99,7 +103,8 @@
99103
getItemCount="GetItemCount"
100104
getItemLabel="GetItemLabel"
101105
sizeString= "XXXXXXXXXXXXXXXXXXXX"
102-
screentip="This is the column name for the server description column."
106+
screentip="Server Description"
107+
supertip="This is the column name for the server description column."
103108
/>
104109
<comboBox
105110
id="cboRdgComment"
@@ -109,7 +114,8 @@
109114
getItemCount="GetItemCount"
110115
getItemLabel="GetItemLabel"
111116
sizeString= "XXXXXXXXXXXXXXXXXXXX"
112-
screentip="This is the column name for the server comment column."
117+
screentip="Server Comment"
118+
supertip="This is the column name for the server comment column."
113119
/>
114120
<separator
115121
id="separator4"
@@ -122,15 +128,17 @@
122128
getItemCount="GetItemCount"
123129
getItemLabel="GetItemLabel"
124130
sizeString= "XXXXXXXXXXXXXXXXXXXX"
125-
screentip="This is the column name for the server group column."
131+
screentip="Server Group"
132+
supertip="This is the column name for the server group column."
126133
/>
127134
<editBox
128135
id="txtFileName"
129136
label="File Name: "
130137
onChange="OnChange"
131138
getText="GetLabelText"
132139
sizeString= "XXXXXXXXXXXXXXXXXXXXXX"
133-
screentip="This is the file path for the Remote Desktop Manager file."
140+
screentip="Find Date Format"
141+
supertip="This is the file path for the Remote Desktop Manager file."
134142
/>
135143
</group>
136144
<group

VB/Scripts/ErrorHandler.vb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ Namespace Scripts
1414

1515
Private Shared ReadOnly log As ILog = LogManager.GetLogger(GetType(ErrorHandler))
1616

17-
Public Shared Sub CreateLogRecord()
17+
Public Shared Sub CreateLogRecord(Optional ByVal message As String = "")
1818
Try
1919
Dim sf As New System.Diagnostics.StackFrame(1)
2020
Dim caller As System.Reflection.MethodBase = sf.GetMethod()
2121
Dim currentProcedure As String = (caller.Name).Trim()
22-
log.Info((Convert.ToString("[PROCEDURE]=|") & currentProcedure) + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName)
22+
log.Info("[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[MESSAGE]=|" + message)
2323

2424
Catch ex As Exception
2525
ErrorHandler.DisplayMessage(ex)
@@ -34,11 +34,10 @@ Namespace Scripts
3434
Dim currentFileName As String = "" 'AssemblyInfo.GetCurrentFileName()
3535
Dim errorMessageDescription As String = ex.ToString()
3636
errorMessageDescription = System.Text.RegularExpressions.Regex.Replace(errorMessageDescription, "\r\n+", " ")
37-
'the carriage returns were messing up my log file
3837
Dim msg As String = "Contact your system administrator. A record has been created in the log file." + Environment.NewLine
3938
msg += (Convert.ToString("Procedure: ") & currentProcedure) + Environment.NewLine
4039
msg += "Description: " + ex.ToString() + Environment.NewLine
41-
log.[Error](Convert.ToString((Convert.ToString((Convert.ToString("[PROCEDURE]=|") & currentProcedure) + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[FILE NAME]=|") & currentFileName) + "|[DESCRIPTION]=|") & errorMessageDescription)
40+
log.Error("[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[DESCRIPTION]=|" + errorMessageDescription)
4241
If isSilent = False Then
4342
MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
4443
End If

VB/Scripts/Ribbon.vb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Namespace Scripts
3636

3737
Public Sub Ribbon_Load(ByVal ribbonUI As Office.IRibbonUI)
3838
Try
39+
ErrorHandler.CreateLogRecord()
3940
Me.ribbon = ribbonUI
4041
ribbonref = Me
4142

@@ -67,44 +68,46 @@ Namespace Scripts
6768

6869
End Function
6970

70-
Public Sub GetItemLabel(ByVal control As Office.IRibbonControl, index As Integer, ByRef returnedVal As String)
71+
Public Function GetItemLabel(control As Office.IRibbonControl, index As Integer) As String
7172
Dim tbl As Excel.ListObject = Globals.ThisAddIn.Application.ActiveCell.ActiveCell.ListObject
7273
Try
7374
If (tbl Is Nothing) Or index = 0 Then
74-
returnedVal = ""
75-
Exit Sub
75+
ErrorHandler.CreateLogRecord("EMPTY")
76+
Return String.Empty
7677
End If
77-
returnedVal = tbl.ListColumns(index).Name
78+
ErrorHandler.CreateLogRecord(tbl.ListColumns(index).Name)
79+
Return tbl.ListColumns(index).Name
7880

7981
Catch ex As Exception
8082
Call ErrorHandler.DisplayMessage(ex)
81-
returnedVal = "ERROR"
83+
Return "ERROR"
8284

8385
Finally
8486
tbl = Nothing
8587

8688
End Try
8789

88-
End Sub
90+
End Function
8991

90-
Private Sub GetItemCount(ByVal control As Office.IRibbonControl, ByRef Count As Integer)
92+
Public Function GetItemCount(control As Office.IRibbonControl) As Integer
9193
Dim tbl As Excel.ListObject = Globals.ThisAddIn.Application.ActiveCell.ListObject
9294
Try
9395
If (tbl Is Nothing) Then
94-
Count = 2
96+
Return 2
9597
Else
96-
Count = tbl.ListColumns.Count + 1
98+
Return tbl.ListColumns.Count + 1
9799
End If
98100

99101
Catch ex As Exception
100102
Call ErrorHandler.DisplayMessage(ex)
103+
Return 0
101104

102105
Finally
103106
tbl = Nothing
104107

105108
End Try
106109

107-
End Sub
110+
End Function
108111

109112
Public Function GetLabelText(ByVal control As Office.IRibbonControl) As String
110113
Try

0 commit comments

Comments
 (0)