コード例 #1
0
        public async Task <bool> PinAsync(IAbstractFolder abstractFolder)
        {
            string tileId = LaunchArgumentsHelper.GetArgSelectFolder(abstractFolder);

            var tile = new SecondaryTile(
                tileId,
                abstractFolder.Name,
                tileId,
                SafeUri.Get("ms-appx:///Assets/Logo150.png"),
                TileSize.Wide310x150);

            tile.VisualElements.Wide310x150Logo   = SafeUri.Get("ms-appx:///Assets/Wide310x150Logo.png");
            tile.VisualElements.Square310x310Logo = SafeUri.Get("ms-appx:///Assets/Square310x310Logo.png");
            tile.VisualElements.BackgroundColor   = Colors.Transparent;

            tile.RoamingEnabled = true;

            bool isPinned = await tile.RequestCreateForSelectionAsync(GetPlacement(), Placement.Below);

            if (isPinned)
            {
                if (this.updateTileTimer != null)
                {
                    this.updateTileTimer.Start();
                }

                this.secondaryTiles.Add(tile);
                this.notificationService?.ShowNotification(string.Format(StringResources.Notification_FolderPinnedFormat, abstractFolder.Name), ToastType.Info);

                return(true);
            }

            return(false);
        }
コード例 #2
0
        public override void Dispose()
        {
            this.Settings.SetValue(CoreSettings.AutoDeleteFrequency, AutoDeleteFrequencyConverter.FromDescription(this.selectedAutoDelete));
            this.Settings.SetValue(CoreSettings.DefaultPriority, TaskPriorityConverter.FromDescription(this.selectedDefaultPriority));
            this.Settings.SetValue(CoreSettings.DefaultDueDate, DefaultDateConverter.FromDescription(this.selectedDefaultDueDate));
            this.Settings.SetValue(CoreSettings.DefaultStartDate, DefaultDateConverter.FromDescription(this.selectedDefaultStartDate));
            this.Settings.SetValue(CoreSettings.CompletedTasksMode, CompletedTaskModeConverter.FromDescription(this.selectedCompletedTaskMode));
            this.Settings.SetValue(CoreSettings.UseGroupedDates, this.useGroupedDates);
            this.Settings.SetValue(CoreSettings.ShowFutureStartDates, this.showFutureStartDates);
            this.Settings.SetValue(CoreSettings.IncludeNoDateInViews, this.showNoDueWithOther);
            this.Settings.SetValue(CoreSettings.AutoDeleteTags, this.autoDeleteTags);
            this.Settings.SetValue(CoreSettings.CompleteTaskSetProgress, this.completeTaskSetsProgress);

            if (this.selectedDefaultContext != null)
            {
                this.Settings.SetValue(CoreSettings.DefaultContext, this.selectedDefaultContext.Id);
            }
            else
            {
                this.Settings.SetValue(CoreSettings.DefaultContext, -1);
            }

            if (this.selectedBadgeValue != this.originalSelectedBadgeValue)
            {
                string settingValue = null;
                if (this.selectedBadgeValue != this.badgeValues[0])
                {
                    settingValue = LaunchArgumentsHelper.GetArgSelectFolder(this.selectedBadgeValue);
                }

                this.Settings.SetValue(CoreSettings.BadgeValue, settingValue);
                this.tileManager.UpdateTiles();
            }
        }
コード例 #3
0
 public bool IsPinned(IAbstractFolder folder)
 {
     try
     {
         return(SecondaryTile.Exists(LaunchArgumentsHelper.GetArgSelectFolder(folder)));
     }
     catch (Exception ex)
     {
         LogService.Log("TileManager", $"Exception in IsPinned: {ex}");
         return(false);
     }
 }
コード例 #4
0
        public async Task <bool> UnpinAsync(IAbstractFolder folder)
        {
            if (this.IsPinned(folder))
            {
                string id     = LaunchArgumentsHelper.GetArgSelectFolder(folder);
                var    tile   = new SecondaryTile(id);
                bool   result = await tile.RequestDeleteForSelectionAsync(GetPlacement(), Placement.Below);

                if (result)
                {
                    this.secondaryTiles.Remove(t => t.TileId == id);
                    this.notificationService?.ShowNotification(string.Format(StringResources.Notification_FolderUnpinnedFormat, folder.Name), ToastType.Info);
                }

                return(result);
            }

            return(false);
        }
コード例 #5
0
 public void GetArgSelectTag()
 {
     Assert.AreEqual("tag-" + this.workbook.Tags.ElementAt(0).Id, LaunchArgumentsHelper.GetArgSelectFolder(this.workbook.Tags.ElementAt(0)));
 }
コード例 #6
0
 public void GetArgSelectContext()
 {
     Assert.AreEqual("context-" + this.workbook.Contexts.ElementAt(0).Id, LaunchArgumentsHelper.GetArgSelectFolder(this.workbook.Contexts.ElementAt(0)));
 }
コード例 #7
0
 public void GetArgSelectSmartView()
 {
     Assert.AreEqual("smartview-" + this.workbook.SmartViews.ElementAt(0).Id, LaunchArgumentsHelper.GetArgSelectFolder(this.workbook.SmartViews.ElementAt(0)));
 }