public async void pullHistoryTransfers(string incomingType, string outgoingType, string username) { incomingLvHistory = ObjectCreatorHelper.createListview(false, new DataTemplate(typeof(CustomTableCell)), 40, false, Color.White); incomingLvHistory.Margin = new Thickness(0, 0, 16, 0); outGoingLvHistory = ObjectCreatorHelper.createListview(false, new DataTemplate(typeof(CustomTableCell)), 40, false, Color.White); outGoingLvHistory.Margin = new Thickness(0, 0, 16, 0); incomingTransferList.Add(new MobileDevice { ID = "AssetId", Name = "Sender UserID", UnitCost = "CostCode", DeviceColor = Color.FromHex(Constants.LIST_HEADER_BG_COLOR), OtherLabel = "TimeStamp" }); //Console.WriteLine("Value of i: {0}", i); outgoingTransferList.Add(new MobileDevice { ID = "AssetId", Name = "Recipient UserID", UnitCost = "CostCode", DeviceColor = Color.FromHex(Constants.LIST_HEADER_BG_COLOR), OtherLabel = "TimeStamp" }); //Console.WriteLine("Value of i: {0}", i); //PullIncoming History var responseIncomingPull = await ServiceClient.Instance.PastTransfers(incomingType, username, "false"); createList(responseIncomingPull, incomingLvHistory, incomingTransferList); //End Pull incoming history transfers //Pull outgoing History var responseOutgoingPull = await ServiceClient.Instance.PastTransfers(outgoingType, username, "false"); createList(responseOutgoingPull, outGoingLvHistory, outgoingTransferList); //End Pull outgoing history transfers setupUI(); }
protected void init() { costCode = Application.Current.Properties[Constants.USER_COSTCODE] as string; location = Application.Current.Properties[Constants.USER_LOCATION] as string; List <DevicesIngestData> pmDeviceInfoList = new List <DevicesIngestData>(); pmDeviceInfoList.Add(new DevicesIngestData { Title = "Location", SubTitle = location, TopPadding = new Thickness(0, 0, 0, 0), DeviceColor = Color.Gray, enableEntry = false }); pmDeviceInfoList.Add(new DevicesIngestData { Title = "CostCode", SubTitle = costCode, TopPadding = new Thickness(0, 0, 0, 0), DeviceColor = Color.Gray, enableEntry = false }); pmDeviceInfoList.Add(new DevicesIngestData { Title = "Status", SubTitle = "Active", TopPadding = new Thickness(0, 0, 0, 0), DeviceColor = Color.Gray, enableEntry = true }); ingestDeviceLv = ObjectCreatorHelper.createListview(false, new DataTemplate(typeof(IngestDeviceCell)), 80, true, Color.White); ingestDeviceLv.ItemsSource = pmDeviceInfoList; ingestDeviceRecipientLv = ObjectCreatorHelper.createListview(false, new DataTemplate(typeof(IngestDeviceCell)), 80, true, Color.White); ingestDeviceRecipientLv.ItemsSource = DeviceIngest.DeviceListRecipient; submitBtn = ObjectCreatorHelper.createbutton("Submit", 12, true, 55, Color.FromHex(Constants.ACCENT_COLOR), Color.White, FontAttributes.Bold, new Thickness(-5, -5, -5, 0)); submitBtn.Clicked += OnSubmitButtonClicked; SetUpAssetIdUI(); SetUpImeiUI(); pullListOfAccounts(); SetUpReceipientUI(); }
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); } }
public HomePage() { InitializeComponent(); Title = "Home"; string acctType = (string)LogInResponseData.GetApplicationCurrentProperty(Constants.ACCOUNT_TYPE); uniqueDeviceAddress = Application.Current.Properties[Constants.DEVICE_ADDRESS] as string; usernameKey = Application.Current.Properties[Constants.USERNAME_KEY] as string; passKey = Application.Current.Properties[Constants.PASS_KEY] as string; deviceModel = Application.Current.Properties[Constants.DEVICE_MODEL] as string; ListView homeMenuLv = ObjectCreatorHelper.createListview(false, new DataTemplate(typeof(HomeMenuCell)), 80, true, Color.White); homeMenuLv.Margin = new Thickness(8, 8, 8, 8); homeMenuLv.SeparatorColor = Color.FromHex(Constants.LIST_SEPERATOR_COLOR); homeMenuLv.VerticalOptions = LayoutOptions.Fill; if (deviceModel != null) { assetModel.Text = deviceModel; } if (uniqueDeviceAddress != null) { currentAssetIdLbl.Text = uniqueDeviceAddress; } else { currentAssetIdLbl.Text = "UNKNOWN"; } switch (acctType) { case "1": // eus homeMenuLv.ItemsSource = MenuData.menuListSupport; AccountTypeTitle.Text = "End User Support"; break; case "0": //pm isDisposalAccept = true; homeMenuLv.ItemsSource = MenuData.menuListManager; AccountTypeTitle.Text = "Property Management"; break; default: homeMenuLv.ItemsSource = MenuData.menuListEmployee; AccountTypeTitle.Text = "Employee"; break; } homeOptions.Children.Add(homeMenuLv); homeMenuLv.ItemSelected += async(sender, e) => { loadingOverlayHome.IsVisible = true; if (e.SelectedItem == null) { // don't do anything if we just de-selected the row return; } else { switch ((e.SelectedItem as MenuObject).menuTitle) { case "Ingest a New Device": //TODO: open up camera layout to add new device before directing user to IngestDevicePage() await Navigation.PushAsync(new IngestDevicePage()); break; case "Collect Device": openBarCodeScaner(0); //Removed break; case "Initiate Inventory Check": var result = await DisplayAlert(Constants.INVENTORY_CHECK_TITLE, Constants.INVENTORY_CHECK_CONTENT, Constants.BUTTON_CONFIRM, Constants.BUTTON_CAN); loadingOverlayHome.IsVisible = false; break; case "Accept a Transfer": // PM / EUS user is accepting transfer into their possesion openBarCodeScaner(1); break; case "Disposal": // PM Only openBarCodeScaner(3); break; case "Submit Disposal Request": //EUS Only openBarCodeScaner(2); break; case "View Transfers": await Navigation.PushAsync(new InitiateTransferPage()); break; case "View My Devices": await Navigation.PushAsync(new ViewDevicesPage()); break; default: await DisplayAlert("Tapped", "Error in code" + " row was selected", Constants.BUTTON_POS); loadingOverlayHome.IsVisible = false; break; } ((ListView)sender).SelectedItem = null; loadingOverlayHome.IsVisible = false; } }; }