Ejemplo n.º 1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            incomingLb = ObjectCreatorHelper.createLabel(10, 12, Color.Transparent, TextAlignment.Start, Color.Black, "INCOMING", new Thickness(0, 0, 0, 0));
            outgoingLb = ObjectCreatorHelper.createLabel(10, 12, Color.Transparent, TextAlignment.Start, Color.Black, "OUTGOING", new Thickness(0, 16, 0, 0));

            noActiveOutgoingLbl = ObjectCreatorHelper.createLabel(13, 40, Color.White, TextAlignment.Center, Color.Black, "No active transfers.", new Thickness(0, 0, 0, 0));
            noActiveOutgoingLbl.VerticalTextAlignment   = TextAlignment.Center;
            noActiveOutgoingLbl.HorizontalTextAlignment = TextAlignment.Center;

            noActiveIncomingLbl = ObjectCreatorHelper.createLabel(13, 40, Color.White, TextAlignment.Center, Color.Black, "No active transfers.", new Thickness(0, 0, 0, 0));
            noActiveIncomingLbl.VerticalTextAlignment   = TextAlignment.Center;
            noActiveIncomingLbl.HorizontalTextAlignment = TextAlignment.Center;            //    new Label

            ObjectCreatorHelper.addToRootParent(historyRl, incomingLb, 8, 8, -16);
        }
        public async void PullListOfDevices(string username)
        {
            var viewDeviceLv = ObjectCreatorHelper.createListview(false, new DataTemplate(typeof(MyDeviceCell)), 40, false, Color.White);

            viewDeviceLv.Margin = new Thickness(0, 0, 16, 0);

            var responsePull = await ServiceClient.Instance.getDevices(username);

            if (responsePull.ResponseCode != 200)
            {
                await DisplayAlert(string.Empty, "Error connecting to server", "Ok");

                //loadingOverlay.IsVisible = false;
                // return;
            }

            deviceList.Add(new MobileDevice {
                ID = "AssetId", Name = "Type", UnitCost = "CostCode", DeviceColor = Color.FromHex(Constants.LIST_HEADER_BG_COLOR), OtherLabel = "Status"
            });

            if (responsePull.ResponseString != null && responsePull.ResponseString != "")
            {
                Debug.WriteLine(responsePull.ResponseString);
                var responseArray = JArray.Parse(responsePull.ResponseString);

                foreach (JObject o in responseArray.Children <JObject>())
                {
                    deviceList.Add(new MobileDevice {
                        ID = (string)o["assetId"], Name = "Samsung", UnitCost = costCode, DeviceColor = Color.White, OtherLabel = (string)o["status"]
                    });
                }
            }

            viewDeviceLv.BeginRefresh();
            viewDeviceLv.ItemsSource = deviceList;//
            viewDeviceLv.EndRefresh();

            ObjectCreatorHelper.addToRootParent(viewDeviceRl, viewDeviceLv, 8, 8, 0);

            if (deviceList.Count == 1)
            {
                ObjectCreatorHelper.addChildToParent(viewDeviceRl, noDeviceInListLabel, viewDeviceLv, 0, noDeviceInListLabel.Height, 0);
            }
        }
        private void SetUpAssetIdUI()
        {
            /** Asset Row Set Up**/
            var AssetRowTitle = ObjectCreatorHelper.createLabel(12, 32, Color.White, TextAlignment.Center, Color.Gray, "AssetID", new Thickness(0, 0, 0, 0));

            AssetRowSubtitle = ObjectCreatorHelper.createLabel(14, 32, Color.White, TextAlignment.Center, Color.LightGray, "Tap to scan assetID barcode", new Thickness(0, 0, 0, 0));
            var AssetIdRow = ObjectCreatorHelper.createStackLayout(new Thickness(8, 0, 8, 0), Color.White, 80, true);

            AssetIdRow.Children.Add(AssetRowTitle);
            AssetIdRow.Children.Add(AssetRowSubtitle);
            AssetIdRow.GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => SetUpScanner(AssetRowSubtitle, ZXing.BarcodeFormat.CODE_93, "Scan Asset Id Code")),
            });

            ObjectCreatorHelper.addToRootParent(deviceInfoRl, AssetIdRow, 8, 8, 16);
            assetDivider = new BoxView {
                WidthRequest = 200, HeightRequest = 1, BackgroundColor = Color.LightGray
            };
            ObjectCreatorHelper.addChildToParent(deviceInfoRl, assetDivider, AssetIdRow, 0, assetDivider.Height, 0);
            /** END - Asset Row Set Up**/
        }