Ejemplo n.º 1
0
 private void TileGridView_ItemClick(object sender, TileGridItem args)
 {
     if (args.Data is PageDescriptor descriptor)
     {
         PageService?.NavigateTo(descriptor.Type);
     }
 }
Ejemplo n.º 2
0
 private void TileGridView_ItemClick(object sender, TileGridItem args)
 {
     if (args.Data is AppListEntry entry)
     {
         AppService.DisplayDialog(
             Common.GetLocalizedText("AppLauncherTitle/Text"),
             Common.GetLocalizedText("AppLauncherDialogPrompt"),
             new DialogButton(Common.GetLocalizedText("YesButton/Content"), async(s, e) => await entry.LaunchAsync())
             );
     }
 }
        private List <TileGridItem> TileItemsFromEditorItems(IList <InterfaceDescriptionEditorItem> editorItems)
        {
            List <TileGridItem> tileItems = new List <TileGridItem>();

            foreach (var item in editorItems)
            {
                TileGridItem tileItem = new TileGridItem();
                tileItem.Row     = item.Row;
                tileItem.Col     = item.Column;
                tileItem.RowSpan = item.RowSpan;
                tileItem.ColSpan = item.ColSpan;
                tileItem.Text    = item.Text;
                if (item.IsEmptyItem)
                {
                    tileItem.BackColor = EmptyItemColor;
                }
                else
                {
                    tileItem.Tag = new object();
                }
                tileItems.Add(tileItem);
            }
            return(tileItems);
        }
Ejemplo n.º 4
0
        private void UpdateApps(ThreadPoolTimer timer = null)
        {
            _updateTimer?.Cancel();
            _updateTimer = null;

            InvokeOnUIThread(async() =>
            {
                try
                {
                    PageService.ShowLoadingPanel();

                    var tiles = new List <TileGridItem>();

                    // <rescap:Capability Name="packageQuery" />
                    var packageManager = new PackageManager();
                    var packages       = packageManager.FindPackagesForUserWithPackageTypes("", PackageTypes.Main);
                    foreach (var package in packages)
                    {
                        IReadOnlyList <AppListEntry> appList = null;
                        try
                        {
                            appList = await package.GetAppListEntriesAsync();
                        }
                        catch
                        {
                            // Ignore bad packages
                            continue;
                        }

                        foreach (AppListEntry entry in appList)
                        {
                            try
                            {
                                var entryName = entry.DisplayInfo.DisplayName;
                                if (ExcludedApps.Contains(entryName))
                                {
                                    continue;
                                }

                                var tile = new TileGridItem
                                {
                                    Width             = _settings.AppTileWidth,
                                    Height            = _settings.AppTileHeight,
                                    Icon              = PageUtil.DefaultPageIcon,
                                    Title             = entryName,
                                    TitleTextWrapping = TextWrapping.Wrap,
                                    BackgroundColor   = new SolidColorBrush(_settings.TileColor),
                                    Data              = entry,
                                };

                                var logo   = entry.DisplayInfo.GetLogo(new Windows.Foundation.Size(150.0, 150.0));
                                tile.Image = new BitmapImage();
                                using (IRandomAccessStreamWithContentType logoStream = await logo.OpenReadAsync())
                                {
                                    await tile.Image.SetSourceAsync(logoStream);
                                }

                                tiles.Add(tile);
                            }
                            catch (Exception ex)
                            {
                                // Ignore bad apps in this package
                                System.Diagnostics.Debug.WriteLine(ex.ToString());
                            }
                        }
                    }

                    AppCollection = tiles;
                }
                catch (Exception ex)
                {
                    AppService.LogService.WriteException(ex);
                }
                finally
                {
                    PageService.HideLoadingPanel();
                }
            });
        }