foreach (ApplicationInfo appInfo in applicationList)
{
- result = new string[3];
+ if (appInfo.Label == null ||
+ appInfo.ApplicationId == null)
+ {
+ continue;
+ }
- result[0] = (appInfo.Label != null) ? appInfo.Label : null;
- result[1] = (appInfo.ApplicationId != null) ? appInfo.ApplicationId : null;
+ result = new string[3];
+ result[0] = appInfo.Label;
+ result[1] = appInfo.ApplicationId;
result[2] = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon;
resultList.Add(appInfo.ApplicationId, result);
}
Task<IEnumerable<ApplicationInfo>> task = ApplicationManager.GetInstalledApplicationsAsync();
string[] result;
- if (task == null)
- {
- DebuggingPort.D("GetInstalledApplication failed");
- return null;
- }
-
IEnumerable<ApplicationInfo> installedList = await task;
foreach (var appInfo in installedList)
{
- if (appInfo.IsNoDisplay)
+ if (appInfo.Label == null ||
+ appInfo.ApplicationId == null ||
+ appInfo.IsNoDisplay)
{
continue;
}
result = new string[3];
- result[0] = (appInfo.Label != null) ? appInfo.Label : null;
- result[1] = (appInfo.ApplicationId != null) ? appInfo.ApplicationId : null;
+ result[0] = appInfo.Label;
+ result[1] = appInfo.ApplicationId;
result[2] = (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : DefaultAppIcon;
resultList.Add(appInfo.ApplicationId, result);
}
foreach (var item in packages)
{
- result = new string[3];
+ if (item.Label == null ||
+ item.Id == null)
+ {
+ continue;
+ }
- result[0] = (item.Label != null) ? item.Label : null;
- result[1] = (item.Id != null) ? item.Id : null;
+ result = new string[3];
+ result[0] = item.Label;
+ result[1] = item.Id;
result[2] = (System.IO.File.Exists(item.IconPath)) ? item.IconPath : "AppIcon.png";
pkgList.Add(item.Label, result);
if (PinnedApps.ContainsKey(key))
{
DebuggingUtils.Dbg("UnPin!");
- InstalledApps.FirstOrDefault(a => a.AppID == key).SetChecked(false);
- InstalledApps.FirstOrDefault(a => a.AppID == key).SetPinned(false);
+ InstalledApps.FirstOrDefault(a => a.AppID == key)?.SetChecked(false);
+ InstalledApps.FirstOrDefault(a => a.AppID == key)?.SetPinned(false);
PinnedApps.Remove(key);
}
else
{
DebuggingUtils.Dbg("Pin!");
- InstalledApps.FirstOrDefault(a => a.AppID == key).SetChecked(true);
- InstalledApps.FirstOrDefault(a => a.AppID == key).SetPinned(true);
+ InstalledApps.FirstOrDefault(a => a.AppID == key)?.SetChecked(true);
+ InstalledApps.FirstOrDefault(a => a.AppID == key)?.SetPinned(true);
PinnedApps.Add(key, key);
}
}
{
switch (status)
{
- case HomeStatus.Default:
- break;
case HomeStatus.MainPanelFocused:
PageMainPanel.ShowPanel();
SelectMenu(SelectedMenuName);
case HomeStatus.SubPanelFocused:
PageMainPanel.SelectPanel();
break;
- case HomeStatus.Move:
- break;
- case HomeStatus.UnPin:
- break;
}
}