public async Task <KegIDResponse> DeviceCheckinAsync(DeviceCheckinRequestModel inModel, string sessionId, string RequestType) { string url = string.Format(Configuration.DeviceCheckinUrl, sessionId); string content = JsonConvert.SerializeObject(inModel); var value = await App.kegIDClient.ExecuteServiceCall <KegIDResponse>(url, HttpMethodType.Send, content, RequestType : RequestType); return(value); }
public async Task <HttpResponseMessage> PostDeviceCheckin(DeviceCheckinRequestModel model, string sessionId) { var cts = new CancellationTokenSource(); var task = RemoteRequestAsync(_accountApi.GetApi(Priority.UserInitiated).PostDeviceCheckin(model, sessionId, cts.Token)); runningTasks.Add(task.Id, cts); return(await task); }
public async Task DeviceCheckInAync() { DeviceCheckinRequestModel deviceModel = new DeviceCheckinRequestModel { AppVersion = AppInfo.VersionString, DeviceId = DeviceInfo.Manufacturer, DeviceModel = DeviceInfo.Model, OS = DeviceInfo.VersionString, PushToken = "", UserId = AppSettings.UserId }; var value = await _accountService.DeviceCheckinAsync(deviceModel, AppSettings.SessionId, Configuration.DeviceCheckin); if (value.StatusCode != HttpStatusCode.NoContent.ToString()) { var param = new NavigationParameters { { "IsLogOut", true } }; await _navigationService.NavigateAsync("/NavigationPage/LoginView", param); } }
private async Task DeviceCheckIn() { Device.StartTimer(TimeSpan.FromDays(1), () => { #pragma warning disable IDE0039 // Use local function Func <Task> value = async() => await RunSafe(DeviceCheckIn()); #pragma warning restore IDE0039 // Use local function return(true); // True = Repeat again, False = Stop the timer }); var current = Connectivity.NetworkAccess; if (current == NetworkAccess.Internet) { DeviceCheckinRequestModel deviceModel = new DeviceCheckinRequestModel { AppVersion = AppInfo.VersionString, DeviceId = DeviceInfo.Manufacturer, DeviceModel = DeviceInfo.Model, OS = DeviceInfo.VersionString, PushToken = "", UserId = Settings.UserId }; var deviceCheckInResponse = await ApiManager.PostDeviceCheckin(deviceModel, Settings.SessionId); if (!deviceCheckInResponse.IsSuccessStatusCode) { var param = new NavigationParameters { { "IsLogOut", true } }; await NavigationService.NavigateAsync("LoginView", param); } Device.StartTimer(TimeSpan.FromMilliseconds(KegRefresh), () => { var model = new KegRequestModel { KegId = string.Empty, Barcode = string.Empty, OwnerId = ConstantManager.Partner?.PartnerId, AltBarcode = string.Empty, Notes = "", ReferenceKey = "", ProfileId = "", AssetType = string.Empty, AssetSize = string.Empty, AssetVolume = "", AssetDescription = "", OwnerSkuId = "", FixedContents = "", Tags = new List <Tag>(), MaintenanceAlertIds = new List <string>(), LessorId = "", PurchaseDate = DateTimeOffset.Now, PurchasePrice = 0, PurchaseOrder = "", ManufacturerName = "", ManufacturerId = "", ManufactureLocation = "", ManufactureDate = DateTimeOffset.Now, Material = "", Markings = "", Colors = "" }; Task.Factory.StartNew(async() => { var value = await ApiManager.PostKeg(model, string.Empty, Settings.SessionId); }); return(false); // True = Repeat again, False = Stop the timer }); } }