當前位置: 首頁>>代碼示例>>C#>>正文


C# SecondaryTile.RequestCreateAsync方法代碼示例

本文整理匯總了C#中Windows.UI.StartScreen.SecondaryTile.RequestCreateAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# SecondaryTile.RequestCreateAsync方法的具體用法?C# SecondaryTile.RequestCreateAsync怎麽用?C# SecondaryTile.RequestCreateAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.UI.StartScreen.SecondaryTile的用法示例。


在下文中一共展示了SecondaryTile.RequestCreateAsync方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PinSecondaryTileAsync

        public static async Task PinSecondaryTileAsync(string id, string displayName, string arguments, TileSize tileSize)
        {
            if(IsPinned(id))
            {
                return;
            }

            Uri logo = new Uri("ms-appx:///assets/Logo.scale-100.jpg");
            Uri wideLogo = new Uri("ms-appx:///assets/WideLogo.scale-100.jpg");

            SecondaryTile secondaryTile = new SecondaryTile(id,
                                                            displayName,
                                                            "MGTV://" + arguments,
                                                            logo,
                                                            tileSize);

            secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;
            secondaryTile.VisualElements.ShowNameOnWide310x150Logo = true;
            secondaryTile.VisualElements.ShowNameOnSquare310x310Logo = true;

            secondaryTile.VisualElements.Wide310x150Logo = wideLogo;
            secondaryTile.VisualElements.Square150x150Logo = logo;

            secondaryTile.VisualElements.ForegroundText = ForegroundText.Dark;

            await secondaryTile.RequestCreateAsync();
        }
開發者ID:Yardley999,項目名稱:MGTV,代碼行數:27,代碼來源:LiveTileHelper.cs

示例2: HomePage_Loaded

        async void HomePage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            //secondary tile
            var secondaryTileId = "AdminPage";
            if (!SecondaryTile.Exists(secondaryTileId))
            {
                Uri square150x150Logo = new Uri("ms-appx:///Assets/150winAdmin.png");
                Uri square30x30Logo = new Uri("ms-appx:///Assets/30winAdmin.png");
                string tileActivationArguments = secondaryTileId + " was pinned at = " + DateTime.Now.ToLocalTime().ToString();
                string displayName = "IndiaRose.Admin";

                TileSize newTileDesiredSize = TileSize.Square150x150;

                SecondaryTile secondaryTile = new SecondaryTile(secondaryTileId,
                                                                displayName,
                                                                tileActivationArguments,
                                                                square150x150Logo,
                                                                newTileDesiredSize);

               
                
                secondaryTile.VisualElements.Square30x30Logo = square30x30Logo;
                secondaryTile.VisualElements.ForegroundText = ForegroundText.Dark;
                secondaryTile.BackgroundColor = Colors.CornflowerBlue;
                await secondaryTile.RequestCreateAsync();
            }
        }
開發者ID:india-rose,項目名稱:xamarin-indiarose,代碼行數:27,代碼來源:HomePage.xaml.cs

示例3: CreateTileIfNotExist

        public static async Task<bool> CreateTileIfNotExist(Feed feed)
        {
            // 既にタイルが存在する場合は何もしない
            if (SecondaryTile.Exists(feed.Id))
            {
                return false;
            }

            // セカンダリタイルを作成
            var tile = new SecondaryTile(
                // タイルのId
                feed.Id,
                // タイルの短い名前
                feed.Title,
                // タイルの表示名
                feed.Title,
                // タイルからアプリケーションを起動したときに渡される引數
                feed.Id,
                // タイルの名前の表示方法を指定
                TileOptions.ShowNameOnLogo,
                // タイルのロゴを指定
                new Uri("ms-appx:///Assets/Logo.png"));
            // ユーザーにタイルの作成をリクエスト
            return await tile.RequestCreateAsync();
        }
開發者ID:runceel,項目名稱:metroapps,代碼行數:25,代碼來源:FeedTileUtils.cs

示例4: PinDocumentTile

        public async Task<bool> PinDocumentTile(Document document)
        {
            string tileId = document.ID.ToString();

            string arguements = tileId + "/" + "Document";

            string displayName = document.DocumentName;

            bool isPinned = false;

            if (!SecondaryTile.Exists(tileId))
            {
                var secondaryTile = new SecondaryTile();

                secondaryTile.TileId = tileId;

                secondaryTile.ShortName = "2nd tile";

                secondaryTile.DisplayName = displayName;

                secondaryTile.Arguments = arguements;

                secondaryTile.Logo = new Uri("ms-appdata:///local/картинка031.jpg");

                isPinned = await secondaryTile.RequestCreateAsync();

                return isPinned;
            }

            return isPinned;
        }
