コード例 #1
0
        public SettingsWindow()
        {
            InitializeComponent();

            DismissalCheck.IsChecked   = Properties.Settings.Default.NoDismiss;
            NoSoundCheck.IsChecked     = Properties.Settings.Default.Silent;
            SquareIconsCheck.IsChecked = Properties.Settings.Default.SquareIcons;
            ContextMenuCheck.IsChecked = Properties.Settings.Default.ContextMenuActions;
            StartupCheck.IsChecked     = InstallUtils.IsRunningOnStartup();
        }
コード例 #2
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();
        }
コード例 #3
0
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            Properties.Settings.Default.NoDismiss          = DismissalCheck.IsChecked == true;
            Properties.Settings.Default.Silent             = NoSoundCheck.IsChecked == true;
            Properties.Settings.Default.SquareIcons        = SquareIconsCheck.IsChecked == true;
            Properties.Settings.Default.ContextMenuActions = ContextMenuCheck.IsChecked == true;

            Properties.Settings.Default.Save();

            InstallUtils.RunOnStartup(StartupCheck.IsChecked == true);

            Close();
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: dqbd/Notiwin
        private void Application_Exit(object sender, ExitEventArgs e)
        {
            CloseLoginWindow();

            if (icon != null)
            {
                icon.Visible = false;
                icon.Dispose();
            }

            if (websocket != null)
            {
                websocket.Data -= OnData;
                websocket.Disconnect();
            }

            NotificationActivator.Uninitialize();
#if DEBUG
            InstallUtils.UnregisterApp();
#endif
        }