public Config()
 {
     RegistryKey reg = Registry.CurrentUser.OpenSubKey(KEY);
     if (reg == null)
         return;
     xCount = (int)reg.GetValue("xCount", xCount);
     longInterval = (int)reg.GetValue("longInterval", longInterval);
     shortInterval = (int)reg.GetValue("shortInterval", shortInterval);
     isEnabledFileImageSource = (int)reg.GetValue("isEnabledFileImageSource", Convert.ToInt32(isEnabledFileImageSource)) == 1;
     fileImageSourcePath = (string)reg.GetValue("fileImageSourcePath", fileImageSourcePath);
     isEnabledFlickrImageSource = (int)reg.GetValue("isEnabledFlickrImageSource", Convert.ToInt32( isEnabledFlickrImageSource)) == 1;
     flickrImageSourceTags = (string)reg.GetValue("flickrImageSourceTags", flickrImageSourceTags);
     isFlickrImageSourceTagAndLogic = (int)reg.GetValue("isFlickrImageSourceTagAndLogic", isFlickrImageSourceTagAndLogic) == 1;
     flickrImageSourceUserName = (string)reg.GetValue("flickrImageSourceUserName", flickrImageSourceUserName);
     flickrImageSourceText = (string)reg.GetValue("flickrImageSourceText", flickrImageSourceText);
     backgroundstyle = (BackGroundStyle)Enum.Parse(typeof(BackGroundStyle), (string)reg.GetValue("backgroundstyle", Enum.GetName(typeof(BackGroundStyle), backgroundstyle)));
     imagestyle = (ImageStyle)Enum.Parse(typeof(ImageStyle), (string)reg.GetValue("imagestyle", Enum.GetName(typeof(ImageStyle), imagestyle)));
     transitionin = (TransitionStyle)Enum.Parse(typeof(TransitionStyle), (string)reg.GetValue("transitionin", Enum.GetName(typeof(TransitionStyle), transitionin)));
     transitionout = (TransitionStyle)Enum.Parse(typeof(TransitionStyle), (string)reg.GetValue("transitionout", Enum.GetName(typeof(TransitionStyle), transitionout)));
     //theme = (Theme)Enum.Parse(typeof(Theme), (string)reg.GetValue("theme", Enum.GetName(typeof(Theme), theme)));
     comicstyle = (Comicstyle)Enum.Parse(typeof(Comicstyle), (string)reg.GetValue("comicstyle", Enum.GetName(typeof(Comicstyle), comicstyle)));
     isLoggingEnabled = (int)reg.GetValue("isLoggingEnabled", Convert.ToInt32(isLoggingEnabled)) == 1;
     filesearchfilter = (string)reg.GetValue("filesearchfilter", filesearchfilter);
     enablefilesearchfilter = (int)reg.GetValue("enablefilesearchfilter", Convert.ToInt32(enablefilesearchfilter)) == 1;
     reg.Close();
 }
 public Window(Rectangle bounds, int xSize, Config config, IImageSource imageSource)
 {
     Log.Instance.Write("Creating screen saver window at bounds " + bounds);
     this.bounds = bounds;
     this.xSize = xSize;
     this.config = config;
     this.backgroundstyle = config.BackGroundStyle;
     this.imagestyle = config.ImageStyle;
     //this.theme = theme;
     this.imageSource = imageSource;
     this.SetStyle(
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.UserPaint |
         ControlStyles.OptimizedDoubleBuffer, true);
 }