Esempio n. 1
0
        /// <summary>
        /// Shows the options dialog.
        /// </summary>
        /// <param name="parentWindow">The parent window.</param>
        public override void ShowOptionsDialog([NotNull] Window parentWindow)
        {
            Assert.ArgumentNotNull(parentWindow, "parentWindow");

            var displayedAffects = Settings.Default.GroupWidgetAffects.Select(af => Constants.AllAffects.First(a => a.Name == af));
            var allAffects       = Constants.AllAffects.Except(displayedAffects);
            var optionsViewModel = new GroupWidgetOptionsViewModel(Resources.GroupWidgetOptions, allAffects, displayedAffects, Settings.Default.GroupWidgetDisplayAffectsCount, Settings.Default.GroupWidgetDisplayNumber, Settings.Default.GroupWidgetDisplayMemTime, true, Settings.Default.GroupWidgetLimitOn, Settings.Default.GroupWidgetLimit);
            var window           = new OptionsDialog {
                DataContext = optionsViewModel, Owner = parentWindow
            };
            var result = window.ShowDialog();

            if (result.HasValue && result.Value)
            {
                Settings.Default.GroupWidgetAffects             = optionsViewModel.DisplayedAffects.Select(af => af.Name).ToArray();
                Settings.Default.GroupWidgetDisplayAffectsCount = optionsViewModel.DisplayedAffectsCount;
                Settings.Default.GroupWidgetDisplayNumber       = optionsViewModel.DisplayNumber;
                Settings.Default.GroupWidgetDisplayMemTime      = optionsViewModel.DisplayMemTime;

                Settings.Default.GroupWidgetLimit   = optionsViewModel.ItemLimit;
                Settings.Default.GroupWidgetLimitOn = optionsViewModel.ItemLimitOn;
                Settings.Default.Save();
                _viewModel.ReloadDisplayedAffects();
            }
        }