private void DeleteSelectedEntryPoints() { if (this.m_entryPointList.SelectedItems.Count == 0) { return; } string messageBoxText; if (this.m_entryPointList.SelectedItems.Count > 1) { messageBoxText = "Are you sure you want to delete the selected entry points?"; } else { Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint = (Advent.MediaCenter.StartMenu.OEM.EntryPoint) this.m_entryPointList.SelectedItem; messageBoxText = string.Format("Are you sure you want to delete the {0} entry point?", entryPoint.Title); } MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(messageBoxText, VmcStudioUtil.ApplicationTitle, MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.No); if (messageBoxResult == MessageBoxResult.Yes) { object[] array = new object[this.m_entryPointList.SelectedItems.Count]; this.m_entryPointList.SelectedItems.CopyTo(array, 0); object[] array2 = array; for (int i = 0; i < array2.Length; i++) { Advent.MediaCenter.StartMenu.OEM.EntryPoint item = (Advent.MediaCenter.StartMenu.OEM.EntryPoint)array2[i]; this.m_startMenu.StartMenuManager.OemManager.EntryPoints.Remove(item); } } }
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); } }
internal static void OpenDocument(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { EntryPointDocument openDocument = GetOpenDocument(entryPoint); if (openDocument == null) { openDocument = new EntryPointDocument(entryPoint); VmcStudioUtil.Application.Documents.Add(openDocument); } VmcStudioUtil.Application.SelectedDocument = openDocument; }
public EntryPointDocument(Advent.MediaCenter.StartMenu.OEM.EntryPoint oemEntryPoint) { this.entryPoint = oemEntryPoint; this.IsDirty = oemEntryPoint.IsDirty; this.entryPoint.IsDirtyChanged += (EventHandler) delegate { this.IsDirty = this.entryPoint.IsDirty; }; this.Presenter = new EntryPointPresenter(this.entryPoint); this.Presenter.PropertyChanged += new PropertyChangedEventHandler(this.PresenterPropertyChanged); this.UpdatePresenterProperties(); }
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; }
public EntryPointPresenter(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { this.isImageAutoGenerated = true; this.isInactiveImageAutoGenerated = true; this.entryPoint = entryPoint; this.entryPoint.IsDirtyChanged += (EventHandler)delegate { this.OnPropertyChanged("IsDirty"); }; this.entryPoint.Saving += new EventHandler(this.EntryPointSaving); List<EntryPointCapabilityPresenter> list = new List<EntryPointCapabilityPresenter>(); this.CapabilitiesRequired = (IEnumerable<EntryPointCapabilityPresenter>)list; foreach (EntryPointCapabilities capability in EntryPointPresenter.PossibleCapabilities) list.Add(new EntryPointCapabilityPresenter(this, capability)); if (entryPoint.AddIn != null) { System.Type type = (System.Type)null; try { type = System.Type.GetType(entryPoint.AddIn, false, false); } catch (Exception ex) { Trace.TraceError(((object)ex).ToString()); } if (type == typeof(VmcExecuteAddIn)) { this.ExecutionType = EntryPointType.VmcExecute; this.vmcExecuteInfo = !string.IsNullOrEmpty(this.entryPoint.Context) ? (ExecutionInfo)new XmlSerializer(typeof(ExecutionInfo)).Deserialize((TextReader)new StringReader(this.entryPoint.Context)) : new ExecutionInfo(); if (this.vmcExecuteInfo.CloseKeys == null) this.vmcExecuteInfo.CloseKeys = new List<Keys>(); if (this.vmcExecuteInfo.KillKeys == null) this.vmcExecuteInfo.KillKeys = new List<Keys>(); ObservableCollection<Keys> observableCollection1 = new ObservableCollection<Keys>(this.vmcExecuteInfo.CloseKeys); observableCollection1.CollectionChanged += (NotifyCollectionChangedEventHandler)delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo<Keys>((INotifyCollectionChanged)observableCollection1, (ICollection<Keys>)this.vmcExecuteInfo.CloseKeys); ObservableCollection<Keys> observableCollection2 = new ObservableCollection<Keys>(this.vmcExecuteInfo.KillKeys); observableCollection2.CollectionChanged += (NotifyCollectionChangedEventHandler)delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo<Keys>((INotifyCollectionChanged)observableCollection2, (ICollection<Keys>)this.vmcExecuteInfo.KillKeys); this.CloseKeys = (IList<Keys>)observableCollection1; this.KillKeys = (IList<Keys>)observableCollection2; if (this.vmcExecuteInfo.Media == null) this.vmcExecuteInfo.Media = new List<MediaInfo>(); ObservableCollection<MediaInfoPresenter> observableCollection3 = new ObservableCollection<MediaInfoPresenter>(Enumerable.Select<MediaInfo, MediaInfoPresenter>((IEnumerable<MediaInfo>)this.vmcExecuteInfo.Media, (Func<MediaInfo, MediaInfoPresenter>)(o => MediaInfoPresenter.Create(o)))); observableCollection3.CollectionChanged += (NotifyCollectionChangedEventHandler)delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo<MediaInfo>((INotifyCollectionChanged)observableCollection3, (ICollection<MediaInfo>)this.vmcExecuteInfo.Media, true, (Func<object, MediaInfo>)(o => ((MediaInfoPresenter)o).MediaInfo)); this.Media = observableCollection3; } else this.ExecutionType = EntryPointType.AddIn; } else if (entryPoint.Run != null) { this.ExecutionType = EntryPointType.Exe; } else { if (entryPoint.Url == null) return; this.ExecutionType = EntryPointType.Url; } }
internal static bool IsDocumentOpen(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { return(GetOpenDocument(entryPoint) == null); }
internal static EntryPointDocument GetOpenDocument(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { return(Enumerable.FirstOrDefault <EntryPointDocument>(VmcStudioUtil.Application.Documents.OfType <EntryPointDocument>(), (Func <EntryPointDocument, bool>)(o => (o.Presenter.Model == entryPoint)))); }
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; }
public EntryPointPresenter(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { this.isImageAutoGenerated = true; this.isInactiveImageAutoGenerated = true; this.entryPoint = entryPoint; this.entryPoint.IsDirtyChanged += (EventHandler) delegate { this.OnPropertyChanged("IsDirty"); }; this.entryPoint.Saving += new EventHandler(this.EntryPointSaving); List <EntryPointCapabilityPresenter> list = new List <EntryPointCapabilityPresenter>(); this.CapabilitiesRequired = (IEnumerable <EntryPointCapabilityPresenter>)list; foreach (EntryPointCapabilities capability in EntryPointPresenter.PossibleCapabilities) { list.Add(new EntryPointCapabilityPresenter(this, capability)); } if (entryPoint.AddIn != null) { System.Type type = (System.Type)null; try { type = System.Type.GetType(entryPoint.AddIn, false, false); } catch (Exception ex) { Trace.TraceError(((object)ex).ToString()); } if (type == typeof(VmcExecuteAddIn)) { this.ExecutionType = EntryPointType.VmcExecute; this.vmcExecuteInfo = !string.IsNullOrEmpty(this.entryPoint.Context) ? (ExecutionInfo) new XmlSerializer(typeof(ExecutionInfo)).Deserialize((TextReader) new StringReader(this.entryPoint.Context)) : new ExecutionInfo(); if (this.vmcExecuteInfo.CloseKeys == null) { this.vmcExecuteInfo.CloseKeys = new List <Keys>(); } if (this.vmcExecuteInfo.KillKeys == null) { this.vmcExecuteInfo.KillKeys = new List <Keys>(); } ObservableCollection <Keys> observableCollection1 = new ObservableCollection <Keys>(this.vmcExecuteInfo.CloseKeys); observableCollection1.CollectionChanged += (NotifyCollectionChangedEventHandler) delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo <Keys>((INotifyCollectionChanged)observableCollection1, (ICollection <Keys>) this.vmcExecuteInfo.CloseKeys); ObservableCollection <Keys> observableCollection2 = new ObservableCollection <Keys>(this.vmcExecuteInfo.KillKeys); observableCollection2.CollectionChanged += (NotifyCollectionChangedEventHandler) delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo <Keys>((INotifyCollectionChanged)observableCollection2, (ICollection <Keys>) this.vmcExecuteInfo.KillKeys); this.CloseKeys = (IList <Keys>)observableCollection1; this.KillKeys = (IList <Keys>)observableCollection2; if (this.vmcExecuteInfo.Media == null) { this.vmcExecuteInfo.Media = new List <MediaInfo>(); } ObservableCollection <MediaInfoPresenter> observableCollection3 = new ObservableCollection <MediaInfoPresenter>(Enumerable.Select <MediaInfo, MediaInfoPresenter>((IEnumerable <MediaInfo>) this.vmcExecuteInfo.Media, (Func <MediaInfo, MediaInfoPresenter>)(o => MediaInfoPresenter.Create(o)))); observableCollection3.CollectionChanged += (NotifyCollectionChangedEventHandler) delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo <MediaInfo>((INotifyCollectionChanged)observableCollection3, (ICollection <MediaInfo>) this.vmcExecuteInfo.Media, true, (Func <object, MediaInfo>)(o => ((MediaInfoPresenter)o).MediaInfo)); this.Media = observableCollection3; } else { this.ExecutionType = EntryPointType.AddIn; } } else if (entryPoint.Run != null) { this.ExecutionType = EntryPointType.Exe; } else { if (entryPoint.Url == null) { return; } this.ExecutionType = EntryPointType.Url; } }