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


C# SecondaryTile.RequestCreateForSelectionAsync方法代碼示例

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


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

示例1: Pin

		public async Task<bool> Pin(TileInfo tileInfo)
		{
			if (tileInfo == null)
			{
				throw new ArgumentNullException("tileInfo");
			}

			var isPinned = false;

			if (!SecondaryTile.Exists(tileInfo.TileId))
			{
				var secondaryTile = new SecondaryTile(
					tileInfo.TileId,
					tileInfo.DisplayName,
					tileInfo.Arguments,
					tileInfo.LogoUri,
					tileInfo.TileSize);

				if (tileInfo.WideLogoUri != null)
				{
					secondaryTile.VisualElements.Wide310x150Logo = tileInfo.WideLogoUri;
				}

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

				isPinned = await secondaryTile.RequestCreateForSelectionAsync(
						GetElementRect(tileInfo.AnchorElement), tileInfo.RequestPlacement);
			}

			return isPinned;
		}
開發者ID:brentedwards,項目名稱:Charmed,代碼行數:33,代碼來源:SecondaryPinner.cs

示例2: CreateBadgeAndTextTile_Click

        private async void CreateBadgeAndTextTile_Click(object sender, RoutedEventArgs e)
        {
            if (!SecondaryTile.Exists(TEXT_TILE_ID))
            {
                SecondaryTile secondTile = new SecondaryTile(
                    TEXT_TILE_ID,
                    "LockScreen CS - Badge and tile text",
                    "TEXT_ARGS",
                    new Uri("ms-appx:///images/squareTile-sdk.png"),
                    TileSize.Wide310x150
                );
                secondTile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///images/tile-sdk.png");
                secondTile.LockScreenBadgeLogo = new Uri("ms-appx:///images/badgelogo-sdk.png");
                secondTile.LockScreenDisplayBadgeAndTileText = true;

                bool isPinned = await secondTile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement) sender), Placement.Above);
                if (isPinned)
                {
                    ITileWide310x150Text03 tileContent = TileContentFactory.CreateTileWide310x150Text03();
                    tileContent.TextHeadingWrap.Text = "Text for the lock screen";
                    tileContent.RequireSquare150x150Content = false;
                    TileUpdateManager.CreateTileUpdaterForSecondaryTile(TEXT_TILE_ID).Update(tileContent.CreateNotification());
                    rootPage.NotifyUser("Secondary tile created and updated. Go to PC settings to add it to the lock screen.", NotifyType.StatusMessage);
                }
                else
                {
                    rootPage.NotifyUser("Tile not created.", NotifyType.ErrorMessage);
                }

            }
            else
            {
                rootPage.NotifyUser("Badge and text secondary tile already exists.", NotifyType.ErrorMessage);
            }
        }
開發者ID:oldnewthing,項目名稱:old-Windows8-samples,代碼行數:35,代碼來源:ScenarioInput3.xaml.cs

示例3: Pin

        public async Task<bool> Pin(TileInfo info)
        {
            System.Diagnostics.Contracts.Contract.Requires(info != null, "TileInfo");
            if (Exists(info))
                return true;

            var tile = new SecondaryTile()
            {
                TileId = info.TileId,
                DisplayName = info.DisplayName,
                Arguments = info.Arguments,
                PhoneticName = info.PhoneticName,
                LockScreenDisplayBadgeAndTileText = info.LockScreenDisplayBadgeAndTileText,
                LockScreenBadgeLogo = info.LockScreenBadgeLogo,
            };

            tile.VisualElements.BackgroundColor = info.VisualElements.BackgroundColor;
            tile.VisualElements.ForegroundText = info.VisualElements.ForegroundText;
            tile.VisualElements.ShowNameOnSquare150x150Logo = info.VisualElements.ShowNameOnSquare150x150Logo;
            tile.VisualElements.ShowNameOnSquare310x310Logo = info.VisualElements.ShowNameOnSquare310x310Logo;
            tile.VisualElements.ShowNameOnWide310x150Logo = info.VisualElements.ShowNameOnWide310x150Logo;
            tile.VisualElements.Square150x150Logo = info.VisualElements.Square150x150Logo;
            tile.VisualElements.Square30x30Logo = info.VisualElements.Square30x30Logo;
            tile.VisualElements.Square310x310Logo = info.VisualElements.Square310x310Logo;
            tile.VisualElements.Square70x70Logo = info.VisualElements.Square70x70Logo;
            tile.VisualElements.Wide310x150Logo = info.VisualElements.Wide310x150Logo;

            var result = await tile.RequestCreateForSelectionAsync(info.Rect(), info.RequestPlacement);
            return result;
        }
