/// <summary> /// Disposes the control. /// </summary> /// <param name="disposing">Whether Dispose has been called.</param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { this.thumbElement = null; } }
private void seatLayout_thumb() { if (SeatCache.ThumbList == null) { SeatCache.ThumbList = new List <ThumbElement>(); } List <ThumbElement> list = SeatCache.ThumbList.Where(p => p.ReadingRoomNum == this.RoomNoStr).ToList(); if (list != null && list.Count > 0) { foreach (var item in list) { SeatUC_ViewModel value = this.viewModel.SeatLayoutList.Where(p => p.Value.LongSeatNo == item.SeatNo).FirstOrDefault().Value; if (value != null) { if (value.IsStop || value.IsUsing) { item.rec.Fill = new SolidColorBrush(Color.FromRgb(234, 38, 52)); } else { item.rec.Fill = new SolidColorBrush(Color.FromRgb(220, 220, 220)); } this.canvas_Thumbnail.Children.Insert(0, item.rec); Panel.SetZIndex(item.rec, 0); Canvas.SetLeft(item.rec, (double)item.recLeft); Canvas.SetTop(item.rec, (double)item.recTop); } } } else { foreach (KeyValuePair <string, Seat> seat in viewModel.Layout.Seats) { #region 布局缩略图 Rectangle rec = new Rectangle(); rec.Name = "recSeat_" + seat.Key; rec.Width = 36 / scaleX; rec.Height = 36 / scaleY; double thumbLeft = (seat.Value.PositionX * 24 + 6) / scaleX; double thumbTop = (seat.Value.PositionY * 24 + 6) / scaleY; if (viewModel.SeatLayoutList[seat.Key].IsStop || viewModel.SeatLayoutList[seat.Key].IsUsing) { rec.Fill = new SolidColorBrush(Color.FromRgb(234, 38, 52)); } else { rec.Fill = new SolidColorBrush(Color.FromRgb(220, 220, 220)); } rec.RenderTransformOrigin = new Point(0.5, 0.5); rec.RenderTransform = new RotateTransform(seat.Value.RotationAngle); canvas_Thumbnail.Children.Insert(0, rec); Panel.SetZIndex(rec, 0); Canvas.SetLeft(rec, thumbLeft + moveX); Canvas.SetTop(rec, thumbTop + moveY); #endregion ThumbElement thumbElement = new ThumbElement(); thumbElement.ReadingRoomNum = this.RoomNoStr; thumbElement.SeatNo = seat.Value.SeatNo; thumbElement.rec = rec; thumbElement.recLeft = (float)(thumbLeft + moveX); thumbElement.recTop = (float)(thumbTop + moveY); SeatCache.ThumbList.Add(thumbElement); } } }