VB to C# ToolClick syntax  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

VB to C# ToolClick syntax

Postby DannyC » Thu Aug 23, 2018 5:30 pm

I am having trouble working out the correct syntax in C# when I have clicked a custom tool added to the ribbon.

In VB it would be
Code: Select all
      AddHandler chequePaymentForm.UltraToolbarsManager1.ToolClick, AddressOf chequePaymentForm_Toolbar_ToolClick
    End Sub
      
   Public Sub chequePaymentForm_Toolbar_ToolClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs)
      Dim chequePaymentForm As JiwaCreditorChqPayUI.CreditorChqPay = DirectCast(sender, Infragistics.Win.UltraWinToolbars.UltraToolbarsManager).DockWithinContainer


I am having trouble with the DirectCast line.


Code: Select all
      chequePaymentForm.UltraToolbarsManager1.ToolClick += chequePaymentForm_Toolbar_ToolClick;
   }
   
   public void chequePaymentForm_Toolbar_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
   {
      JiwaCreditorChqPayUI.CreditorChqPay chequePaymentForm =  ?? what do I put here ??;      
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: VB to C# ToolClick syntax  Topic is solved

Postby SBarnes » Thu Aug 23, 2018 7:05 pm

Hi Danny

Below is some code I have used in a sales order form to do what you are looking to do which should give you the idea, basically the sender will be the UltraToolbarsManager and from there DockWithinContainer will give you the form that owns the UltraToolbarsManager.


Code: Select all
 Infragistics.Win.UltraWinToolbars.UltraToolbarsManager toolbar = (Infragistics.Win.UltraWinToolbars.UltraToolbarsManager)sender;
JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm salesform = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)toolbar.DockWithinContainer;
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 28 guests