private static List <ItemViewModel> GetActualItemsList() { var list = new List <ItemViewModel>(); foreach (var item in SpecialItemRepository.Items) { list.Add(item); } var apps = ApplicationApi.GetAllVisibleApplications(); foreach (var app in apps) { string guid = app.ProductID().ToString().ToLower(); if (guid.Contains("9b921ed5-73a9-4b36-88ea-1b8db509a5be")) { string name = app.Title; string imgpath = app.ImagePath; guid = "{" + guid.ToUpper() + "}"; //bool uninstallable = app.IsUninstallable; //var a = new ApplicationApi.Application(Guid.Parse(guid)); //a.Uninstall(); //Thread.Sleep(3000); } var item = new ItemViewModel(app.Title, app.Author, null); item.ApplicationInfo = app; item.IconUri = app.ApplicationIcon; list.Add(item); } /* * var apps = ApplicationApi.GetAllVisibleApplications(); * foreach (var app in apps) * { * var item = new ItemViewModel(app.Title(), app.Author(), null); * item.ApplicationInfo = app; * item.IconUri = app.ApplicationIcon; * list.Add(item); * }*/ return(list); }
private List <ApplicationViewModel> GetActualApplicationList(ref ApplicationViewModel selectedModel) { var appList = ApplicationApi.GetAllVisibleApplications(); selectedModel = null; System.Text.StringBuilder currentUrl = new System.Text.StringBuilder(300); System.Text.StringBuilder currentUri = new System.Text.StringBuilder(300); int keyCode = 0; int dwCurActionType = (int)KeyAction.ActionType.ACTION_NO; { InteropSvc.InteropLib.Instance.RegistryGetDWORD7(InteropSvc.InteropLib.HKEY_LOCAL_MACHINE, "Software\\OEM\\WebSearchOverride", "ActionType", out dwCurActionType); InteropSvc.InteropLib.Instance.RegistryGetDWORD7(InteropSvc.InteropLib.HKEY_LOCAL_MACHINE, "Software\\OEM\\WebSearchOverride", "KeyCode", out keyCode); InteropSvc.InteropLib.Instance.RegistryGetString7(InteropSvc.InteropLib.HKEY_LOCAL_MACHINE, "Software\\OEM\\WebSearchOverride", "Url", currentUrl, 300); InteropSvc.InteropLib.Instance.RegistryGetString7(InteropSvc.InteropLib.HKEY_LOCAL_MACHINE, "Software\\OEM\\WebSearchOverride", "Uri", currentUri, 300); } var curActionType = (KeyAction.ActionType)dwCurActionType; var list = new List <ApplicationViewModel>(); foreach (var app in predefinedApplications) { list.Add(app); if (app.action.type == curActionType) { bool setSelected = false; if (curActionType == KeyAction.ActionType.ACTION_URL) { if (currentUrl.ToString() == app.action.uri) { setSelected = true; } } else if (curActionType == KeyAction.ActionType.ACTION_RUNAPPLICATION) { if (currentUri.ToString() == app.action.uri) { setSelected = true; } } else if (curActionType == KeyAction.ActionType.ACTION_KEYEVENT) { if (keyCode == app.action.KeyCode) { setSelected = true; } } else { setSelected = true; } if (setSelected) { selectedModel = app; } } } foreach (var item in appList) { var app = new ApplicationViewModel(); app.Title = item.Title(); app.Author = item.Author(); app.action = new KeyAction(); app.action.type = KeyAction.ActionType.ACTION_RUNAPPLICATION; string uri, pageid; item.GetInvocationInfo(out uri, out pageid); app.action.uri = uri; list.Add(app); if (uri == currentUri.ToString()) { selectedModel = app; } } list.Sort(new ApplicationViewModelComparer()); return(list); }