開發者ID:Snail34,項目名稱:MobileScanner,代碼行數:31,代碼來源:TileProvider.cs

示例5: PinToStart

        /// <summary>
        /// Create and pin a secondary square Tile.
        /// </summary>
        /// <param name="tileId"></param>
        /// <param name="shortName"></param>
        /// <param name="image"></param>
        /// <param name="arguments"></param>
        /// <returns></returns>
        public async Task<bool> PinToStart(string tileId, string shortName, Uri image, string arguments)
        {
            // Create the unique tileId
            var id = Regex.Replace(tileId, @"[^\d\w\s]", "-").
                     Replace(" ", string.Empty) + ".LiveTile";

            //Check first if Tile exists
            if (!SecondaryTileExists(id))
            {
                //Create a secondary Tile
                var secondaryTile = new SecondaryTile(id, shortName, shortName, image, TileSize.Default);

#if WINDOWS_PHONE_APP     
                bool isPinned = await secondaryTile.RequestCreateAsync();
#else
                // Position of the modal dialog 
                GeneralTransform buttonTransform = App.Frame.TransformToVisual(null);
                Point point = buttonTransform.TransformPoint(new Point());
                var rect = new Rect(point, new Size(App.Frame.ActualWidth, App.Frame.ActualHeight));

                //Pin
                bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(rect, Placement.Below);
#endif

                return isPinned;
            }

            return true;
        }
開發者ID:JavierErdozain,項目名稱:Events,代碼行數:37,代碼來源:TileService.cs

示例6: PinAndUpdate_Click

        private async void PinAndUpdate_Click(object sender, RoutedEventArgs e)
        {
            // Create the original Square150x150 tile
            var tile = new SecondaryTile(SCENARIO1_TILEID, "Scenario 1", "/MainPage.xaml?scenario=Scenario1", new Uri("ms-appx:///Assets/originalTileImage.png"), TileSize.Default);
            tile.VisualElements.ShowNameOnSquare150x150Logo = true;
            await tile.RequestCreateAsync();

            // When a new tile is created, the app will be deactivated and the new tile will be displayed to the user on the start screen.
            // Any code after the call to RequestCreateAsync is not guaranteed to run. 
            // For example, a common scenario is to associate a push channel with the newly created tile,
            // which involves a call to WNS to get a channel using the CreatePushNotificationChannelForSecondaryTileAsync() asynchronous operation. 
            // Another example is updating the secondary tile with data from a web service. Both of these are examples of actions that may not
            // complete before the app is deactivated. To illustrate this, we'll create a delay and then attempt to update our secondary tile.

            
            // If the app is deactivated before reaching this point, the following code will never run.

            // Update the tile we created using a notification.
            var tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Image);

            // The TileSquare150x150Image template only contains one image entry, so retrieve it.
            var imageElement = tileXml.GetElementsByTagName("image").Single();

            // Set the src propertry on the image entry.
            imageElement.Attributes.GetNamedItem("src").NodeValue = "ms-appx:///Assets/updatedTileImage.png";

            // Create a new tile notification.
            var notification = new Windows.UI.Notifications.TileNotification(tileXml);

            // Create a tile updater.
            var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(SCENARIO1_TILEID);

            // Send the update notification for the tile. 
            updater.Update(notification);
        }
開發者ID:SoftwareFactoryUPC,項目名稱:ProjectTemplates,代碼行數:35,代碼來源:Scenario1_Inline.xaml.cs

示例7: CreateNormalTiles

        public async static void CreateNormalTiles(TilePropertyModel tileProperty)
        {

            Uri uri = new Uri("ms-appx:///Assets/bird.png", UriKind.RelativeOrAbsolute);
            var tile = new SecondaryTile();
            tile.Arguments = tileProperty.Arguments;
            tile.DisplayName = tileProperty.DisplayName;
            tile.PhoneticName = tileProperty.PhoneticName;
            tile.TileId = tileProperty.TileId;
            
            tile.VisualElements.BackgroundColor = Color.FromArgb(255, 34, 32, 222);
            tile.VisualElements.ForegroundText = ForegroundText.Light;
            tile.VisualElements.ShowNameOnSquare150x150Logo = true;
            tile.VisualElements.ShowNameOnSquare310x310Logo = true;
            tile.VisualElements.ShowNameOnWide310x150Logo = true;
            tile.VisualElements.Square150x150Logo = uri;
            tile.VisualElements.Square30x30Logo = uri;
            tile.VisualElements.Square310x310Logo = uri;
            //tile.VisualElements.Square70x70Logo = uri;
            tile.VisualElements.Square71x71Logo = uri;
            tile.VisualElements.Wide310x150Logo = uri;
            if (await tile.RequestCreateAsync())
            {
                System.Diagnostics.Debug.WriteLine("a tile has been created");
            }
        }
