Beispiel #1
0
        public async static Task <bool> RequestPinSecondaryTileToTaskbar(string tileName, string displayname)
        {
            if (ApiInformation.IsMethodPresent("Windows.UI.Shell.TaskbarManager", "RequestPinSecondaryTileAsync"))
            {
                // API present!
                // Unlock the pin to taskbar feature
                var result = LimitedAccessFeatures.TryUnlockFeature(
                    "com.microsoft.windows.secondarytilemanagement",
                    "<tokenFromMicrosoft>",
                    "<publisher> has registered their use of com.microsoft.windows.secondarytilemanagement with Microsoft and agrees to the terms of use.");

                // If unlock succeeded
                if ((result.Status == LimitedAccessFeatureStatus.Available) ||
                    (result.Status == LimitedAccessFeatureStatus.AvailableWithoutToken))
                {
                    if (!SecondaryTile.Exists(tileName))
                    {
                        SecondaryTile tile = new SecondaryTile(SanitizedTileName(displayname).Replace("!", ""));
                        tile.DisplayName = displayname;
                        tile.Arguments   = SanitizedTileName(tileName);
                        tile.VisualElements.Square44x44Logo             = new Uri("ms-appx:///Assets/Square44x44Logo.scale-100.png");
                        tile.VisualElements.Square150x150Logo           = new Uri("ms-appx:///Assets/Square150x150Logo.scale-100.png");
                        tile.VisualElements.ShowNameOnSquare150x150Logo = true;
                        return(await TaskbarManager.GetDefault().RequestPinSecondaryTileAsync(tile));
                    }
                }
            }

            return(true);
        }
Beispiel #2
0
        public static void RequestWindowDecorationsAccess()
        {
            bool canSetAppWindowTitlebarVisibility = ApiInformation.IsMethodPresent("Windows.UI.WindowManagement.AppWindowTitleBar", "SetPreferredVisibility");

            if (canSetAppWindowTitlebarVisibility)
            {
                string attestation = $"{Package.Current.Id.PublisherId} has registered their use of com.microsoft.windows.windowdecorations with Microsoft and agrees to the terms of use.";

                string token = Package.Current.Id.Name switch
                {
                    "Files" => "xnYLj99c3vN9jFCZiDC6Rg==",
                    "FilesDev" => "Yoz9y1X66micskUKhFrJ5A==",
                    "49306atecsolution.FilesUWP" => "+cyyj4JZUyZrBQ2eqDQGeA==",
                    _ => String.Empty,
                };

                LimitedAccessFeatureRequestResult accessResult = LimitedAccessFeatures.TryUnlockFeature("com.microsoft.windows.windowdecorations", token, attestation);
                if (accessResult.Status == LimitedAccessFeatureStatus.Available)
                {
                    IsWindowDecorationsAllowed = true;
                }
                else
                {
                    IsWindowDecorationsAllowed = false;
                }
            }
            else
            {
                IsWindowDecorationsAllowed = false;
            }
        }
Beispiel #3
0
            public MathRichEditBox()
            {
                string packageName = Package.Current.Id.Name;

                if (packageName == "Microsoft.WindowsCalculator.Dev")
                {
                    LimitedAccessFeatures.TryUnlockFeature(
                        "com.microsoft.windows.richeditmath",
                        "BeDD/jxKhz/yfVNA11t4uA==",         // Microsoft.WindowsCalculator.Dev
                        "8wekyb3d8bbwe has registered their use of com.microsoft.windows.richeditmath with Microsoft and agrees to the terms of use.");
                }
                else if (packageName == "Microsoft.WindowsCalculator")
                {
                    LimitedAccessFeatures.TryUnlockFeature(
                        "com.microsoft.windows.richeditmath",
                        "pfanNuxnzo+mAkBQ3N/rGQ==",         // Microsoft.WindowsCalculator
                        "8wekyb3d8bbwe has registered their use of com.microsoft.windows.richeditmath with Microsoft and agrees to the terms of use.");
                }

                TextDocument.SetMathMode(RichEditMathMode.MathOnly);
                LosingFocus += OnLosingFocus;
                KeyUp       += OnKeyUp;
            }