開發者ID:K-Tobin15,項目名稱:Tutorials,代碼行數:30,代碼來源:SecondaryTileService.cs

示例4: 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

示例5: CreateBadgeTile_Click

        private async void CreateBadgeTile_Click(object sender, RoutedEventArgs e)
        {
            if (!SecondaryTile.Exists(BADGE_TILE_ID)) {
                SecondaryTile secondTile = new SecondaryTile(
                    BADGE_TILE_ID,
                    "LockScreen CS - Badge only",
                    "BADGE_ARGS",
                    new Uri("ms-appx:///images/squareTile-sdk.png"),
                    TileSize.Square150x150
                );
                secondTile.LockScreenBadgeLogo = new Uri("ms-appx:///images/badgelogo-sdk.png");

                bool isPinned = await secondTile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement) sender), Placement.Above);
                if (isPinned)
                {
                    BadgeNumericNotificationContent badgeContent = new BadgeNumericNotificationContent(2);
                    BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile(BADGE_TILE_ID).Update(badgeContent.CreateNotification());
                    rootPage.NotifyUser("Secondary tile created and badge updated. Go to PC settings to add it to the lock screen.", NotifyType.StatusMessage);
                }
                else 
                {
                    rootPage.NotifyUser("Tile not created.", NotifyType.ErrorMessage);
                }
                
            } else {
                rootPage.NotifyUser("Badge secondary tile already exists.", NotifyType.ErrorMessage);
            }
        }
開發者ID:oldnewthing,項目名稱:old-Windows8-samples,代碼行數:28,代碼來源:ScenarioInput3.xaml.cs

示例6: Pin

		public async Task<bool> Pin(TileInfo tileInfo)
		{
			if (tileInfo == null)
			{
				throw new ArgumentNullException("tileInfo");
			}

			var isPinned = false;

			if (!SecondaryTile.Exists(tileInfo.TileId))
			{
				var secondaryTile = new SecondaryTile(
					tileInfo.TileId,
					tileInfo.ShortName,
					tileInfo.DisplayName,
					tileInfo.Arguments,
					tileInfo.TileOptions,
					tileInfo.LogoUri);

				if (tileInfo.WideLogoUri != null)
				{
					secondaryTile.WideLogo = tileInfo.WideLogoUri;
				}

				isPinned = await secondaryTile.RequestCreateForSelectionAsync(
						GetElementRect(tileInfo.AnchorElement), tileInfo.RequestPlacement);
			}

			return isPinned;
		}
開發者ID:slodge,項目名稱:Charmed,代碼行數:30,代碼來源:Win8SecondaryPinner.cs

示例7: CreateSecondaryTile

        public async Task<bool> CreateSecondaryTile(Category category, Rect rect)
        {
            var firstProduct = category.Products.First();
            var tile = new SecondaryTile(category.TileId, "ShopNow", 
                category.Name, "category=" + category.Name, 
                TileOptions.ShowNameOnLogo, new Uri(firstProduct.ThumbnailImage));

            tile.ForegroundText = ForegroundText.Dark;

            return await tile.RequestCreateForSelectionAsync(rect, Placement.Above);
        }
開發者ID:bendewey,項目名稱:ShopNow,代碼行數:11,代碼來源:SecondaryTileCreator.cs

