Example #1
0
        public static StartMenuManager Create(IResourceLibraryCache resourceLibrary, OemManager oemManager)
        {
            if (oemManager == null)
            {
                oemManager = new OemManager();
            }
            FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(MediaCenterUtil.MediaCenterPath, "ehres.dll"));

            if (versionInfo.FileMajorPart != 6)
            {
                throw new InvalidOperationException(string.Format("Version {0} of Media Center is not supported.", (object)versionInfo.ProductVersion));
            }
            if (versionInfo.ProductMinorPart == 0)
            {
                return((StartMenuManager) new DefaultStartMenuManager(resourceLibrary, oemManager));
            }
            if (versionInfo.ProductMinorPart == 1 && versionInfo.ProductBuildPart < 7100)
            {
                return((StartMenuManager) new FijiStartMenuManager(resourceLibrary, oemManager));
            }
            else
            {
                return((StartMenuManager) new Windows7StartMenuManager(resourceLibrary, oemManager));
            }
        }
Example #2
0
 protected StartMenuManager(IResourceLibraryCache resourceLibrary, OemManager oemManager)
 {
     this.Resources  = resourceLibrary;
     this.oemManager = oemManager;
     if (this.oemManager != null)
     {
         this.oemManager.PropertyChanged += new PropertyChangedEventHandler(this.OemManager_PropertyChanged);
     }
     this.managerStrips = (ObservableCollection <IMenuStrip>) new StartMenuManager.StripCollection(this);
     this.Reset(false);
 }
Example #3
0
        private void NewApplicationExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            OemManager oemManager = this.m_startMenu.StartMenuManager.OemManager;

            Advent.MediaCenter.StartMenu.OEM.EntryPoint ep = new Advent.MediaCenter.StartMenu.OEM.EntryPoint();
            ep.Manager     = oemManager;
            ep.ID          = "{" + Guid.NewGuid() + "}";
            ep.Title       = "New Entry Point";
            ep.RawImageUrl = string.Empty;
            ep.AddIn       = typeof(VmcExecuteAddIn).AssemblyQualifiedName;
            bool        isSaved  = false;
            OemCategory category = oemManager.Categories["More Programs"];

            ep.Saving += delegate
            {
                if (!isSaved)
                {
                    Advent.MediaCenter.StartMenu.OEM.Application application = new Advent.MediaCenter.StartMenu.OEM.Application();
                    application.ID    = "{" + Guid.NewGuid() + "}";
                    application.Title = ep.Title;
                    oemManager.Applications.Add(application);
                    ep.Application = application;
                    oemManager.EntryPoints.Add(ep);
                    OemQuickLink oemQuickLink = new OemQuickLink(oemManager);
                    oemQuickLink.BeginInit();
                    oemQuickLink.Application = application;
                    oemQuickLink.EntryPoint  = ep;
                    oemQuickLink.EndInit();
                    category.QuickLinks.Add(oemQuickLink);
                }
            };
            ep.Saved += delegate
            {
                if (!isSaved)
                {
                    category.Save();
                }
                isSaved = true;
            };
            EntryPointDocumentView.OpenDocument(ep);
            e.Handled = true;
        }
Example #4
0
        protected override IMenuStrip CreateCustomStrip()
        {
            OemManager  oemManager  = this.OemManager;
            Application application = new Application();

            application.Title = "Custom menu";
            application.ID    = "{" + (object)Guid.NewGuid() + "}";
            oemManager.Applications.Add(application);
            OemMenuStrip oemMenuStrip = new OemMenuStrip();

            oemMenuStrip.Manager     = oemManager;
            oemMenuStrip.Application = application;
            oemMenuStrip.Title       = application.Title;
            oemMenuStrip.Priority    = 100;
            oemMenuStrip.IsEnabled   = true;
            string str = this.CustomCategory + "\\Strip " + application.ID;

            oemMenuStrip.Category = str;
            return((IMenuStrip)oemMenuStrip);
        }
Example #5
0
        private void NewGameExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            OemManager oemManager = this.m_startMenu.StartMenuManager.OemManager;
            Game       game       = (Game)e.Parameter;

            Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint = new Advent.MediaCenter.StartMenu.OEM.EntryPoint();
            entryPoint.ID                   = "{" + Guid.NewGuid() + "}";
            entryPoint.Title                = game.Name;
            entryPoint.RawDescription       = game.Description;
            entryPoint.CapabilitiesRequired = (EntryPointCapabilities.DirectX | EntryPointCapabilities.IntensiveRendering);
            entryPoint.NowPlayingDirective  = "stop";
            entryPoint.ImageOverride        = game.Image;
            string fileName  = "";
            string arguments = "";

            if (VmcStudioUtil.IsShortcut(game.PlayTasks[0]))
            {
                WshShell     shell       = new WshShell();
                IWshShortcut wshShortcut = (IWshShortcut)shell.CreateShortcut(game.PlayTasks[0]);
                fileName  = wshShortcut.TargetPath;
                arguments = wshShortcut.Arguments;
            }
            else
            {
                fileName  = game.PlayTasks[0];
                arguments = null;
            }
            entryPoint.AddIn = typeof(VmcExecuteAddIn).AssemblyQualifiedName;
            ExecutionInfo executionInfo = new ExecutionInfo();

            executionInfo.FileName  = fileName;
            executionInfo.Arguments = arguments;
            executionInfo.CloseKeys = new List <Keys>
            {
                Keys.BrowserBack
            };
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ExecutionInfo));
            StringBuilder stringBuilder = new StringBuilder();

            xmlSerializer.Serialize(new StringWriter(stringBuilder), executionInfo);
            entryPoint.Context = stringBuilder.ToString();
            Advent.MediaCenter.StartMenu.OEM.Application application = oemManager.Applications[game.GameID];
            if (application == null)
            {
                application       = new Advent.MediaCenter.StartMenu.OEM.Application();
                application.ID    = "{" + Guid.NewGuid() + "}";
                application.Title = entryPoint.Title;
                oemManager.Applications.Add(application);
            }
            entryPoint.Manager     = oemManager;
            entryPoint.Application = application;
            oemManager.EntryPoints.Add(entryPoint);
            OemQuickLink oemQuickLink = new OemQuickLink(oemManager);

            oemQuickLink.BeginInit();
            oemQuickLink.Application = application;
            oemQuickLink.EntryPoint  = entryPoint;
            oemQuickLink.EndInit();
            oemManager.Categories["Services\\Games"].QuickLinks.Add(oemQuickLink);
            EntryPointDocumentView.OpenDocument(entryPoint);
            e.Handled = true;
        }
 public Windows7StartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
     this.m_deletedStrips = new List<Windows7MenuStrip>();
     this.Strips.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Strips_CollectionChanged);
 }
Example #7
0
 public DefaultStartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
 }
Example #8
0
 public Windows7StartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
     this.m_deletedStrips           = new List <Windows7MenuStrip>();
     this.Strips.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Strips_CollectionChanged);
 }
Example #9
0
 public DefaultStartMenuManager(IResourceLibraryCache cache, OemManager oemManager)
     : base(cache, oemManager)
 {
 }