Exemplo n.º 1
0
        private void SetPrimaryBackgroundImage()
        {
            this.primaryBackgroundImageAlpha = Properties.Settings.Default.MainPageBackDropAlpha;
            if (Properties.Settings.Default.EnableMainPageBackDrop)
            {
                if (!string.IsNullOrEmpty(Properties.Settings.Default.MainPageBackDropFile))
                {
                    if (primaryBackgroundImage == null)
                    {
                        string lockedFileName = Properties.Settings.Default.MainPageBackDropFile;
                        if (File.Exists(Path.Combine(FileSystemWalker.MainBackDropDirectory, lockedFileName)))
                        {
                            primaryBackgroundImage = new Image(
                                string.Format("file://{0}", Path.Combine(FileSystemWalker.MainBackDropDirectory, lockedFileName))
                                );
                            return;
                        }
                    }
                }

                // a specific file is NOT set for the main backdrop, lets see how many we find.
                DirectoryInfo dirInfo = new DirectoryInfo(FileSystemWalker.MainBackDropDirectory);
                FileInfo[]    files   = dirInfo.GetFiles("*.jpg", SearchOption.TopDirectoryOnly);
                iTotalBackgroundImages = files.Length;
                if (iTotalBackgroundImages > 0)
                {
                    if (iCurrentBackgroundImage >= iTotalBackgroundImages)
                    {
                        iCurrentBackgroundImage = 0;
                    }

                    PrimaryBackgroundImage = new Image(string.Format("file://{0}",
                                                                     Path.Combine(FileSystemWalker.MainBackDropDirectory,
                                                                                  files[iCurrentBackgroundImage].FullName)));
                    iCurrentBackgroundImage++;
                    if (mainBackgroundTimer == null && iTotalBackgroundImages > 1)
                    {
                        mainBackgroundTimer            = new Microsoft.MediaCenter.UI.Timer();
                        mainBackgroundTimer.AutoRepeat = true;
                        mainBackgroundTimer.Tick      += new EventHandler(mainBackgroundTimer_Tick);
                        int rotationInSeconds      = Properties.Settings.Default.MainPageBackDropRotationInSeconds;
                        int rotationInMilliseconds = rotationInSeconds * 1000;
                        mainBackgroundTimer.Interval = rotationInMilliseconds;
                        mainBackgroundTimer.Enabled  = true;
                        mainBackgroundTimer.Start();
                    }

                    return;
                }
            }
        }
Exemplo n.º 2
0
        private void SetPrimaryBackgroundImage()
        {
            this.primaryBackgroundImageAlpha = Properties.Settings.Default.MainPageBackDropAlpha;
            if (Properties.Settings.Default.EnableMainPageBackDrop)
            {
                if (!string.IsNullOrEmpty(Properties.Settings.Default.MainPageBackDropFile))
                {
                    if (primaryBackgroundImage == null)
                    {
                        string lockedFileName = Properties.Settings.Default.MainPageBackDropFile;
                        if (File.Exists(Path.Combine(FileSystemWalker.MainBackDropDirectory, lockedFileName)))
                        {
                            primaryBackgroundImage = new Image(
                                string.Format("file://{0}", Path.Combine(FileSystemWalker.MainBackDropDirectory, lockedFileName))
                            );
                            return;
                        }
                    }
                }

                // a specific file is NOT set for the main backdrop, lets see how many we find.
                DirectoryInfo dirInfo = new DirectoryInfo(FileSystemWalker.MainBackDropDirectory);
                FileInfo[] files = dirInfo.GetFiles("*.jpg", SearchOption.TopDirectoryOnly);
                iTotalBackgroundImages = files.Length;
                if (iTotalBackgroundImages > 0)
                {
                    if (iCurrentBackgroundImage >= iTotalBackgroundImages)
                        iCurrentBackgroundImage = 0;

                    PrimaryBackgroundImage = new Image(string.Format("file://{0}",
                            Path.Combine(FileSystemWalker.MainBackDropDirectory,
                            files[iCurrentBackgroundImage].FullName)));
                    iCurrentBackgroundImage++;
                    if (mainBackgroundTimer == null && iTotalBackgroundImages>1)
                    {
                        mainBackgroundTimer = new Microsoft.MediaCenter.UI.Timer();
                        mainBackgroundTimer.AutoRepeat = true;
                        mainBackgroundTimer.Tick += new EventHandler(mainBackgroundTimer_Tick);
                        int rotationInSeconds = Properties.Settings.Default.MainPageBackDropRotationInSeconds;
                        int rotationInMilliseconds = rotationInSeconds * 1000;
                        mainBackgroundTimer.Interval = rotationInMilliseconds;
                        mainBackgroundTimer.Enabled = true;
                        mainBackgroundTimer.Start();
                    }

                    return;
                }
            }
        }
Exemplo n.º 3
0
        public Application(MyHistoryOrientedPageSession session, Microsoft.MediaCenter.Hosting.AddInHost host)
        {

            this.session = session;
            this.addinHost = host;
            if (session != null)
            {
                this.session.Application = this;
            }
            singleApplicationInstance = this;

            //wire up our mouseActiveHooker so we can know if the mouse is active
            if (Config.EnableMouseHook)
            {
                Kernel.Instance.MouseActiveHooker.MouseActive += mouseActiveHooker_MouseActive;
            }

            //initialize our menu manager
            menuManager = new MenuManager();

            //initialize screen saver
            ScreenSaverTimer = new Timer() { AutoRepeat = true, Enabled = true, Interval = 60000 };
            ScreenSaverTimer.Tick += ScreenSaverTimer_Tick;

            //initialize auto logoff
            IdleTimer = new Timer() { AutoRepeat = true, Enabled = true, Interval = 60000 };
            IdleTimer.Tick += IdleTimer_Tick;
        }
Exemplo n.º 4
0
        public Application(MyHistoryOrientedPageSession session, Microsoft.MediaCenter.Hosting.AddInHost host)
        {

            this.session = session;
            if (session != null)
            {
                this.session.Application = this;
            }
            singleApplicationInstance = this;
            //wire up our mouseActiveHooker if enabled so we can know if the mouse is active over us
            if (Config.Instance.EnableMouseHook)
            {
                Kernel.Instance.MouseActiveHooker.MouseActive += new IsMouseActiveHooker.MouseActiveHandler(mouseActiveHooker_MouseActive);
            }
            //initialize our menu manager
            menuManager = new MenuManager();

            //initialize screen saver
            ScreenSaverTimer = new Timer() { AutoRepeat = true, Enabled = true, Interval = 60000 };
            ScreenSaverTimer.Tick += new EventHandler(ScreenSaverTimer_Tick);
        }