示例8: PinAsync

        public async Task<bool> PinAsync(TileInfo info, string tileId, string arguments)
        {
            System.Diagnostics.Contracts.Contract.Requires(info != null, "TileInfo");
            System.Diagnostics.Contracts.Contract.Requires(!string.IsNullOrEmpty(tileId), "TileId");

            if (Exists(tileId))
            {
                var existings = await SecondaryTile.FindAllAsync();
                var existing = existings.FirstOrDefault(x => x.Arguments.Equals(arguments));
            }

            var tile = new SecondaryTile()
            {
                TileId = tileId,
                DisplayName = info.DisplayName,
                Arguments = arguments,
                PhoneticName = info.PhoneticName,
                LockScreenDisplayBadgeAndTileText = info.LockScreenDisplayBadgeAndTileText,
            };

            if (info.LockScreenBadgeLogo != null)
            {
                tile.LockScreenBadgeLogo = info.LockScreenBadgeLogo;
            }

            tile.VisualElements.BackgroundColor = info.VisualElements.BackgroundColor;
            tile.VisualElements.ForegroundText = info.VisualElements.ForegroundText;
            tile.VisualElements.ShowNameOnSquare150x150Logo = info.VisualElements.ShowNameOnSquare150x150Logo;
            tile.VisualElements.ShowNameOnSquare310x310Logo = info.VisualElements.ShowNameOnSquare310x310Logo;
            tile.VisualElements.ShowNameOnWide310x150Logo = info.VisualElements.ShowNameOnWide310x150Logo;

            if (info.VisualElements.Square150x150Logo != null)
            {
                tile.VisualElements.Square150x150Logo = info.VisualElements.Square150x150Logo;
            }

            if (info.VisualElements.Square30x30Logo != null)
            {
                tile.VisualElements.Square30x30Logo = info.VisualElements.Square30x30Logo;
            }

            if (info.VisualElements.Square310x310Logo != null)
            {
                tile.VisualElements.Square310x310Logo = info.VisualElements.Square310x310Logo;
            }

            if (info.VisualElements.Wide310x150Logo != null)
            {
                tile.VisualElements.Wide310x150Logo = info.VisualElements.Wide310x150Logo;
            }

            var result = await tile.RequestCreateForSelectionAsync(info.Rect(), info.RequestPlacement);
            return result;
        }
開發者ID:eyzae,項目名稱:Template10,代碼行數:54,代碼來源:SecondaryTileHelper.cs

