private void CreateStateItems() { try { mListAgentStateItems.Clear(); if (ListAllStateInfos == null) { return; } for (int i = 0; i < ListAllStateInfos.Count; i++) { var info = ListAllStateInfos[i]; AgentStateItem item = new AgentStateItem(); item.Info = info; item.ObjID = info.ObjID; item.Number = info.Number; item.Name = info.Name; item.StateType = info.Type; item.StateValue = info.Value; Brush brushHead = Brushes.LightGray; try { brushHead = new SolidColorBrush(GetColorFromString(info.Color)); } catch { } item.BrushHead = brushHead; mListAgentStateItems.Add(item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void InitStateSeatItems() { try { mListStateSeatItems.Clear(); if (ListAllSeatInfos == null) { return; } if (ListAllStateInfos == null) { return; } for (int i = 0; i < mListRegionSeats.Count; i++) { var regionSeat = mListRegionSeats[i]; SeatInfo seatInfo = ListAllSeatInfos.FirstOrDefault(s => s.ObjID == regionSeat.SeatID); if (seatInfo == null) { continue; } for (int j = 0; j < ListAllStateInfos.Count; j++) { AgentStateInfo stateInfo = ListAllStateInfos[j]; int stateNumber = stateInfo.Number; AgentStateItem stateItem = mListAgentStateItems.FirstOrDefault(s => s.Number == stateNumber); StateSeatItem item = new StateSeatItem(); item.Info = regionSeat; item.SeatInfo = seatInfo; item.StateItem = stateItem; item.ObjID = regionSeat.SeatID; item.SeatName = seatInfo.Name; item.Extension = seatInfo.Extension; item.Number = stateNumber; item.Description = string.Empty; mListStateSeatItems.Add(item); } } } catch (Exception ex) { ShowException(ex.Message); } }