|
1 | 1 | // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
|
2 |
| -using System; |
3 |
| -using System.Runtime.InteropServices; |
4 |
| -using System.Windows; |
5 | 2 | using CSharpRegexTools4Npp.PluginInfrastructure;
|
6 | 3 | using NppPlugin.DllExport;
|
| 4 | +using System; |
| 5 | +using System.Runtime.InteropServices; |
7 | 6 |
|
8 | 7 | namespace CSharpRegexTools4Npp
|
9 | 8 | {
|
@@ -47,26 +46,19 @@ static IntPtr getName()
|
47 | 46 | [DllExport(CallingConvention = CallingConvention.Cdecl)]
|
48 | 47 | static void beNotified(IntPtr notifyCode)
|
49 | 48 | {
|
50 |
| - try |
| 49 | + ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); |
| 50 | + if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) |
| 51 | + { |
| 52 | + PluginBase._funcItems.RefreshItems(); |
| 53 | + Main.SetToolBarIcon(); |
| 54 | + } |
| 55 | + else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) |
51 | 56 | {
|
52 |
| - ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); |
53 |
| - if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) |
54 |
| - { |
55 |
| - PluginBase._funcItems.RefreshItems(); |
56 |
| - Main.SetToolBarIcon(); |
57 |
| - } |
58 |
| - else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) |
59 |
| - { |
60 |
| - Marshal.FreeHGlobal(_ptrPluginName); |
61 |
| - } |
62 |
| - else |
63 |
| - { |
64 |
| - Main.OnNotification(notification); |
65 |
| - } |
| 57 | + Marshal.FreeHGlobal(_ptrPluginName); |
66 | 58 | }
|
67 |
| - catch(Exception exception) |
| 59 | + else |
68 | 60 | {
|
69 |
| - MessageBox.Show(exception.Message, $"Error in {nameof(beNotified)}", MessageBoxButton.OK, MessageBoxImage.Error); |
| 61 | + Main.OnNotification(notification); |
70 | 62 | }
|
71 | 63 | }
|
72 | 64 | }
|
|
0 commit comments