/// <summary>
        /// Pins and updates the secondary tile
        /// </summary>
        /// <param name="account"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static async Task PinTileAsync(AccountDataItem account, AccountDataStore data, Guid classId, string className, Color classColor)
        {
            string args = new ViewClassArguments()
            {
                LocalAccountId = account.LocalAccountId,
                ItemId         = classId
            }.SerializeToString();

            // Display name is name of the class
            // Tile background is color of the class

            SecondaryTile tile = new SecondaryTile(GenerateTileId(account.LocalAccountId, classId), GetTrimmedClassName(className), args, new Uri("ms-appx:///Assets/Square150x150Logo.png"), TileSize.Default);

            tile.VisualElements.BackgroundColor   = classColor;
            tile.VisualElements.Square71x71Logo   = new Uri("ms-appx:///Assets/Square71x71Logo.png");
            tile.VisualElements.Wide310x150Logo   = new Uri("ms-appx:///Assets/Wide310x150Logo.png");
            tile.VisualElements.Square310x310Logo = new Uri("ms-appx:///Assets/Square310x310Logo.png");
            tile.VisualElements.Square44x44Logo   = new Uri("ms-appx:///Assets/Square44x44Logo.png");
            tile.LockScreenBadgeLogo = new Uri("ms-appx:///Assets/LockScreenLogo.png");
            tile.LockScreenDisplayBadgeAndTileText          = true;
            tile.VisualElements.ShowNameOnSquare150x150Logo = true;
            tile.VisualElements.ShowNameOnSquare310x310Logo = true;
            tile.VisualElements.ShowNameOnWide310x150Logo   = true;

            if (!await tile.RequestCreateAsync())
            {
                return;
            }

            await UpdateTileAsync(tile, account, data, classId);
        }
Beispiel #2
0
        public static BaseArguments Parse(string queryString)
        {
            QueryString qs = QueryString.Parse(queryString);

            string          val;
            ArgumentsAction action = ArgumentsAction.Unknown;

            if (!(qs.TryGetValue(KEY_ACTION, out val) && Enum.TryParse(val, out action)))
            {
                return(null);
            }

            BaseArguments answer = null;

            switch (action)
            {
            case ArgumentsAction.ViewPage:
                answer = new ViewPageArguments();
                break;

            case ArgumentsAction.ViewSchedule:
                answer = new ViewScheduleArguments();
                break;

            case ArgumentsAction.ViewClass:
                answer = new ViewClassArguments();
                break;

            case ArgumentsAction.QuickAdd:
                answer = new QuickAddArguments();
                break;

            case ArgumentsAction.QuickAddToCurrentAccount:
                answer = new QuickAddToCurrentAccountArguments();
                break;

            case ArgumentsAction.QuickAddHomeworkToCurrentAccount:
                answer = new QuickAddHomeworkToCurrentAccountArguments();
                break;

            case ArgumentsAction.QuickAddExamToCurrentAccount:
                answer = new QuickAddExamToCurrentAccountArguments();
                break;

            case ArgumentsAction.OpenAccount:
                answer = new OpenAccountArguments();
                break;

            case ArgumentsAction.ViewHomework:
                answer = new ViewHomeworkArguments();
                break;

            case ArgumentsAction.ViewExam:
                answer = new ViewExamArguments();
                break;

            case ArgumentsAction.ViewHoliday:
                answer = new ViewHolidayArguments();
                break;
            }

            if (answer != null)
            {
                if (answer.TryParse(qs))
                {
                    return(answer);
                }
            }

            return(null);
        }