コード例 #1
0
        public SalesOrderViewModel(PenjualanAndOrderModel order)
        {
            _orderParameter = order;

            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());
            SaveCommand      = new Command(SaveAction, CanSaved);
            ClearCommand     = new Command(() => {
                Datas.Clear();
                SelectedIndex = -1;
                Title         = "Create Order";
                Order         = new OrderPenjualan {
                    OrderDate = DateTime.Now
                };
                Order.DeadLine = 12;
                RefreshProductStock();
            });

            QRCommand = new Command(async() => {
                var vm = new InputBarcodeViewModel();
                vm.OnResultScanHandler += Vm_OnResultScanHandler;
                var form = new InputBarcodeView()
                {
                    BindingContext = vm
                };
                await Shell.Current.Navigation.PushModalAsync(form);
            });

            AddCommand = new Command(async() => await ExecuteLoadItemsCommand());
            Datas.CollectionChanged += Datas_CollectionChanged;
            DeleteCommand            = new Command(DeleteAction);

            this.PropertyChanged += SalesOrderViewModel_PropertyChanged;

            InitAsync(order);
        }
コード例 #2
0
 public PenjualanDetailViewModel(PenjualanAndOrderModel penjualanModel)
 {
     OrderDetailCommand = new Command(async() => await ShowDetail());
     LoadItemsCommand   = new Command(async() => await ExecuteLoadItemsCommand());
     _penjualanModel    = penjualanModel;
     Title = "Detail Penjualan";
     _     = ExecuteLoadItemsCommand();
 }