locked
WHS2011 addin - Tasks RRS feed

  • Question

  • I would like to add some tasks to my addin sub tab to enable editing and deleting the selected item in a list. I dont know how to go about this and there is not very much info around

    I know this is a new forum but I hope somebody who has already created an addin for WHS2011 can help


    Mal
    Sunday, May 8, 2011 4:52 PM

Answers

All replies

  • Hi Mal,

    You can do this by providing a TaskList within the 'CreateContent' function of the Page (http://msdn.microsoft.com/en-us/library/gg521360.aspx)
    Just create an AsyncUiTask.

    You can find a working example in my WHS Development Kit-2, have a go with it and see how it works.


    Nick Asseloos MVP Windows Home Server
    Wednesday, May 18, 2011 8:29 PM
  • Nick

    Sorry for the delay in replying, I have not been able to look at this so I didnt mark it as answered. When I can time again I will check this out

    thanks

     


    Mal
    Thursday, May 26, 2011 9:09 AM
  • Hi Nick

    I am now trying to get back into the development of my add-in for WHS2011. I want to carry out an edit for the item in the list of a sub-tab but I dont know how to get the id of the item I have clicked on, is this possible?

    My tab code is:

        static class SubTabTasks
        {
            public static TaskCollection CreateTasks()
            {
                TaskCollection tasks = new TaskCollection();
                tasks.Add(CreateCustomAction());        
                tasks.Add(EditMember());
                return tasks;
            }

            private static AsyncUiTask CreateCustomAction()
            {
                var task = new AsyncUiTask("Add Member",
                   delegate(object sender)
                   {
                       MessageBox.Show("Sender type is add ");
                       return (null);
                   }
                );
                return (task);
            }

            private static AsyncUiTask EditMember()
            {
                var task = new AsyncUiTask("Edit Member",
                   delegate(object sender)
                   {
                       MessageBox.Show("Member clicked is ");
                       return (null);
                   }
                );
                return (task);
            }
        }

    LIST PROVIDER

            protected override void RefreshAndListenForUpdates(IList<FamilyDiaryService.Member> list)
            {
                try
                {
                    // Call object model here and fill the list with business objects
                    FamilyDiaryService.CalServiceClient calService = GlobalMethods.CreateCalServiceClient();

                    if (calService != null)
                    {
                        FamilyDiaryService.Member[] members = calService.GetMembersFiltered(0);
                        if (members == null)
                            MessageBox.Show("Members is null");
                        if (members.Length > 0)
                        {
                            foreach (FamilyDiaryService.Member mem in members)
                            {
                                list.Add(mem);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("There has been an error getting the members from the database.\r\nThe error was " + ex.Message, "Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

     

    TABLIST COLUMNS

        static class SubTabListColumns
        {
            public static ListColumnCollection<FamilyDiaryService.Member> CreateColumns()
            {
                ListColumnCollection<FamilyDiaryService.Member> columns = new ListColumnCollection<FamilyDiaryService.Member>();

                // Replace with your colum definitions

                columns.Add("ID", "MemberID");
                columns.Add("First Name", "FirstName");
                columns.Add("Last Name", "LastName");
                columns.Add("Family","isFamily");
                return columns;
            }
        }


    Mal
    Wednesday, August 24, 2011 3:19 PM