public static void RaiseConfigurationSaved(ConfigurationViewModel viewModel)
 {
     Ensure.NotNull(viewModel, "viewModel");
     if (ConfigurationSaved != null)
     {
         ConfigurationSaved(viewModel);
     }
 }
        public ConfigurationWindow(ConfigurationViewModel viewModel, INavigator navigator, bool isSaveRequired)
        {
            Ensure.NotNull(viewModel, "viewModel");
            Ensure.NotNull(navigator, "navigator");
            ViewModel = viewModel;
            IsSaveRequired = isSaveRequired;
            this.navigator = navigator;

            InitializeComponent();
            EventManager.ConfigurationSaved += OnConfigurationSaved;
        }
 private void OnConfigurationSaved(ConfigurationViewModel viewModel)
 {
     EventManager.ConfigurationSaved -= OnConfigurationSaved;
     IsSaveRequired = false;
     Close();
 }
 public static void RaiseConfigurationSaved(ConfigurationViewModel viewModel)
 {
     Ensure.NotNull(viewModel, "viewModel");
     if (ConfigurationSaved != null)
         ConfigurationSaved(viewModel);
 }
        public void OpenConfiguration()
        {
            if (configurationWindow == null)
            {
                isMainWindowViewModelReloadRequired = true;

                ConfigurationViewModel viewModel = new ConfigurationViewModel(new SaveConfigurationCommandFactory(Settings.Default, runHotKey, shortcutService), this);
                viewModel.SourceDirectoryPath = Settings.Default.SourceDirectoryPath;
                viewModel.PreferedApplicationPath = Settings.Default.PreferedApplicationPath;
                viewModel.FileSearchMode = GetUserFileSearchMode();
                viewModel.FileSearchCount = GetUserFileSearchCount();
                viewModel.IsFileSearchPatternSaved = Settings.Default.IsFileSearchPatternSaved;
                viewModel.IsLastUsedApplicationSavedAsPrefered = Settings.Default.IsLastUsedApplicationSavedAsPrefered;
                viewModel.IsDismissedWhenLostFocus = Settings.Default.IsDismissedWhenLostFocus;
                viewModel.IsHiddentOnStartup = Settings.Default.IsHiddentOnStartup;
                viewModel.IsAutoSelectApplicationVersion = Settings.Default.IsAutoSelectApplicationVersion;
                viewModel.IsFileNameRemovedFromDisplayedPath = Settings.Default.IsFileNameRemovedFromDisplayedPath;
                viewModel.IsDisplayedPathTrimmedToLastFolderName = Settings.Default.IsDisplayedPathTrimmedToLastFolderName;
                viewModel.IsAutoStartup = shortcutService.Exists(Environment.SpecialFolder.Startup);
                viewModel.IsTrayIcon = Settings.Default.IsTrayIcon;
                viewModel.IsStatisticsCounted = Settings.Default.IsStatisticsCounted;
                viewModel.AdditionalApplications = new ObservableCollection<AdditionalApplicationListViewModel>(LoadAdditionalApplications());
                viewModel.RunKey = runHotKey.FindKeyViewModel();

                configurationWindow = new ConfigurationWindow(viewModel, this, String.IsNullOrEmpty(Settings.Default.SourceDirectoryPath));
                configurationWindow.ShowInTaskbar = !runHotKey.IsSet;
                configurationWindow.ResizeMode = !runHotKey.IsSet ? ResizeMode.CanMinimize : ResizeMode.NoResize;
                configurationWindow.Closed += OnConfigurationWindowClosed;
            }
            configurationWindow.Show();
            configurationWindow.Activate();
        }
 private void OnConfigurationSaved(ConfigurationViewModel viewModel)
 {
     if (viewModel.IsTrayIcon)
         TryCreateTrayIcon();
     else
         TryDestroyTrayIcon();
 }