/// <summary> /// Initialize is called when Snarl want to initialize the extension. /// </summary> /// <returns>Extension must return SnarlStatus.Success - any other return code and Snarl won't load the extension.</returns> public int Initialize() { snarl = new SnarlInterface(); snarl.Register("Noer.IT/" + ApplicationName, ApplicationName, IconPath); return((int)SnarlInterface.SnarlStatus.Success); }
void snarl_GlobalSnarlEvent(SnarlInterface sender, SnarlInterface.GlobalEventArgs args) { if (args.GlobalEvent == SnarlInterface.GlobalEvent.SnarlLaunched && isRunning) { RegisterWithSnarl(); } }
public void RegisterWithSnarl() { if (Properties.Settings.Default.snarlLocal) { if (snarl == null) { snarl = new SnarlInterface(); snarl.CallbackEvent += new SnarlInterface.CallbackEventHandler(snarl_CallbackEvent); snarl.GlobalSnarlEvent += new SnarlInterface.GlobalEventHandler(snarl_GlobalSnarlEvent); } snarl.RegisterWithEvents("FileSystemSnarl", "FileSystemSnarl", IconPath, "fgvh54546bg54", IntPtr.Zero, null); snarl.AddClass("File has been created", "File has been created"); snarl.AddClass("File has been changed", "File has been changed"); snarl.AddClass("File has been renamed", "File has been renamed"); snarl.AddClass("File has been deleted", "File has been deleted"); } else { snarlNetwork = new SnarlNetwork.SnarlNetwork(Properties.Settings.Default.snpIp, Properties.Settings.Default.snpPort); snarlNetwork.register(Properties.Settings.Default.snpIp, Properties.Settings.Default.snpPort, "FileSystemSnarl"); snarlNetwork.addClass(Properties.Settings.Default.snpIp, Properties.Settings.Default.snpPort, "FileSystemSnarl", "File has been created", "File has been created"); snarlNetwork.addClass(Properties.Settings.Default.snpIp, Properties.Settings.Default.snpPort, "FileSystemSnarl", "File has been changed", "File has been changed"); snarlNetwork.addClass(Properties.Settings.Default.snpIp, Properties.Settings.Default.snpPort, "FileSystemSnarl", "File has been renamed", "File has been renamed"); snarlNetwork.addClass(Properties.Settings.Default.snpIp, Properties.Settings.Default.snpPort, "FileSystemSnarl", "File has been deleted", "File has been deleted"); } }
void snarl_CallbackEvent(SnarlInterface sender, SnarlInterface.CallbackEventArgs args) { switch (args.SnarlEvent) { case SnarlInterface.SnarlStatus.NotifyAction: HandleActionCallback(args.Parameter, args.MessageToken); break; case SnarlInterface.SnarlStatus.CallbackInvoked: case SnarlInterface.SnarlStatus.CallbackClosed: case SnarlInterface.SnarlStatus.CallbackMiddleClick: case SnarlInterface.SnarlStatus.CallbackTimedOut: if (snarlSentNotifications.ContainsKey(args.MessageToken)) { try { snarlSentNotifications.Remove(args.MessageToken); } catch { } } break; } }