示例9: btnPin_Click

        async private void btnPin_Click(object sender, RoutedEventArgs e)
        {
            this.bottomAppBar.IsSticky = true;
            string shortName = "Testing";
            string displayName = "Description";
            string tileActivationArguments = "Item=1";
            Uri logo = new Uri("ms-appx:///Assets/TestPin.jpg");

            int uniqueId = 1; //Assign an unique id for the tile. Suggestion: Use the Pk of your base table

            SecondaryTile secondaryTile = new SecondaryTile("Pin_" + uniqueId.ToString(),
                                                shortName,
                                                displayName,
                                                tileActivationArguments,
                                                TileOptions.ShowNameOnWideLogo,
                                                logo,
                                                logo);

            secondaryTile.ForegroundText = ForegroundText.Light;
            secondaryTile.SmallLogo = new Uri("ms-appx:///Assets/SmallLogo.png");

            FrameworkElement internalSender = (FrameworkElement)this.btnPin;
            Windows.UI.Xaml.Media.GeneralTransform buttonTransform = internalSender.TransformToVisual(null);
            Windows.Foundation.Point point = buttonTransform.TransformPoint(new Point());
            Windows.Foundation.Rect rect = new Rect(point, new Size(250, 250));

            bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(rect, Windows.UI.Popups.Placement.Above);
            this.bottomAppBar.IsSticky = false;

            if (isPinned)
            {
                // Note: This sample contains an additional reference, NotificationsExtensions, which you can use in your apps
                ITileWideText04 tileContent = TileContentFactory.CreateTileWideText04();
                tileContent.TextBodyWrap.Text = "Sent to a secondary tile from NotificationsExtensions!";

                ITileSquareText04 squareContent = TileContentFactory.CreateTileSquareText04();
                squareContent.TextBodyWrap.Text = "Sent to a secondary tile from NotificationExtensions!";
                tileContent.SquareContent = squareContent;

                // Send the notification to the secondary tile by creating a secondary tile updater
                TileUpdateManager.CreateTileUpdaterForSecondaryTile("Pin_" + uniqueId.ToString()).Update(tileContent.CreateNotification());

                this.btnPin.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                this.btnUnpin.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
        }
開發者ID:soreygarcia,項目名稱:Toolbox,代碼行數:46,代碼來源:MainPage.xaml.cs

示例10: PinPoll

		public async Task<bool> PinPoll(FrameworkElement anchorElement, int pollId, string question)
		{
			var isPinned = false;
			Uri logoUri = new Uri("ms-appx:///Assets/Logo.png");

			var tileId = string.Format(SecondaryPinner.TileIdFormat, pollId);
			if (!SecondaryTile.Exists(tileId))
			{
				var secondaryTile = new SecondaryTile(
					tileId,
					question,
					pollId.ToString(),
					logoUri,
					TileSize.Default);

				isPinned = await secondaryTile.RequestCreateForSelectionAsync(
						GetElementRect(anchorElement), Placement.Above);
			}

			return isPinned;
		}
開發者ID:JacobAtchley,項目名稱:MyVote,代碼行數:21,代碼來源:SecondaryPinner.cs

示例11: btnPin_Click

        async private void btnPin_Click(object sender, RoutedEventArgs e)
        {
            if (selectedTrip.LocalPathImage == loader.GetString("DefaultParentImage"))
            {
                await App.ShowSimpleMessage("Please, select a custom image for your trip.", "Default Image");
            }
            else
            {
                this.bottomAppBar.IsSticky = true;
                string shortName = selectedTrip.Title;
                string displayName = selectedTrip.Description;
                string tileActivationArguments = "Trip=" + selectedTrip.Identifier.ToString();
                Uri logo = new Uri(selectedTrip.LocalPathImage);

                SecondaryTile secondaryTile = new SecondaryTile("SuggesMePin_" + selectedTrip.Identifier.ToString(),
                                                    shortName,
                                                    displayName,
                                                    tileActivationArguments,
                                                    TileOptions.ShowNameOnWideLogo,
                                                    logo,
                                                    logo);

                secondaryTile.ForegroundText = ForegroundText.Light;
                secondaryTile.SmallLogo = new Uri("ms-appx:///Assets/SmallLogoWithBackground.png");

                FrameworkElement internalSender = (FrameworkElement)this.btnPin;
                Windows.UI.Xaml.Media.GeneralTransform buttonTransform = internalSender.TransformToVisual(null);
                Windows.Foundation.Point point = buttonTransform.TransformPoint(new Point());
                Windows.Foundation.Rect rect = new Rect(point, new Size(250, 250));

                bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(rect, Windows.UI.Popups.Placement.Above);
                this.bottomAppBar.IsSticky = false;

                if (isPinned)
                    this.btnPin.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
        }
開發者ID:soreygarcia,項目名稱:Sugges.me,代碼行數:37,代碼來源:ItemDetailPage.xaml.cs

示例12: CreateOrUpdateSecondaryTileAsync

        private async Task<bool> CreateOrUpdateSecondaryTileAsync(SecondaryTile tile, TileVisualOptions options)
        {
            if (tile == null)
                return false;

            tile.VisualElements.ShowNameOnSquare150x150Logo = true;

            tile.VisualElements.Square71x71Logo = options.Square71x71Logo ?? null;
            tile.VisualElements.Square150x150Logo = options.Square150x150Logo ?? null;

            if (!(ApiInformation.IsTypePresent(("Windows.Phone.UI.Input.HardwareButtons"))))
            {
                tile.VisualElements.Wide310x150Logo = options.Wide310x150Logo ?? null;
                tile.VisualElements.Square310x310Logo = options.Square310x310Logo ?? null;
                tile.VisualElements.ShowNameOnWide310x150Logo = true;
                tile.VisualElements.ShowNameOnSquare310x310Logo = true;
            }

            if (SecondaryTile.Exists(tile.TileId))
            {
                return await tile.UpdateAsync();
            }
            else
            {
                if (!ApiInformation.IsTypePresent(("Windows.Phone.UI.Input.HardwareButtons")))
                {
                    if (options.Rect == null)
                        return await tile.RequestCreateAsync();
                    else
                        return await tile.RequestCreateForSelectionAsync(options.Rect, options.PopupPlacement);
                }
                else if (ApiInformation.IsTypePresent(("Windows.Phone.UI.Input.HardwareButtons")))
                {
                    // OK, the tile is created and we can now attempt to pin the tile.
                    // Since pinning a secondary tile on Windows Phone will exit the app and take you to the start screen, any code after 
                    // RequestCreateForSelectionAsync or RequestCreateAsync is not guaranteed to run.  For an example of how to use the OnSuspending event to do
                    // work after RequestCreateForSelectionAsync or RequestCreateAsync returns, see Scenario9_PinTileAndUpdateOnSuspend in the SecondaryTiles.WindowsPhone project.
                    return await tile.RequestCreateAsync();
                }
            }

            return false;
        }
開發者ID:Microsoft,項目名稱:TVHelpers,代碼行數:43,代碼來源:NotificationsService.Core.cs

示例13: ButtonPin_Click

        private async void ButtonPin_Click(object sender, RoutedEventArgs e)
        {
            BottomAppBar.IsSticky = true;

            var button = (FrameworkElement)sender;
            var buttonTransform = button.TransformToVisual(null);
            var point = buttonTransform.TransformPoint(new Point(0, -20));
            var rect = new Rect(point, new Size(button.ActualWidth, button.ActualHeight));

            if (SecondaryTile.Exists(SelectedItem.Key))
            {
                var tiles = await SecondaryTile.FindAllAsync();
                var secondaryTile = tiles.FirstOrDefault(tile => tile.TileId == SelectedItem.Key);
                if (secondaryTile != null) await secondaryTile.RequestDeleteForSelectionAsync(rect, Placement.Above);
            }
            else
            {
                var logo = new Uri(SelectedItem.Image);
                var tileActivationArguments = SelectedItem.Key + " was pinned at " + DateTime.Now.ToLocalTime();
                var secondaryTile = new SecondaryTile(SelectedItem.Key, SelectedItem.Name, tileActivationArguments, logo, TileSize.Default);
                var result = await secondaryTile.RequestCreateForSelectionAsync(rect, Placement.Above);

                if (result)
                {
                    var tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText04);
                    var notification = new TileNotification(tileXml);

                    // Set notification text.
                    XmlNodeList nodes = tileXml.GetElementsByTagName("image");
                    nodes[0].Attributes[1].NodeValue = SelectedItem.Image;
                    nodes = tileXml.GetElementsByTagName("text");
                    nodes[0].InnerText = SelectedItem.Name;

                    // Update Live Tile.
                    var upd = TileUpdateManager.CreateTileUpdaterForSecondaryTile(SelectedItem.Key);
                    upd.Update(notification);
                }
            }

            UpdatePinnedStatus();
            BottomAppBar.IsSticky = false;
        }
開發者ID:austinkettner,項目名稱:di.fm-windows,代碼行數:42,代碼來源:ChannelPage.xaml.cs

示例14: PinUnpinNoteFlyoutItem_Click

        private async void PinUnpinNoteFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            var pinFlyout = (MenuFlyoutItem)sender;
            var note = (Note)(e.OriginalSource as FrameworkElement).DataContext;
            string SecondaryTileId = note.Id + "NoteTile";
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            if (SecondaryTile.Exists(SecondaryTileId))
            {
                // Unpin
                SecondaryTile secondaryTile = new SecondaryTile(SecondaryTileId);

                Windows.Foundation.Rect rect = MainPage.GetElementRect((FrameworkElement)sender);
                Windows.UI.Popups.Placement placement = Windows.UI.Popups.Placement.Above;

                bool isUnpinned = await secondaryTile.RequestDeleteForSelectionAsync(rect, placement);

                pinFlyout.Text = loader.GetString("pin_text");
                note.PinText = loader.GetString("pin_text");
            }
            else
            {
                //Pin
                Uri square150x150Logo = new Uri("ms-appx:///Assets/square150x150Tile-sdk.png");
                Uri wide310x150Logo = new Uri("ms-appx:///Assets/wide310x150Tile-sdk.png");
                Uri square310x310Logo = new Uri("ms-appx:///Assets/square310x310Tile-sdk.png");
                Uri square30x30Logo = new Uri("ms-appx:///Assets/square30x30Tile-sdk.png");

                string tileActivationArguments = note.Id.ToString();

                SecondaryTile secondaryTile = new SecondaryTile(SecondaryTileId,
                                                                note.Title,
                                                                tileActivationArguments,
                                                                square150x150Logo,
                                                                TileSize.Square150x150);

                if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent(("Windows.Phone.UI.Input.HardwareButtons"))))
                {
                    secondaryTile.VisualElements.Square310x310Logo = square310x310Logo;
                }

                secondaryTile.VisualElements.Wide310x150Logo = wide310x150Logo;

                secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;

                if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent(("Windows.Phone.UI.Input.HardwareButtons"))))
                {
                    secondaryTile.VisualElements.ShowNameOnWide310x150Logo = true;
                    secondaryTile.VisualElements.ShowNameOnSquare310x310Logo = true;
                }

                secondaryTile.VisualElements.ForegroundText = ForegroundText.Dark;
                secondaryTile.VisualElements.BackgroundColor = note.Color;

                secondaryTile.RoamingEnabled = false;

                if (!(Windows.Foundation.Metadata.ApiInformation.IsTypePresent(("Windows.Phone.UI.Input.HardwareButtons"))))
                {
                    bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(MainPage.GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Below);
                    SecondaryTiles.UpdateTile(SecondaryTileId, note);

                    if (isPinned)
                    {
                        pinFlyout.Text = loader.GetString("unpin_text"); ;
                        note.PinText = loader.GetString("unpin_text"); ;
                    }
                    else
                    {
                        var dialog = new MessageDialog(loader.GetString("pin_error_text"), loader.GetString("pin_error_title"));
                        dialog.Commands.Add(new UICommand("OK"));
                        await dialog.ShowAsync();
                    }
                }
                else
                {
                    await secondaryTile.RequestCreateAsync();
                    SecondaryTiles.UpdateTile(SecondaryTileId, note);

                    note.PinText = loader.GetString("unpin_text");
                    pinFlyout.Text = loader.GetString("unpin_text"); 
                }
            }
        }
