private void Application_Startup(object sender, StartupEventArgs e) { #if DEBUG InstallUtils.RegisterApp(); #else SquirrelAwareApp.HandleEvents( onAppUpdate: v => InstallUtils.ReregisterApp(), onInitialInstall: v => InstallUtils.RegisterApp(), onAppUninstall: v => { InstallUtils.KillOtherInstances(); InstallUtils.UnregisterApp(); Current.Shutdown(); } ); #endif websocket = new WebsocketUtils(); notification = new NotificationUtils(); pushHistory = new List <JObject>(); contextMenu = new System.Windows.Forms.ContextMenu() { MenuItems = { new System.Windows.Forms.MenuItem("&Settings", (a, b) => { SettingsWindow settings = new SettingsWindow(); settings.Logout += OnLogout; settings.Show(); }), new System.Windows.Forms.MenuItem("-"), new System.Windows.Forms.MenuItem("&Exit", (a, b) => { Current.Shutdown(); }) } }; icon = new System.Windows.Forms.NotifyIcon() { Visible = true, Text = ResourceAssembly.GetName().Name, Icon = Notiwin.Properties.Resources.Tray, ContextMenu = contextMenu }; websocket.LoginError += OnLoginError; websocket.Data += OnData; NotificationActivator.Action += OnAction; NotificationActivator.Initialize(); NetworkUtils.ConnectionChanged += OnNetworkChange; OpenLoginWindow(openHidden: true); Init(); }
public void Activate(string appUserModelId, string invokedArgs, NOTIFICATION_USER_INPUT_DATA[] data, uint dataCount) { IDictionary <string, string> res = NotificationUtils.ParseId(invokedArgs); if (data?.Length > 0) { foreach (NOTIFICATION_USER_INPUT_DATA inputData in data) { res.Add(inputData.Key, inputData.Value); } } Action?.Invoke(res); }