iVend Addon - Show Product Search Screen

PrivateSubAddProductButtonClick(sender AsObject, e AsSystem.EventArgs)

        Try

            Dimm_ProductSearchView AsProductSearchView= ConsoleViewManager.Instance.ProductSearchView

           m_ProductSearchView.AllowMultiSelect = False

            AddHandlerm_ProductSearchView.OnEvent, NewProductSearchView.EventHandler(AddressOfProductSearchViewEventHandler)

            DimsearchContextObject AsProductSearchContext= TryCast(m_ProductSearchView.SearchContextObject, ProductSearchContext)

            searchContextObject.IsOnHold = False

            searchContextObject.IsNonStock = False

           searchContextObject.IsGiftCertificate = False

            ConsoleViewManager.Instance.Push(m_ProductSearchView)

        Catchex AsException

            MessageBox.Show(ex.ToString)

        EndTry

    EndSub

    PrivateSubProductSearchViewEventHandler(ByValsender AsObject, ByValargs AsProductSearchView.EventArgs)

        ConsoleViewManager.Instance.Pop()

        Dimm_ProductSearchView AsProductSearchView= TryCast(sender, ProductSearchView)

        RemoveHandlerm_ProductSearchView.OnEvent, NewProductSearchView.EventHandler(AddressOfProductSearchViewEventHandler)

        m_ProductSearchView.Dispose()

        If(args.EventType = ProductSearchView.EventType.Cancel) Then

            Return

        EndIf

        DimbusinessObject AsProduct= TryCast(args.BusinessObject, Product)

    EndSub

Leave a comment