예제 #1
0
파일: App.xaml.cs 프로젝트: dqbd/Notiwin
        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
파일: DebugApp.cs 프로젝트: dqbd/Notiwin
        public DebugApp(WebsocketUtils websocket)
        {
            this.websocket = websocket;

            InitializeComponent();
        }