itsoutchy
itsoutchy

Reputation: 11

Why is my JumpTask invalid? I've changed lots and it still stays invalid

I'm trying to add an "Incognito window" JumpTask to my web browser, but it's invalid no matter what properties I change. Here's the code for making the JumpTask and adding it to the list - in App.xaml.cs:

protected override void OnStartup(StartupEventArgs e)
        {
            string appPath = "";
            if (Assembly.GetEntryAssembly() != null)
            {
                appPath = Assembly.GetEntryAssembly().Location;
            } else
            {
                appPath = Path.Combine(Environment.CurrentDirectory, "Control.exe");
            }
            JumpTask incognitoTask = new JumpTask
            {
                Title = "Incognito Window",
                Description = "An incognito window clears all cookies and cache when closed",
                ApplicationPath = appPath,
                Arguments = "incognito=true",
                CustomCategory = "Tasks",
                IconResourceIndex = 0,
                WorkingDirectory = Environment.CurrentDirectory,
                IconResourcePath = Path.Combine(Environment.CurrentDirectory, "stupidIconLibraryPleaseConvertToDLLOmg.dll")
            };
            //incognitoTask.Title = "Incognito Window";
            //incognitoTask.Description = "An incognito window clears all cookies and cache when closed";
            //incognitoTask.ApplicationPath = Path.Combine(Environment.CurrentDirectory, "Control.exe");
            //incognitoTask.Arguments = "incognito=true";
            //incognitoTask.WorkingDirectory = Environment.CurrentDirectory;
            //incognitoTask.IconResourcePath = Path.Combine(Environment.CurrentDirectory, "lock.ico");
            //incognitoTask.IconResourceIndex = 0;
            //JumpList list = JumpList.GetJumpList(Application.Current);
            JumpList list = new JumpList();
            list.BeginInit();
            list.JumpItems.Add(incognitoTask);
            list.EndInit();
            list.Apply();
            JumpList.SetJumpList(Current, list);
        }

All of the referenced files do exist. How can I make it be valid?

I tried removing properties, moving it from MainWindow.xaml.cs to App.xaml.cs, and changing the icon to a DLL, but neither worked, I expected it to show the JumpList when I right-clicked the app.

Upvotes: 0

Views: 147

Answers (0)

Related Questions