|
| 1 | +#tag Class |
| 2 | +Protected Class App |
| 3 | +Inherits Application |
| 4 | + #tag Event |
| 5 | + Sub Close() |
| 6 | + Prefs.Close |
| 7 | + End Sub |
| 8 | + #tag EndEvent |
| 9 | + |
| 10 | + #tag Event |
| 11 | + Sub EnableMenuItems() |
| 12 | + EditPreferences.Enabled = false |
| 13 | + ServerConnect.Enabled = true |
| 14 | + ServerGetaDeveloperKey.Enabled = true |
| 15 | + AboutBox.Enabled = true |
| 16 | + End Sub |
| 17 | + #tag EndEvent |
| 18 | + |
| 19 | + #tag Event |
| 20 | + Sub Open() |
| 21 | + call Prefs.Open |
| 22 | + End Sub |
| 23 | + #tag EndEvent |
| 24 | + |
| 25 | + #tag Event |
| 26 | + Function UnhandledException(error As RuntimeException) As Boolean |
| 27 | + if (ignoreCrash = false) then |
| 28 | + dim stacktrace as string |
| 29 | + stacktrace = "Error: " + GetErrorDesc(error) + " (" + error.Message + ")" + EndOfLine |
| 30 | + stacktrace = stacktrace + "Error Code " + Str(error.ErrorNumber) + EndOfLine |
| 31 | + stacktrace = stacktrace + join(error.cleanStack, endOfLine) |
| 32 | + Dim w As Window = New CrashWindow (stacktrace) |
| 33 | + end if |
| 34 | + return true |
| 35 | + End Function |
| 36 | + #tag EndEvent |
| 37 | + |
| 38 | + |
| 39 | + #tag MenuHandler |
| 40 | + Function AboutBox() As Boolean Handles AboutBox.Action |
| 41 | + AboutBoxWindow.Show |
| 42 | + Return True |
| 43 | + |
| 44 | + End Function |
| 45 | + #tag EndMenuHandler |
| 46 | + |
| 47 | + #tag MenuHandler |
| 48 | + Function ServerConnect() As Boolean Handles ServerConnect.Action |
| 49 | + ConnectWindow.Show |
| 50 | + Return True |
| 51 | + |
| 52 | + End Function |
| 53 | + #tag EndMenuHandler |
| 54 | + |
| 55 | + #tag MenuHandler |
| 56 | + Function ServerGetaDeveloperKey() As Boolean Handles ServerGetaDeveloperKey.Action |
| 57 | + ShowURL "https://www.sqlabs.com/cubesql_devkey.php" |
| 58 | + Return True |
| 59 | + |
| 60 | + End Function |
| 61 | + #tag EndMenuHandler |
| 62 | + |
| 63 | + |
| 64 | + #tag Method, Flags = &h21 |
| 65 | + Private Function GetErrorDesc(err As RuntimeException) As String |
| 66 | + If err IsA NilObjectException Then |
| 67 | + Return "Nil Object Exception" |
| 68 | + ElseIf err IsA OutOfBoundsException Then |
| 69 | + Return "Out of Bounds" |
| 70 | + ElseIf err IsA TypeMismatchException Then |
| 71 | + Return "Type Mismatch" |
| 72 | + ElseIf err IsA illegalCastException Then |
| 73 | + Return "llegal Cast" |
| 74 | + ElseIf err IsA InvalidParentException Then |
| 75 | + Return "Invalid Parent" |
| 76 | + ElseIf err IsA KeyNotFoundException Then |
| 77 | + Return "Key Not Found Exception" |
| 78 | + ElseIf err IsA OutOfMemoryException Then |
| 79 | + Return "Out Of Memory" |
| 80 | + ElseIf err IsA StackOverflowException Then |
| 81 | + Return "Stack Overflow" |
| 82 | + ElseIf err IsA ThreadAlreadyRunningException Then |
| 83 | + Return "Thread Already Running" |
| 84 | + Else |
| 85 | + Return "Unknown error" |
| 86 | + End If |
| 87 | + |
| 88 | + |
| 89 | + End Function |
| 90 | + #tag EndMethod |
| 91 | + |
| 92 | + |
| 93 | + #tag Property, Flags = &h0 |
| 94 | + ignoreCrash As Boolean = false |
| 95 | + #tag EndProperty |
| 96 | + |
| 97 | + |
| 98 | + #tag Constant, Name = kEditClear, Type = String, Dynamic = False, Default = \"&Delete", Scope = Public |
| 99 | + #Tag Instance, Platform = Windows, Language = Default, Definition = \"&Delete" |
| 100 | + #Tag Instance, Platform = Linux, Language = Default, Definition = \"&Delete" |
| 101 | + #tag EndConstant |
| 102 | + |
| 103 | + #tag Constant, Name = kFileQuit, Type = String, Dynamic = False, Default = \"&Quit", Scope = Public |
| 104 | + #Tag Instance, Platform = Windows, Language = Default, Definition = \"E&xit" |
| 105 | + #tag EndConstant |
| 106 | + |
| 107 | + #tag Constant, Name = kFileQuitShortcut, Type = String, Dynamic = False, Default = \"", Scope = Public |
| 108 | + #Tag Instance, Platform = Mac OS, Language = Default, Definition = \"Cmd+Q" |
| 109 | + #Tag Instance, Platform = Linux, Language = Default, Definition = \"Ctrl+Q" |
| 110 | + #tag EndConstant |
| 111 | + |
| 112 | + |
| 113 | + #tag ViewBehavior |
| 114 | + #tag ViewProperty |
| 115 | + Name="ignoreCrash" |
| 116 | + Visible=false |
| 117 | + Group="Behavior" |
| 118 | + InitialValue="false" |
| 119 | + Type="Boolean" |
| 120 | + EditorType="" |
| 121 | + #tag EndViewProperty |
| 122 | + #tag EndViewBehavior |
| 123 | +End Class |
| 124 | +#tag EndClass |
0 commit comments