Example #1
0
        static void beNotified(IntPtr notifyCode)
        {
            try
            {
                SCNotification nc = (SCNotification)Marshal.PtrToStructure(notifyCode, typeof(SCNotification));
                if (nc.nmhdr.code == (uint)NppMsg.NPPN_TBMODIFICATION)
                {
                    Plugin.FuncItems.RefreshItems();
                    Plugin.RefreshToolbarImages();
                }
                else if (nc.nmhdr.code == (uint)SciMsg.SCN_CHARADDED)
                {
                }
                else if (nc.nmhdr.code == (uint)NppMsg.NPPN_READY)
                {
                    CSScriptIntegration.Initialize();
                    Plugin.InitView();
                }
                else if (nc.nmhdr.code == (uint)NppMsg.NPPN_SHUTDOWN)
                {
                    Marshal.FreeHGlobal(_ptrPluginName);
                    Plugin.CleanUp();
                }

                Plugin.OnNotification(nc);
            }
            catch { }//this is indeed the last line of defense as all CS-S calls have the error handling inside
        }
Example #2
0
        public void beNotified(IntPtr notifyCode)
        {
            lock (typeof(UnmanagedExports))
            {
                try
                {
                    ScNotification nc          = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification));
                    string         contentFile = Npp.Editor.GetTabFile(nc.Header.IdFrom);

                    if (nc.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION)
                    {
                        PluginBase._funcItems.RefreshItems();
                        Plugin.RefreshToolbarImages();
                    }
                    else if (nc.Header.Code == (uint)SciMsg.SCN_CHARADDED)
                    {
                    }
                    else if (nc.Header.Code == (uint)NppMsg.NPPN_READY)
                    {
                        CSScriptIntegration.Initialize();
                        Plugin.InitView();
                    }
                    else if (nc.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN)
                    {
                        Marshal.FreeHGlobal(_ptrPluginName);
                        Plugin.CleanUp();
                    }

                    Plugin.OnNotification(nc);
                }
                catch { }//this is indeed the last line of defense as all CS-S calls have the error handling inside
            }
        }