locked
Add items to tasklist - how to make the added item visible / selected ? RRS feed

  • Question

  • Context: VSPackage, VS 2010, Win7

    Within a custom derivation of TaskProvider, i have a method to add a new task list item

    [Guid(GuidList.guidBeaconsPkgString)]
        private class BeaconsTaskProvider : TaskProvider, UserNotifier
        {
          ....
    
          public void PostError(string errorMessage)
          {
            Tasks.Add(
              new Task
                {
                  CanDelete = false,
                  Category = TaskCategory.User,
                  Text = errorMessage
                });
            
            var notificationView = GetService(typeof (SVsTaskList)) as IVsTaskList2;
    
            var providerId = this.GetType().GUID;
            notificationView.SetActiveProvider(ref providerId);

     

    This adds the item to the tasklist under the User category. However if the tasklist is showing a different category like Comments (top-left dropdown) , it is as if nothing has happened.

    I was unable to find an API member to set the current category. Also the error window pops out (BringToFront) on a compiler error, how do I trigger the same behavior for the task list ?

    Thanks, Gishu

     

     

     

    • Edited by Gishu Thursday, December 23, 2010 3:04 AM added info on container class of code snippet
    Thursday, December 23, 2010 3:03 AM

Answers

  • Hi Gishu,

     

    Thanks for your feedback.

    I cannot find any method either, as a workaround,

    I think you can try

    DTE.Windows.Item("Task List").Activate()

    If it is already docked there.

    Hope my reply helps resolve your issue.

     

    Best Regards,

    Ziwei Chen

     

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Victor_Chen Friday, December 31, 2010 7:56 AM
    Monday, December 27, 2010 7:49 AM

All replies

  • Hello Gishu,

     

    Thank you for your question.

     

    I am currently looking into this issue and will give you an update as soon as possible.

     

    Thank you for your understanding and support.

     

    Best Regards,

    Ziwei Chen

     

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 24, 2010 2:28 AM
  • Hi Gishu,

     

    Thanks for your patience.

    Since you add the item into a user category,

    As a workaround,

    I think IVsTaskList.AutoFilter Method would help.

    Then the Tasklist shows the only category you expect.

    If it doesn't help, be free to let me know.

     

    Best Regards,

    Ziwei Chen

     

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 24, 2010 9:11 AM
  • Thanks Chen, The AutoFilter method was just what I needed. I didn't find it because I incorrectly assumed that IVsTaskList2 is an extension of IVsTaskList and has all its members.

    The second part of the question - what is the counterpart for IVsErrorList.BringToFront  for the task list ? How do I do that for the tasklist ?

    Saturday, December 25, 2010 5:43 AM
  • Hi Gishu,

     

    Thanks for your feedback.

    I cannot find any method either, as a workaround,

    I think you can try

    DTE.Windows.Item("Task List").Activate()

    If it is already docked there.

    Hope my reply helps resolve your issue.

     

    Best Regards,

    Ziwei Chen

     

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Victor_Chen Friday, December 31, 2010 7:56 AM
    Monday, December 27, 2010 7:49 AM
  • Hi Gishu,

     

    Is it resolved?

    Best Regards,

    Ziwei Chen

     

     

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

     

     


    Ziwei Chen [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 30, 2010 9:25 AM