예제 #1
0
        protected override void Load()
        {
            base.Load();
            this.launchElement = (XmlElement)Enumerable.First <XmlElement>(Enumerable.OfType <XmlElement>((IEnumerable)this.LinkElement.ChildNodes), (Func <XmlElement, bool>)(o => o.Name == "Command")).FirstChild;
            string attribute1 = this.launchElement.GetAttribute("AppId");
            string attribute2 = this.launchElement.GetAttribute("EntryPointId");

            if (string.IsNullOrEmpty(attribute2))
            {
                return;
            }
            EntryPoint entryPoint = this.Manager.OemManager.EntryPoints[attribute2];

            if (entryPoint != null)
            {
                OemQuickLink oemQuickLink = new OemQuickLink(this.Manager.OemManager);
                oemQuickLink.BeginInit();
                oemQuickLink.ApplicationID = attribute1;
                oemQuickLink.EntryPoint    = entryPoint;
                oemQuickLink.EndInit();
                this.OemQuickLink = oemQuickLink;
            }
            else
            {
                Trace.TraceWarning("Entry point " + attribute2 + " not found.");
            }
        }
예제 #2
0
 private void OnDrag(object sender, BeginDragEventArgs e)
 {
     OemQuickLink link = new OemQuickLink(this.OemEntryPoint.Manager);
     link.BeginInit();
     link.Application = this.OemEntryPoint.Application;
     link.EntryPoint = this.OemEntryPoint;
     link.EndInit();
     IDataObject dataObject = Advent.Common.Interop.DataObject.CreateDataObject();
     VmcStudioUtil.DragDropObject = new QuickLinkDrag(link);
     try
     {
         dataObject.DoDragDrop(this, e.DragPoint, DragDropEffects.Move);
     }
     finally
     {
         VmcStudioUtil.DragDropObject = null;
     }
 }
예제 #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;
        }
예제 #4
0
        private void OnDrag(object sender, BeginDragEventArgs e)
        {
            OemQuickLink link = new OemQuickLink(this.OemEntryPoint.Manager);

            link.BeginInit();
            link.Application = this.OemEntryPoint.Application;
            link.EntryPoint  = this.OemEntryPoint;
            link.EndInit();
            IDataObject dataObject = Advent.Common.Interop.DataObject.CreateDataObject();

            VmcStudioUtil.DragDropObject = new QuickLinkDrag(link);
            try
            {
                dataObject.DoDragDrop(this, e.DragPoint, DragDropEffects.Move);
            }
            finally
            {
                VmcStudioUtil.DragDropObject = null;
            }
        }
예제 #5
0
 protected override void Load()
 {
     base.Load();
     this.launchElement = (XmlElement)Enumerable.First<XmlElement>(Enumerable.OfType<XmlElement>((IEnumerable)this.LinkElement.ChildNodes), (Func<XmlElement, bool>)(o => o.Name == "Command")).FirstChild;
     string attribute1 = this.launchElement.GetAttribute("AppId");
     string attribute2 = this.launchElement.GetAttribute("EntryPointId");
     if (string.IsNullOrEmpty(attribute2))
         return;
     EntryPoint entryPoint = this.Manager.OemManager.EntryPoints[attribute2];
     if (entryPoint != null)
     {
         OemQuickLink oemQuickLink = new OemQuickLink(this.Manager.OemManager);
         oemQuickLink.BeginInit();
         oemQuickLink.ApplicationID = attribute1;
         oemQuickLink.EntryPoint = entryPoint;
         oemQuickLink.EndInit();
         this.OemQuickLink = oemQuickLink;
     }
     else
         Trace.TraceWarning("Entry point " + attribute2 + " not found.");
 }
예제 #6
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;
        }
예제 #7
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;
 }
예제 #8
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;
 }