Пример #1
0
        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();
        }
Пример #2
0
        public DebugApp(WebsocketUtils websocket)
        {
            this.websocket = websocket;

            InitializeComponent();
        }