Page 1 of 1

Hook Into Select Warehouse Dialog

PostPosted: Mon Jul 31, 2017 8:16 pm
by nsbandara
Hi,

Is there a way to hook select warehouse dialog (see attached) through a plugin and remove given warehouse from select list ?

Thanks.

Re: Hook Into Select Warehouse Dialog

PostPosted: Mon Jul 31, 2017 10:02 pm
by Mike.Sheen
nsbandara wrote:Hi,

Is there a way to hook select warehouse dialog (see attached) through a plugin and remove given warehouse from select list ?

Thanks.


Possibly - what version of Jiwa 7 are you wanting this for?

Re: Hook Into Select Warehouse Dialog

PostPosted: Tue Aug 01, 2017 2:08 pm
by nsbandara
Jiwa Version 7.0.175

Re: Hook Into Select Warehouse Dialog  Topic is solved

PostPosted: Tue Aug 01, 2017 5:17 pm
by Mike.Sheen
In the ApplicationManagerPlugin plugin class, add a handler for when the dialog loads - and in that handler, check the type - if it's the set current warehouse dialog (JiwaFinancials.Jiwa.JiwaSetCurrentWarehouseUI.MainForm - requiring a reference to the JiwaSetCurrentWarehouseUI assembly), then hide the desired node(s) in the treeview of the form.

i.e.:

Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{      
   JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.DialogFactory.AfterDialogStart += AfterDialogStart;
}

private void AfterDialogStart(JiwaFinancials.Jiwa.JiwaApplication.IJiwaDialog JiwaDialog)
{
   if (JiwaDialog is JiwaFinancials.Jiwa.JiwaSetCurrentWarehouseUI.MainForm)
   {
      // Hide an element of the selection treeview control
      JiwaFinancials.Jiwa.JiwaSetCurrentWarehouseUI.MainForm selectionForm = (JiwaFinancials.Jiwa.JiwaSetCurrentWarehouseUI.MainForm)JiwaDialog;
      
      foreach(Infragistics.Win.UltraWinTree.UltraTreeNode node in selectionForm.UltraTree1.Nodes)
      {            
         if (node.Text == "Victoria")
         {
            node.Visible = false;
         }
      }
      
   }
}


Sample plugin attached.