Пример #1
0
        private void _applicationSettingsService_OnSettingsSaved(object sender, EventArgs e)
        {
            _applicationSettingsService.LoadSettings();
            ImageViewApplicationSettings appSettings = _applicationSettingsService.Settings;

            flowLayoutPanel1.BackColor = appSettings.MainWindowBackgroundColor.ToColor();
            picBoxMaximized.BackColor  = appSettings.MainWindowBackgroundColor.ToColor();
        }
Пример #2
0
        private void FormThumbnailView_Closing(object sender, CancelEventArgs e)
        {
            ImageViewApplicationSettings appSettings = _applicationSettingsService.Settings;

            appSettings.ThumbnailFormLocation = PointDataModel.CreateFromPoint(Location);
            appSettings.ThumbnailFormSize     = SizeDataModel.CreateFromSize(Size);
            _applicationSettingsService.SaveSettings();
            Controls.Clear();
        }
Пример #3
0
 public FormSettings(BookmarkService bookmarkService, ApplicationSettingsService applicationSettingsService, ImageCacheService imageCacheService)
 {
     applicationSettingsService.LoadSettings();
     _originalSettings           = applicationSettingsService.Settings;
     _bookmarkService            = bookmarkService;
     _applicationSettingsService = applicationSettingsService;
     _imageCacheService          = imageCacheService;
     _selectedCacheSize          = _imageCacheService.CacheSize;
     InitializeComponent();
 }
        private ApplicationSettingsService GetApplicationSettingsService()
        {
            var appSettings = ImageViewApplicationSettings.CreateDefaultSettings();

            appSettings.DefaultKey = "EkNxG2vH27y4xezfzyEJpHGenOtgLJ1x";
            var appSettingsFileRepository = Substitute.For <AppSettingsFileRepository>();
            var settingsService           = Substitute.For <ApplicationSettingsService>(appSettingsFileRepository);



            Application.CompanyName.Returns("Cuplex");
            //ApplicationSettingsService.CompanyName.Returns("Cuplex");

            settingsService.ProductName.Returns("ImageViewer");

            settingsService.Settings.Returns(appSettings);

            return(settingsService);
        }
Пример #5
0
        private void FormThumbnailView_Load(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            ImageViewApplicationSettings appSettings = _applicationSettingsService.Settings;

            if (appSettings.ThumbnailFormSize != null && appSettings.ThumbnailFormLocation != null)
            {
                RestoreFormState.SetFormSizeAndPosition(this, appSettings.ThumbnailFormSize.ToSize(), appSettings.ThumbnailFormLocation.ToPoint(), Screen.PrimaryScreen.WorkingArea);
            }

            Closing += FormThumbnailView_Closing;
            SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            flowLayoutPanel1.BackColor = appSettings.MainWindowBackgroundColor.ToColor();
            picBoxMaximized.BackColor  = appSettings.MainWindowBackgroundColor.ToColor();
            UpdateStyles();
        }
Пример #6
0
        private void FormSettings_Load(object sender, EventArgs e)
        {
            ImageViewApplicationSettings settings = _applicationSettingsService.Settings;

            chkAutoRandomize.Checked            = settings.AutoRandomizeCollection;
            chkPasswordProtectBookmarks.Checked = settings.PasswordProtectBookmarks;
            chkShowSwitchImgButtons.Checked     = settings.ShowSwitchImageButtons;
            chkEnableAutoload.Checked           = settings.EnableAutoLoadFunctionFromMenu;
            chkConfirmExit.Checked = settings.ConfirmApplicationShutdown;
            ChkAutomaticallyCheckForUpdates.Checked       = settings.AutomaticUpdateCheck;
            chkToggleSlidshowWithThirdMouseButton.Checked = settings.ToggleSlideshowWithThirdMouseButton;

            if (settings.ShowNextPrevControlsOnEnterWindow)
            {
                rbOverWindow.Checked      = true;
                rbOverControlArea.Checked = false;
            }
            else
            {
                rbOverWindow.Checked      = false;
                rbOverControlArea.Checked = true;
            }

            rbImgTransformNone.Checked = false;
            switch (settings.NextImageAnimation)
            {
            case ImageViewApplicationSettings.ChangeImageAnimation.None:
                rbImgTransformNone.Checked = true;
                break;

            //case ImageViewApplicationSettings.ChangeImageAnimation.SlideLeft:
            //    rbImgTransformSlideLeft.Checked = true;
            //    break;
            //case ImageViewApplicationSettings.ChangeImageAnimation.SlideRight:
            //    rbImgTransformSlideRight.Checked = true;
            //    break;
            //case ImageViewApplicationSettings.ChangeImageAnimation.SlideDown:
            //    rbImgTransformSlideDown.Checked = true;
            //    break;
            //case ImageViewApplicationSettings.ChangeImageAnimation.SlideUp:
            //    rbImgTransformSlideUp.Checked = true;
            //  break;
            case ImageViewApplicationSettings.ChangeImageAnimation.FadeIn:
                rbImgTransformFadeIn.Checked = true;
                break;

            default:
                rbImgTransformNone.Checked = true;
                break;
            }

            if (settings.ImageTransitionTime < 10 || settings.ImageTransitionTime > 5000)
            {
                settings.ImageTransitionTime = 1000;
            }

            numericScreenMinOffset.Value   = settings.ScreenMinXOffset;
            numericScreenWidthOffset.Value = settings.ScreenWidthOffset;

            trackBarFadeTime.Value = settings.ImageTransitionTime;
            lblFadeTime.Text       = trackBarFadeTime.Value + " ms";

            // Colors
            var colorList = UIHelper.GetSelectableBackgroundColors();

            colorList.AddRange(UIHelper.GetSelectableSystemBackgroundColors());
            backgroundColorDropdownList.DataSource = colorList;
            BackgroundImageDropdown.DataSource     = UIHelper.GetSelectableBackgroundColors();

            if (backgroundColorDropdownList.Items.Count > 0)
            {
                if (settings.MainWindowBackgroundColor != null)
                {
                    Color savedColor = ColorDataModel.CreateFromColorDataModel(settings.MainWindowBackgroundColor);
                    var   item       = colorList.FirstOrDefault(x => x.ToArgb() == savedColor.ToArgb());
                    backgroundColorDropdownList.SelectedItem = item;
                }
                else
                {
                    backgroundColorDropdownList.SelectedIndex = 0;
                }
            }

            UpdateCacheStats();
        }