private void EditEntryPointExecuted(object sender, ExecutedRoutedEventArgs e) { Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint = this.m_entryPointList.SelectedItem as Advent.MediaCenter.StartMenu.OEM.EntryPoint; if (entryPoint != null) { EntryPointDocumentView.OpenDocument(entryPoint); } }
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; }
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 UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) { EntryPointDocumentView.OpenDocument(this.OemEntryPoint); }