コード例 #1
0
        public void ShowMessage()
        {
            viewModel.CloseTime = 60;
            viewModel.CountDown = new FormCloseCountdown(viewModel.CloseTime);
            viewModel.CountDown.EventCountdown += CountDown_EventCountdown;
            viewModel.CountDown.Start();

            this.viewModel.LastSeatCount = this.viewModel.AllSeatCount;
            this.viewModel.Layout        = EnterOutOperate.GetRoomSeatLayOut(this.viewModel.ReadingRoomNo);
            foreach (object obj in this.canvas_Seat.Children)
            {
                try
                {
                    if (obj.GetType().Name == "UC_Seat")
                    {
                        UC_Seat          UC     = obj as UC_Seat;
                        Seat             value  = this.viewModel.Layout.Seats.Where(p => p.Value.SeatNo == UC.ViewModel.LongSeatNo).FirstOrDefault().Value;
                        SeatUC_ViewModel value2 = this.viewModel.SeatLayoutList.Where(p => p.Value.LongSeatNo == UC.ViewModel.LongSeatNo).FirstOrDefault().Value;
                        if (value == null || value2 == null)
                        {
                            continue;
                        }
                        UC.ViewModel              = value2;
                        UC.ViewModel.IsBespeak    = false;
                        UC.ViewModel.IsShortLeave = false;
                        UC.ViewModel.IsUsing      = false;
                        switch (value.SeatUsedState)
                        {
                        case EnterOutLogType.Leave:
                            UC.ViewModel.IsUsing      = false;
                            UC.ViewModel.IsBespeak    = false;
                            UC.ViewModel.IsShortLeave = false;
                            UC.ViewModel.IsWaiting    = false;
                            break;

                        case EnterOutLogType.SelectSeat:
                        case EnterOutLogType.ReselectSeat:
                        case EnterOutLogType.ComeBack:
                        case EnterOutLogType.ContinuedTime:
                        case EnterOutLogType.BookingConfirmation:
                        case EnterOutLogType.WaitingSuccess:
                        {
                            UC.ViewModel.IsUsing      = true;
                            UC.ViewModel.IsBespeak    = false;
                            UC.ViewModel.IsShortLeave = false;
                            UC.ViewModel.IsWaiting    = false;
                            this.viewModel.LastSeatCount--;
                            break;
                        }

                        case EnterOutLogType.ShortLeave:
                        {
                            UC.ViewModel.IsUsing      = true;
                            UC.ViewModel.IsShortLeave = true;
                            UC.ViewModel.IsBespeak    = false;
                            UC.ViewModel.IsWaiting    = false;
                            this.viewModel.LastSeatCount--;
                            break;
                        }

                        case EnterOutLogType.BespeakWaiting:
                        {
                            UC.ViewModel.IsUsing      = false;
                            UC.ViewModel.IsBespeak    = true;
                            UC.ViewModel.IsShortLeave = false;
                            UC.ViewModel.IsWaiting    = false;
                            if (!UC.ViewModel.IsCanSelectBespeakSeat)
                            {
                                this.viewModel.LastSeatCount--;
                            }
                            break;
                        }
                        }
                        UC.Background         = UC.ViewModel.SeatStateImage;
                        UC.ReaderImg.Fill     = UC.ViewModel.ReaderStateImage;
                        UC.PowerImg.Fill      = UC.ViewModel.PowerImage;
                        UC.ShortleaveImg.Fill = UC.ViewModel.ShortLeaveImage;
                        UC.BespeakImg.Fill    = UC.ViewModel.BespeakImage;
                    }
                    if (obj.GetType().Name == "Rectangle")
                    {
                        Rectangle rectangle = obj as Rectangle;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }

            canvas_Thumbnail.Children.RemoveRange(0, viewModel.Layout.Seats.Count);
            seatLayout_thumb();
            if (viewModel.ClientObject.SeatAutoAddSize)
            {
                SystemObject clientObject = SystemObject.GetInstance();
                this.Height  = viewModel.WindowHeight += clientObject.AddSize;
                this.Top     = viewModel.WindowTop -= clientObject.AddSize;
                G_bg.Height += clientObject.AddSize;
                seatLayout();
                btn_MaxWindow.Visibility    = Visibility.Collapsed;
                btn_NormnlWindow.Visibility = Visibility.Visible;
                WPFMessage.MessageHelper.SendMessage(clientObject.MediaClient, SeatManage.EnumType.SendClentMessageType.MoveUp, clientObject.AddSize.ToString());
                WeiCharOperationWindowObject.GetInstance().Window.WinChange((int)(Top));
            }
            //this.Topmost = true;
            this.Owner = ReadingRoomWindowObject.GetInstance().Window;
            //ReadingRoomWindowObject.GetInstance().Window.Hide();
            this.Topmost = true;
            this.Topmost = false;
            ShowDialog();
        }
コード例 #2
0
        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);
                }
            }
        }