Пример #1
0
        public BarcodeSettingsUiViewModel()
        {
            PrintingBarcodePropertiesList = new ObservableCollection <PrintingBarcodePropertiesList>();
            _webService.GetBarcodePropertyAsync();

            BarcodeOperationsList = new ObservableCollection <tbl_lkp_BarcodeOperations>();
            _webService.GetBarcodeOperationsLkpAsync();
            _webService.GetBarcodeOperationsLkpCompleted += (s, sv) =>
            {
                foreach (var item in sv.Result)
                {
                    BarcodeOperationsList.Add(item);
                }
                GetData();
            };

            var values = Enum.GetValues(typeof(BarcodeFormatEnum));

            BarcodeFormate = new ObservableCollection <string>();
            foreach (BarcodeFormatEnum item in values)
            {
                BarcodeFormate.Add(item.ToString());
            }

            _webService.GetBarcodeDisplaySettingsHeaderCompleted += (s, sv) =>
            {
                foreach (var item in sv.Result)
                {
                    BarcodeSettingHeaderList.Add(MapTOBarcodeSettingsHeader(item));
                }
            };

            _webService.GetBarcodePropertyCompleted += (s, sv) =>
            {
                foreach (var item in sv.Result)
                {
                    PrintingBarcodePropertiesList.Add(MapTopBarcodeProperties(item));
                }
            };

            _webService.BarCodePrintLayoutOperationCompleted += (s, sv) =>
            {
                if (sv.Result.Count == 0)
                {
                    foreach (var item in PrintingBarcodePropertiesListPerHeader)
                    {
                        GenericBarcodeTemplate.Add(MapToBarcodeSettingsDetailsDefault(item));
                    }
                }
                else
                {
                    foreach (var item in sv.Result)
                    {
                        GenericBarcodeTemplate.Add(MapToBarcodeSettingsDetails(item));
                    }
                }
                SubmitClicked(this, new EventArgs());
            };
        }