Example #1
0
        private void Window_Closed(object sender, EventArgs e)
        {
            SettingsClosed?.Invoke(_current, EventArgs.Empty);

            if (ReferenceEquals(_current, this))
            {
                _current = null;
            }
        }
        private void Window_Closed(object sender, EventArgs e)
        {
            SettingsClosed?.Invoke(_current, EventArgs.Empty);

            Settings.Current.SettingsWindowLastLocation = new WindowPosition((int)this.Left, (int)this.Top);
            Settings.Current.Save();

            if (ReferenceEquals(_current, this))
            {
                _current = null;
            }

            this.SetMouseHook(false);
        }
 public static void Launch(ToastView toastView)
 {
     if (_current != null)
     {
         _current.Activate();
         _current.SetMouseHook(true);
     }
     else
     {
         SettingsView settingsView = new SettingsView(toastView);
         SettingsLaunched?.Invoke(_current, new SettingsViewLaunchedEventArgs(settingsView.Settings));
         settingsView.SetMouseHook(true);
         settingsView.ShowDialog();
     }
 }
        private SettingsView(ToastView toastView)
        {
            Analytics.TrackEvent(Analytics.ToastifyEventCategory.General, Analytics.ToastifyEvent.SettingsLaunched);

            this.settingsViewModel = new SettingsViewModel();
            this.settingsViewModel.SettingsSaved += this.SettingsViewModel_SettingsSaved;

            this.toastView = toastView;

            this.InitializeComponent();

            this.DataContext           = this.settingsViewModel;
            this.WindowStartupLocation = this.StartupLocation;

            if (_current == null)
            {
                _current = this;
            }
        }