Creating a Toolbar with a Button
NktWLMailApi.Toolbar newToolbar; int newToolbarID ; //This will be used to tell the button the ID of the toolbar where we want to create it. NktWLMailApi.ToolbarButton newButton;
From Starting New Project code: private void OnInitWLMailApi() { wlmailApiCore = new NktWLMailApi.WLMailApi(); wlmailApiId = wlmailApiCore.GetID(); Toolbar Creation: newToolbar= new NktWLMailApi.Toolbar(); newToolbar.Create("Toolbar Name", wlmailApiId); newToolbarID = newToolbar.GetID(); Button Creation: newButton = new NktWLMailApi.ToolbarButton(); newButton.Create(newToolbarID, "Button Name", "ImagePath", "", 0); // Leave ImagePath empty if you dont have an image. newButton.OnClick += new NktWLMailApi.IToolbarButtonEvents_OnClickEventHandler(EventFunction); } Creating a Button in the Home Toolbar (Only Windows Live Mail 15 (2011)
From Starting New Project code: private void OnInitWLMailApi() { wlmailApiCore = new NktWLMailApi.WLMailApi(); wlmailApiId = wlmailApiCore.GetID(); Get Home Toolbar as newToolbar: // Check Windows Live Mail Version if (wlmailApiCore.GetClientVersion() == 15) { newToolbar= wlmailApiCore.GetDefaultToolbar(0); newToolbarID = newToolbar.GetID(); } Button Creation (stills the same): newButton = new NktWLMailApi.ToolbarButton(); newButton.Create(newToolbarID, "Button Name", "ImagePath", "", 0); // Leave ImagePath empty if you dont have an image. newButton.OnClick += new NktWLMailApi.IToolbarButtonEvents_OnClickEventHandler(EventFunction); } Create a Button with SubButtons
NktWLMailApi.Toolbar newToolbar; int newToolbarID ; //This will be used to tell the button the ID of the toolbar where we want to create it. NktWLMailApi.ToolbarButton newButton; NktWLMailApi.ToolbarButton newSubButton;
Button Creation:
newButton = new NktWLMailApi.ToolbarButton(); newButton.Create(newToolbarID, "Button Name", "ImagePath", "", 1); // Changed 4th value from 0 to 1 // Buttons with Sub Buttons can't have Click Events. // newButton.OnClick += new NktWLMailApi.IToolbarButtonEvents_OnClickEventHandler(EventFunction); SubButton Creation: newSubButton = newButton .CreateSubButton("Sub Button Name", "ImagePath", "", 0); newSubButton.OnClick += new NktWLMailApi.IToolbarButtonEvents_OnClickEventHandler(EventFunction); } |