Exemplo n.º 1
0
        private async void Bvm_OnTap(BinViewModel bvm)
        {
            Select(bvm);

            if (!IsEditMode)
            {
                if (bvm.IsSelected)
                {
                    LastSelectedBinCode = bvm.Code;
                    MessagingCenter.Send(bvm, "BinsViewModel.BinSelected");

                    if (bvm.IsContent)
                    {
                        bvm.LoadAnimation = true;
                        try
                        {
                            NAVFilter navfilter = new NAVFilter
                            {
                                LocationCodeFilter = LocationCode,
                                ZoneCodeFilter     = ZoneCode,
                                BinCodeFilter      = bvm.Code
                            };

                            List <BinContent> bincontent = await NAV.GetBinContentList(navfilter, ACD.Default).ConfigureAwait(true);

                            if ((NotDisposed) && (bincontent.Count > 0))
                            {
                                FillBinContent(bvm, bincontent);
                            }

                            List <BinInfo> bininfo = await NAV.GetBinInfo(bvm.LocationCode, bvm.Code, ACD.Default).ConfigureAwait(true);

                            if (NotDisposed)
                            {
                                FillBinInfo(bvm, bininfo);
                            }
                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine(e.Message);
                        }
                        bvm.LoadAnimation = false;
                    }
                }

                SetSelectedBinContent();
            }

            EditedBinCodeIsEnabled = false;
            List <BinViewModel> list = BinViewModels.FindAll(x => x.IsSelected == true);

            if (list is List <BinViewModel> )
            {
                EditedBinCodeIsEnabled = list.Count == 1;
            }

            if (OnBinClick is Action <BinsViewModel> )
            {
                OnBinClick(this);
            }
        }