開發者ID:fqncom,項目名稱:tomcraporigami,代碼行數:26,代碼來源:CommonHelper.cs

示例8: CreateSubredditTile

        /// <summary>
        /// Creates a secondary tile given a subreddit.
        /// </summary>
        /// <param name="subreddit"></param>
        /// <returns></returns>
        public async Task<bool> CreateSubredditTile(Subreddit subreddit)
        {
            // If it already exists get out of here.
            if (IsSubredditPinned(subreddit.DisplayName))
            {
                return true;
            }

            // Try to make the tile
            SecondaryTile tile = new SecondaryTile();
            tile.DisplayName = subreddit.DisplayName;
            tile.TileId = c_subredditTitleId + subreddit.DisplayName;
            tile.Arguments = c_subredditOpenArgument + subreddit.DisplayName;

            // Set the visuals
            tile.VisualElements.Square150x150Logo = new Uri("ms-appx:///Assets/AppAssets/Square150x150/Square150.png", UriKind.Absolute);
            tile.VisualElements.Square310x310Logo = new Uri("ms-appx:///Assets/AppAssets/Square310x310/Square210.png", UriKind.Absolute);
            tile.VisualElements.Square44x44Logo = new Uri("ms-appx:///Assets/AppAssets/Square44x44/Square44.png", UriKind.Absolute);
            tile.VisualElements.Square71x71Logo = new Uri("ms-appx:///Assets/AppAssets/Square71x71/Square71.png", UriKind.Absolute);
            tile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///Assets/AppAssets/Wide310x310/Wide310.png", UriKind.Absolute);
            tile.VisualElements.ShowNameOnSquare150x150Logo = true;
            tile.VisualElements.ShowNameOnSquare310x310Logo = true;
            tile.VisualElements.ShowNameOnWide310x150Logo = true;
            tile.RoamingEnabled = true;

            // Request the create.
            return await tile.RequestCreateAsync();
        }
開發者ID:Arthur-Lee,項目名稱:Baconit,代碼行數:33,代碼來源:TileManager.cs

示例9: Pin

        public async void Pin()
        {
            var tileId = Artist.Id.ToString();

            var tile = new SecondaryTile(tileId)
            {
                DisplayName = Artist.Name,
                VisualElements =
                {
                    BackgroundColor = Color.FromArgb(255, 7, 96, 110),
                    Square150x150Logo = new Uri("ms-appx:///Assets/Logo.png"),
                    ShowNameOnSquare150x150Logo = true,
                    Wide310x150Logo = new Uri("ms-appx:///Assets/WideLogo.png"),
                    ShowNameOnWide310x150Logo = true,
                    ForegroundText = ForegroundText.Light
                },
                Arguments = Artist.Id.ToString()
            };

            await tile.RequestCreateAsync();

            var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);
            var template = await GetTemplateDocumentAsync();

            var notification = new TileNotification(template);

            updater.Update(notification);
        }
開發者ID:krisgithub123,項目名稱:windows-10-demos,代碼行數:28,代碼來源:ReleaseDetailsViewModel.cs

示例10: PinToStart

        public async Task PinToStart() {
            var logo = new Uri("ms-appx:///Assets/Logo.png");

            var secondaryTile = new SecondaryTile(Guid.NewGuid().ToString(), _list.Title, _list.Id.ToString(), logo, TileSize.Square150x150);
            secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;
            await secondaryTile.RequestCreateAsync();
        }
開發者ID:skallab78,項目名稱:solid-navigation-dwx-2015,代碼行數:7,代碼來源:TasksPageViewModel.cs

