Exemple #1
0
 public TemporaryPictureSource(IPictureSource mainSource, SlideMode slideMode, int delayTime)
 {
     Debug.Assert(mainSource != null);
     this.mainSource = mainSource;
     mode            = slideMode;
     this.delayTime  = delayTime;
 }
Exemple #2
0
        public BackgroundSlideShowEngine(IPictureSource source)
        {
            pictureSource = source;

            screenSaverCheck.Interval = TimeSpan.FromSeconds(5);
            screenSaverCheck.Tick    += onCheckScreenSaver;
        }
Exemple #3
0
 static PageHost pageHostFactory(IPictureSource source, Rect rect, ISlidePage page)
 {
     return(new PageHost(source, rect)
     {
         SlidePage = page
     });
 }
Exemple #4
0
 static ScreenSaver screenSaverFactory(IPictureSource source, Rect rect, ISlidePage page)
 {
     return(new ScreenSaver(source, rect)
     {
         SlidePage = page
     });
 }
Exemple #5
0
 public PageHost(IPictureSource source, Rect displayArea) : this()
 {
     Left          = (displayArea.Left);
     Top           = (displayArea.Top);
     Width         = (displayArea.Width);
     Height        = (displayArea.Height);
     pictureSource = source;
 }
Exemple #6
0
        static int Main(string[] args)
        {
            try
            {
                // Create necessary shortcuts
                if (string.Equals("True", ConfigurationManager.AppSettings["ShowToast"]))
                {
                    ShortcutCreator.TryCreateMenuShortcut(APP_ID, "WallpaperX");
                }

                if (string.Equals("True", ConfigurationManager.AppSettings["StartWithWindows"]))
                {
                    ShortcutCreator.TryCreateStartupShortcut(APP_ID, "WallpaperX");
                }
            }
            catch
            {
                Console.WriteLine("Cannot install Start Menu shortcut.");
                return(1);
            }

            IPictureSource pictureSource = null;

            try
            {
                pictureSource = PictureSourceFactory.Get(ConfigurationManager.AppSettings["PictureSource"]);
            }
            catch
            {
                Console.WriteLine("PictureSource not configured properly.");
                return(1);
            }

            ChangeStrategy.ChangeStrategy changeStrategy = null;
            try
            {
                changeStrategy = ChangeStrategyFactory.Get(ConfigurationManager.AppSettings["ChangeStrategy"], pictureSource);
            }
            catch
            {
                Console.WriteLine("ChangeStrategy not configured properly.");
                return(1);
            }

            Thread strategyThread = new Thread(changeStrategy.RunLogic);

            strategyThread.Start();
            strategyThread.Join();

            return(0);
        }
Exemple #7
0
        public static ChangeStrategy Get(string strategyType, IPictureSource pictureSource)
        {
            switch (strategyType)
            {
            case "OneTime":
                return(new OneTimeStrategy(pictureSource));

            case "EveryHour":
                return(new EveryHourStrategy(pictureSource));

            default:
                return(new OneTimeStrategy(pictureSource));
            }
        }
 public ChangeStrategy(IPictureSource pictureSource)
 {
     PictureSource = pictureSource;
 }
 public EveryHourStrategy(IPictureSource pictureSource) : base(pictureSource)
 {
 }
Exemple #10
0
 public SaverEngine(IPictureSource source, PageHost[] slideShowList)
 {
     pictureSource      = source;
     this.slideShowList = slideShowList;
 }
Exemple #11
0
        static T[] createPageHostAndRun <T>(Func <IPictureSource, Rect, ISlidePage, T> hostCreator, Action <T> hostConfigurer, IPictureSource source)
            where T : PageHost
        {
            source.RestorePicturePosition(Settings.Default.LastShownIndex);
            var slideCreator = createPageFactoryFromSettings();
            var result       = (from screen in Screen.AllScreens
                                let b = screen.Bounds
                                        let rect = new Rect((b.Left), (b.Top), (b.Width), (b.Height))
                                                   select hostCreator(source, rect, slideCreator.Create(Settings.Default.DisplayMode))).ToArray();

            foreach (var host in result)
            {
                hostConfigurer(host);
            }
            source.Start();
            return(result);
        }
 public OneTimeStrategy(IPictureSource pictureSource) : base(pictureSource)
 {
 }