開發者ID:hamza87,項目名稱:SmartNotes,代碼行數:83,代碼來源:NotesListPage.xaml.cs

示例15: AppBarPin_Click

        private async void AppBarPin_Click(object sender, RoutedEventArgs e)
        {

            FrameworkElement pinElement = (FrameworkElement)sender;
            Windows.UI.Xaml.Media.GeneralTransform buttonTransform = pinElement.TransformToVisual(null);
            Windows.Foundation.Point point = buttonTransform.TransformPoint(new Point());
            Windows.Foundation.Rect rect = new Rect(point, new Size(pinElement.ActualWidth, pinElement.ActualHeight));

            if (SecondaryTile.Exists(appbarTileId))
            {

                SecondaryTile secondaryTile = new SecondaryTile(appbarTileId);
                bool isUnpinned = await secondaryTile.RequestDeleteForSelectionAsync(rect, Windows.UI.Popups.Placement.Above);

                ToggleAppBarButton((Button) sender, isUnpinned);
            }
            else
            {
                Uri logo = new Uri("ms-appx:///Assets/badge_01.png");
                string tileActivationArguments = appbarTileId + " was pinned at " + DateTime.Now.ToLocalTime().ToString();

                SecondaryTile secondaryTile = new SecondaryTile(appbarTileId,
                                                                "Secondary tile pinned via AppBar",
                                                                tileActivationArguments,
                                                                logo, 
                                                                TileSize.Square150x150);

                secondaryTile.VisualElements.ForegroundText = ForegroundText.Dark;
                secondaryTile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///Assets/badge_01.png");
                secondaryTile.VisualElements.Square70x70Logo = new Uri("ms-appx:///Assets/badge_02.png");
                secondaryTile.VisualElements.Square310x310Logo = new Uri("ms-appx:///Assets/badge_03.png");

                bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(rect, Windows.UI.Popups.Placement.Above);

                ToggleAppBarButton((Button)sender, !isPinned);
            }
        }
開發者ID:ugenieus,項目名稱:Learn.ch-window,代碼行數:37,代碼來源:CategoryPage.xaml.cs


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