示例#1
0
        public static bool Check(string[] args)
        {
            if (args?.Any() is true)
            {
                if (args.Contains(AddOption))
                {
                    Add();
                    return(true);
                }
                if (args.Contains(RemoveOption))
                {
                    Remove();
                    return(true);
                }
            }

            if (ShortcutHelper.Exists())
            {
                SetRemoveJumpList();
            }
            else
            {
                SetAddJumpList();
            }

            return(false);
        }
示例#2
0
        private static void SetJumpList(string title, string description, string arguments)
        {
            var(_, executablePath, aliasPath) = ShortcutHelper.GetNamePaths();

            JumpTask GetJumpTask() => new JumpTask
            {
                Title             = title,
                Description       = description,
                Arguments         = arguments,
                ApplicationPath   = (aliasPath ?? executablePath),
                IconResourcePath  = executablePath,
                IconResourceIndex = 0
            };

            var jumpList = new JumpList();

            jumpList.JumpItems.Add(GetJumpTask());
            jumpList.Apply();
        }
示例#3
0
 public static void Remove()
 {
     ShortcutHelper.Remove();
     SetAddJumpList();
 }
示例#4
0
 public static void Add()
 {
     ShortcutHelper.Create();
     SetRemoveJumpList();
 }