/// <summary> /// Обновление главного меню. Небезопасный код, т.к. изменяем визуальную состовляющую. При вызове из другого потока необходимо использовать DispatcherHelper.Invoke(). /// </summary> private async void UpdateItems() { try { RefreshTileUpdate(true); //PickingListUpdate(); //await UpdateItemsAsync(); if (!WMSEnvironment.Instance.SessionId.HasValue) { throw new Exception("SessionId is null"); } var transportTasksByTypeTask = _api.GetAvailableTransportTaskCountAsync(Convert.ToInt32(WMSEnvironment.Instance.SessionId.Value)); var pickListCountTask = _api.GetAvailablePickListCountAsync(WMSEnvironment.Instance.TruckCode); await Task.WhenAll(transportTasksByTypeTask, pickListCountTask); var transportTasksByType = transportTasksByTypeTask.Result; var pickListCount = pickListCountTask.Result; var transportTaskCount = transportTasksByType.Values.Sum(); TileTransportTaskTitle = transportTaskCount > 0 ? transportTaskCount.ToString() : string.Empty; TileTransportTaskBackground = Application.Current.Resources[transportTaskCount > 0 ? StyleKeys.TileBackgroundOrangeKey : StyleKeys.TileBackgroundDefaultKey] as Brush; TilePickingLisTitle = pickListCount > 0 ? pickListCount.ToString() : string.Empty; TilePickingListBackground = Application.Current.Resources[ pickListCount > 0 ? StyleKeys.TileBackgroundOrangeKey : StyleKeys.TileBackgroundDefaultKey] as Brush; RefreshMandant(); } catch (Exception ex) { if (!ExceptionHandler(ex, Resources.ExceptionResources.TileMenuRefreshError)) { throw; } } finally { RefreshTileUpdate(false); } }
public void GetAvailablePickListCountTest() { var api = new WmsAPI(_manager); var res = api.GetAvailablePickListCountAsync("FORK194").Result; }