Skip to content

Commit

Permalink
Add better exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingWonders committed Mar 10, 2024
1 parent c8bb027 commit 2576505
Show file tree
Hide file tree
Showing 9 changed files with 681 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ApplicationEvents.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Imports Microsoft.Win32
Imports Microsoft.VisualBasic.ControlChars

Namespace My
' Los siguientes eventos están disponibles para MyApplication:
Expand All @@ -16,6 +17,18 @@ Namespace My
AddHandler Microsoft.Win32.SystemEvents.DisplaySettingsChanged, AddressOf SysEvts_DisplaySettingsChanged
End Sub

Private Sub CatchEmAll(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
ExceptionForm.ErrorText.Text = e.Exception.ToString() & CrLf & CrLf &
"Error Message: " & e.Exception.Message & CrLf & CrLf &
"Error Code (HRESULT): " & e.Exception.HResult
ExceptionForm.ShowDialog()
If ExceptionForm.DialogResult = DialogResult.OK Then
e.ExitApplication = False
ElseIf ExceptionForm.DialogResult = DialogResult.Cancel Then
e.ExitApplication = True
End If
End Sub

Private Sub SysEvts_UserPreferenceChanged(sender As Object, e As Microsoft.Win32.UserPreferenceChangedEventArgs)
' Do nothing
End Sub
Expand Down
10 changes: 10 additions & 0 deletions DISMTools.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@
<Compile Include="Panels\DoWork\ProgressPanel.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Panels\Exceptions\ExceptionForm.Designer.vb">
<DependentUpon>ExceptionForm.vb</DependentUpon>
</Compile>
<Compile Include="Panels\Exceptions\ExceptionForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Panels\Exe_Ops\BGProcs\BGProcsAdvSettings.Designer.vb">
<DependentUpon>BGProcsAdvSettings.vb</DependentUpon>
</Compile>
Expand Down Expand Up @@ -719,6 +725,9 @@
<EmbeddedResource Include="Panels\DoWork\ProgressPanel.resx">
<DependentUpon>ProgressPanel.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Panels\Exceptions\ExceptionForm.resx">
<DependentUpon>ExceptionForm.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Panels\Exe_Ops\BGProcs\BGProcsAdvSettings.resx">
<DependentUpon>BGProcsAdvSettings.vb</DependentUpon>
</EmbeddedResource>
Expand Down Expand Up @@ -1248,6 +1257,7 @@
<None Include="Resources\color_schemes\CS_Ops_Green.png" />
<None Include="Resources\color_schemes\CS_ProgressPanel_Blue.png" />
<None Include="Resources\color_schemes\CS_ProgressPanel_Green.png" />
<None Include="Resources\error_32px.png" />
<Content Include="ThemeVS2012\Resources\Dockindicator_PaneDiamond_Hotspot.png" />
<Content Include="ThemeVS2012\Resources\DockIndicator_PaneDiamond_HotspotIndex.png" />
<Content Include="ThemeVS2012\Resources\MaskArrowBottom.png" />
Expand Down
Binary file modified Installer/Output/dt_setup.exe
Binary file not shown.
10 changes: 10 additions & 0 deletions My Project/Resources.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions My Project/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1206,4 +1206,7 @@ New features:
<data name="CS_ProgressPanel_Green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\color_schemes\CS_ProgressPanel_Green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="error_32px" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\error_32px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
171 changes: 171 additions & 0 deletions Panels/Exceptions/ExceptionForm.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2576505

Please sign in to comment.