Example #1
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 #2
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;
        }
 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;
 }
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;
 }
 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;
 }