コード例 #1
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            NotificationActivatorBase.UnregisterComType();
            NotificationHelper.UnregisterComServer(typeof(NotificationActivator));
        }
コード例 #2
0
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            NotificationActivatorBase.RegisterComType(typeof(NotificationActivator), OnActivated);
            NotificationHelper.RegisterComServer(typeof(NotificationActivator), Assembly.GetExecutingAssembly().Location);
        }
コード例 #3
0
ファイル: AppInitializer.cs プロジェクト: otomarukanta/Norma
        public static void PostInitialize()
        {
            if (!NormaConstants.IsSupportedNewToast)
            {
                return;
            }

            // For Action Center of Windows 10
            NotificationActivatorBase.RegisterComType(typeof(NotificationActivator), OnActivated);
            NotificationHelper.RegisterComServer(typeof(NotificationActivator), Assembly.GetExecutingAssembly().Location);
        }
コード例 #4
0
        protected override void OnExit(ExitEventArgs e)
        {
            if (NormaConstants.IsSupportedNewToast)
            {
                NotificationActivatorBase.UnregisterComType();
            }
            (Shell.TaskbarIcon.DataContext as IDisposable)?.Dispose();
            Shell.TaskbarIcon.Dispose();

            _mutex?.ReleaseMutex();
            _mutex?.Close();
            base.OnExit(e);
        }
コード例 #5
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    NotificationActivatorBase.UnregisterComType();

                    mIRC.Dispose();
                }

                disposedValue = true;
            }
        }
コード例 #6
0
        public MainWindow()
        {
            InitializeComponent();

            EasyLogger.BackupLogs(EasyLogger.LogFile);
            EasyLogger.AddListener(EasyLogger.LogFile);

            ((MainWindow)Application.Current.MainWindow).mainWindow.StateChanged += MainWindow_StateChanged;

            HideThisWindow();

            Closing += MainWindow_Closing;

            if (Default.UpgradeRequired)
            {
                Default.Upgrade();

                Default.UpgradeRequired = false;

                Default.Save();

                Default.Reload();

                if (Default.FirstRun)
                {
                    Default.FirstRun = false;

                    SettingsWindow settingsWindow = new SettingsWindow();
                    settingsWindow.ShowDialog();

                    LocationBox locationBox = new LocationBox();
                    locationBox.ShowDialog();

                    MessageBox.Show("Right click on the Desktop App to change the weather location to your preferred location." + Environment.NewLine + Environment.NewLine + "You will need to find your lattitude and longitude in order for me to find your local weather.", "NWS Alerts", MessageBoxButton.OK, MessageBoxImage.Information);

                    Default.Save();

                    Default.Reload();
                }
            }

            NotifyTray.TrayIconCreate();

            if (Default.MuteToast)
            {
                NotifyTray.MuteMenuItem.Checked = true;
                ParseWeatherXML.MuteAlerts      = true;
            }

            NotificationActivatorBase.RegisterComType(typeof(NotificationActivator), OnActivated);

            NotificationHelper.RegisterComServer(typeof(NotificationActivator), Assembly.GetExecutingAssembly().Location);

            if (CheckForInternet.Connected())
            {
                ParseWeatherXML.NWSAlertsInfo();
            }
            else
            {
                ((MainWindow)Application.Current.MainWindow).AlertTextBody.Text = "You may not be connected to the internet...";
            }

            WeatherApp = new DesktopWeather();
            WeatherApp.Show();
        }
コード例 #7
0
 public mToast()
 {
     NotificationActivatorBase.RegisterComType(typeof(NotificationActivator), OnActivated);
     NotificationHelper.RegisterComServer(typeof(NotificationActivator), Assembly.GetExecutingAssembly().Location);
 }