示例11: PinAsync

        /// <summary>
        /// Create the secondary tile
        /// </summary>
        /// <param name="element">Element to pin</param>
        public async Task PinAsync(PinnableObject element)
        {
            SecondaryTile tile = new SecondaryTile
            {
                TileId = element.Id,
                ShortName = element.Title,
                DisplayName = element.Title,
                Arguments = element.Id,
                TileOptions = TileOptions.ShowNameOnLogo,
                Logo = new Uri("ms-appx:///Assets/Logo.png")
            };

            if (await tile.RequestCreateAsync())
            {
                // Tile template definition
                ITileSquarePeekImageAndText04 squareContent = TileContentFactory.CreateTileSquarePeekImageAndText04();
                squareContent.TextBodyWrap.Text = element.Content;
                squareContent.Image.Src = element.ImageUrl;
                squareContent.Image.Alt = element.Content;

                // Tile creation
                TileNotification tileNotification = squareContent.CreateNotification();

                // Send the notification
                TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(element.Id);
                tileUpdater.Update(tileNotification);

            }
        }
開發者ID:EPSILab,項目名稱:SolarSystem-Saturn,代碼行數:33,代碼來源:CreateSecondaryTileHelper.cs

示例12: UpdateMedium

        private async void UpdateMedium(TileBindingContentAdaptive mediumContent)
        {
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = mediumContent
                    }
                }
            };

            try
            {
                TileUpdateManager.CreateTileUpdaterForSecondaryTile("SecondaryTile").Update(new TileNotification(content.GetXml()));
            }

            catch
            {
                SecondaryTile tile = new SecondaryTile("SecondaryTile", "Example", "args", new Uri("ms-appx:///Assets/Logo.png"), TileSize.Default);
                tile.VisualElements.ShowNameOnSquare150x150Logo = true;
                tile.VisualElements.ShowNameOnSquare310x310Logo = true;
                tile.VisualElements.ShowNameOnWide310x150Logo = true;
                tile.VisualElements.BackgroundColor = Colors.Transparent;
                await tile.RequestCreateAsync();

                TileUpdateManager.CreateTileUpdaterForSecondaryTile("SecondaryTile").Update(new TileNotification(content.GetXml()));
            }
        }
開發者ID:androllen,項目名稱:NotificationsExtensions,代碼行數:30,代碼來源:TilesPage.xaml.cs

示例13: SetLiveTileToSingleImage

            static async void SetLiveTileToSingleImage(string wideImageFileName, string mediumImageFileName)
            {
                // Construct the tile content as a string
                string content = [email protected]"
                                <tile>
                                    <visual> 
                                        <binding template='TileSquareImage'>
                                           <image id='1' src='ms-appdata:///local/{mediumImageFileName}' />
                                        </binding> 
                                         <binding  template='TileWideImage' branding='none'>
                                           <image id='1' src='ms-appdata:///local/{wideImageFileName}' />
                                        </binding>
 
                                    </visual>
                                </tile>";

            SecondaryTile sec = new SecondaryTile("tile", "","prof2", new Uri("ms-appdata:///local/{mediumImageFileName}"), TileSize.Square150x150);
            await sec.RequestCreateAsync();
                // Load the string into an XmlDocument
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(content);

                // Then create the tile notification
                var notification = new TileNotification(doc);
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(sec.TileId).Update(notification);

        }
開發者ID:Romaxaqaz,項目名稱:Onliner,代碼行數:27,代碼來源:LiveTileBuilder.cs

示例14: PinToStart

        public async Task PinToStart() {
            var logo = new Uri("ms-appx:///Assets/Logo.png");

            var target = new TaskListTarget(_list.Id);
            var url = Router.Current.CreateUrl(target);

            var secondaryTile = new SecondaryTile(Guid.NewGuid().ToString(), _list.Title, url, logo, TileSize.Square150x150);
            secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;
            await secondaryTile.RequestCreateAsync();
        }
開發者ID:skallab78,項目名稱:solid-navigation-dwx-2015,代碼行數:10,代碼來源:TasksPageViewModel.cs

示例15: PinWideSecondaryTile

        public async Task<bool> PinWideSecondaryTile(string tileId, string shortName, string displayName, string arguments) {
            if (!SecondaryTileExists(tileId)) {
                var secondaryTile = new SecondaryTile(tileId, shortName, displayName, arguments, TileOptions.ShowNameOnWideLogo, _squareLogoUri, _wideLogoUri);
                bool isPinned = await secondaryTile.RequestCreateAsync();

                return isPinned;
            }

            return true;
        }
開發者ID:ronlemire2,項目名稱:PrismRT-CodeGen,代碼行數:10,代碼來源:SecondaryTileService.cs


注:本文中的Windows.UI.StartScreen.SecondaryTile.RequestCreateAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。