public async void RefreshStates() { CraftListResponse craftListResponse = await ClientHelper.ExecuteAsync <CraftListResponse>((IRequest <CraftListResponse>) new CraftListRequest()); if (craftListResponse.IsError) { return; } foreach (CraftModel craft in (IEnumerable <CraftModel>)craftListResponse.Crafts) { string craftShortNo = CommonHelper.GetCraftShortNO(craft.CraftNO); foreach (object child in this.stateContainer.Children) { if (child is Path) { Path path = (Path)child; if ((string)path.Tag == craftShortNo) { Color stateInnerColor = this.GetStateInnerColor(craft.State); path.Fill = new SolidColorBrush(stateInnerColor); } } } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { RoleListResponse roleListResponse = LocalApi.Execute(new RoleListRequest() { PageNumber = 1, PageSize = int.MaxValue }); //this.CRAFTWORK.ItemsSource = CraftWork.M6S.ToArrayList(); //this.PROCESS.ItemsSource = Process.最终目检.ToArrayList(); //this.QUARTERS.ItemsSource = Quarters.手动包胶.ToArrayList(); //this.SEGMENT.ItemsSource = Segment.后工序.ToArrayList(); this.model = new UserModel(); CraftListResponse craftListResponse = LocalApi.GetCraftsList(new CraftListRequest()); this.DataContext = this.model; }
public CraftListResponse GetCraftList(CraftListRequest request) { CraftListResponse craftListResponse = new CraftListResponse(); List <CraftModel> list = ServiceHelper.LoadService <IProductionService>().GetCrafts().Select <CraftInfo, CraftModel>(m => m.ToModel()).ToList <CraftModel>(); Dictionary <int, int> craftStates = ServiceHelper.LoadService <IProductionService>().GetCraftStates(); foreach (CraftModel craftModel in list) { craftModel.State = craftStates.ContainsKey(craftModel.CraftDID) ? craftStates[craftModel.CraftDID] : 2; } craftListResponse.Crafts = (IList <CraftModel>)list; return(craftListResponse); }