Exemplo n.º 1
0
        public void ShowExtendedViewAsync(List <ParticipantView> views)
        {
            views.ForEach(x =>
            {
                if (ExtenedViewFrameList.Any(o => o.PhoneId == x.Participant.PhoneId))
                {
                    return;
                }

                var viewFrameVisible = ExtenedViewFrameList.ToList().FirstOrDefault(o => string.IsNullOrEmpty(o.PhoneId));
                if (viewFrameVisible != null)
                {
                    viewFrameVisible.IsOpened   = true;
                    viewFrameVisible.Visibility = Visibility.Visible;
                    viewFrameVisible.PhoneId    = x.Participant.PhoneId;

                    var attendee =
                        GlobalData.Instance.Classrooms.FirstOrDefault(
                            classroom => classroom.SchoolRoomNum == x.Participant.PhoneId);

                    var displayName = string.Empty;
                    if (!string.IsNullOrEmpty(attendee?.SchoolRoomName))
                    {
                        displayName = attendee.SchoolRoomName;
                    }

                    viewFrameVisible.ViewName = x.ViewType == 1
                        ? displayName
                        : $"(课件){displayName}";

                    viewFrameVisible.ViewType  = x.ViewType;
                    viewFrameVisible.ViewOrder = ViewFrameList.Max(viewFrame => viewFrame.ViewOrder) + 1;
                }
            });
            ExtentdedLaunchLayout();

            foreach (ViewFrame orderedView in ExtenedViewFrameList.Where(o => o.IsOpened))
            {
                try
                {
                    Log.Logger.Debug($"渲染双屏 phoneId={orderedView.PhoneId}, hwnd={orderedView.Hwnd}");
                    var result = _meetingService.SetDoubleScreenRender(orderedView.PhoneId, orderedView.ViewType,
                                                                       IsDoubleScreenOn ? 1 : 0, orderedView.Hwnd);
                    Log.Logger.Debug($"渲染结果{orderedView.PhoneId},结果{result.Status}");
                }
                catch (Exception ex)
                {
                    Log.Logger.Error($"{ex}");
                }
            }
        }
Exemplo n.º 2
0
 public void StopExtendedViewAsync()
 {
     foreach (ViewFrame orderedView in ExtenedViewFrameList.Where(o => !string.IsNullOrEmpty(o.PhoneId)))
     {
         try
         {
             Log.Logger.Debug($"停止渲染双屏{orderedView.PhoneId}{orderedView.Hwnd}");
             _meetingService.SetDoubleScreenRender(orderedView.PhoneId, orderedView.ViewType,
                                                   0, orderedView.Hwnd);
         }
         catch (Exception ex)
         {
             Log.Logger.Error($"{ex}");
         }
     }
 }
Exemplo n.º 3
0
        public void HideExtendedViewAsync(ParticipantView view)
        {
            if (view?.Participant == null || ExtenedViewFrameList == null)
            {
                ExtentdedLaunchLayout();
                return;
            }
            var viewFrameInvisible =
                ExtenedViewFrameList.FirstOrDefault(viewFrame => viewFrame.PhoneId == view.Participant.PhoneId);

            if (viewFrameInvisible != null)
            {
                // LOG return a handle which can not be found in handle list.
                viewFrameInvisible.IsOpened   = false;
                viewFrameInvisible.Visibility = Visibility.Collapsed;
                viewFrameInvisible.PhoneId    = null;
                // ExtenedViewFrameList.Remove(viewFrameInvisible);
            }
        }
Exemplo n.º 4
0
        private void ExtendedLaunchAverageLayout()
        {
            if ((int)GlobalData.Instance.ExtendedViewArea.Width % 16 != 0 || (int)GlobalData.Instance.ExtendedViewArea.Height % 9 != 0)
            {
                GlobalData.Instance.ExtendedViewArea.Height = GlobalData.Instance.ExtendedViewArea.Width / 16 * 9;
            }

            Log.Logger.Debug($"扩展屏宽度高度---{GlobalData.Instance.ExtendedViewArea.Width}---{GlobalData.Instance.ExtendedViewArea.Height}");
            var viewFramesVisible     = ExtenedViewFrameList.Where(o => !string.IsNullOrEmpty(o.PhoneId) && o.IsOpened);
            var viewFramesByDesending = viewFramesVisible.OrderBy(viewFrame => viewFrame.ViewOrder);

            var orderViewFrames = viewFramesByDesending.ToList();

            Log.Logger.Debug($"总数{orderViewFrames.Count}");
            viewFramesVisible.ToList().ForEach(x =>
            {
                Log.Logger.Debug($"视讯号{x.PhoneId};句柄{x.Hwnd}");
            });

            switch (orderViewFrames.Count)
            {
            case 0:
                //displays a picture
                break;

            case 1:
                var viewFrameFull = orderViewFrames[0];
                viewFrameFull.Visibility = Visibility.Visible;
                viewFrameFull.Row        = 0;
                viewFrameFull.RowSpan    = 10;
                viewFrameFull.Column     = 0;
                viewFrameFull.ColumnSpan = 30;

                viewFrameFull.Width             = GlobalData.Instance.ExtendedViewArea.Width;
                viewFrameFull.Height            = GlobalData.Instance.ExtendedViewArea.Height;
                viewFrameFull.VerticalAlignment = VerticalAlignment.Center;
                Log.Logger.Debug($"ExtendedLaunchAverageLayout=> phoneId={viewFrameFull.PhoneId}, name={viewFrameFull.ViewName}, hwnd={viewFrameFull.Hwnd}, width={viewFrameFull.Width}, height={viewFrameFull.Height}");

                break;


            case 2:
                var viewFrameLeft2  = orderViewFrames[0];
                var viewFrameRight2 = orderViewFrames[1];

                viewFrameLeft2.Visibility        = Visibility.Visible;
                viewFrameLeft2.Row               = 0;
                viewFrameLeft2.RowSpan           = 10;
                viewFrameLeft2.Column            = 0;
                viewFrameLeft2.ColumnSpan        = 15;
                viewFrameLeft2.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameLeft2.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameLeft2.VerticalAlignment = VerticalAlignment.Center;

                viewFrameRight2.Visibility        = Visibility.Visible;
                viewFrameRight2.Row               = 0;
                viewFrameRight2.RowSpan           = 10;
                viewFrameRight2.Column            = 15;
                viewFrameRight2.ColumnSpan        = 15;
                viewFrameRight2.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameRight2.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameRight2.VerticalAlignment = VerticalAlignment.Center;
                Log.Logger.Debug($"ExtendedLaunchAverageLayout=>left => phoneId={viewFrameLeft2.PhoneId}, name={viewFrameLeft2.ViewName}, hwnd={viewFrameLeft2.Hwnd}, width={viewFrameLeft2.Width}, height={viewFrameLeft2.Height}");
                Log.Logger.Debug($"ExtendedLaunchAverageLayout=>right => phoneId={viewFrameRight2.PhoneId}, name={viewFrameRight2.ViewName}, hwnd={viewFrameRight2.Hwnd}, width={viewFrameRight2.Width}, height={viewFrameRight2.Height}");

                break;

            case 3:

                var viewFrameLeft3   = orderViewFrames[0];
                var viewFrameRight3  = orderViewFrames[1];
                var viewFrameBottom3 = orderViewFrames[2];


                viewFrameLeft3.Visibility        = Visibility.Visible;
                viewFrameLeft3.Row               = 0;
                viewFrameLeft3.RowSpan           = 5;
                viewFrameLeft3.Column            = 0;
                viewFrameLeft3.ColumnSpan        = 15;
                viewFrameLeft3.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameLeft3.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameLeft3.VerticalAlignment = VerticalAlignment.Bottom;

                viewFrameRight3.Visibility        = Visibility.Visible;
                viewFrameRight3.Row               = 0;
                viewFrameRight3.RowSpan           = 5;
                viewFrameRight3.Column            = 15;
                viewFrameRight3.ColumnSpan        = 15;
                viewFrameRight3.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameRight3.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameRight3.VerticalAlignment = VerticalAlignment.Bottom;

                viewFrameBottom3.Visibility        = Visibility.Visible;
                viewFrameBottom3.Row               = 5;
                viewFrameBottom3.RowSpan           = 5;
                viewFrameBottom3.Column            = 0;
                viewFrameBottom3.ColumnSpan        = 15;
                viewFrameBottom3.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameBottom3.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameBottom3.VerticalAlignment = VerticalAlignment.Top;

                break;

            case 4:
                var viewFrameLeftTop4     = orderViewFrames[0];
                var viewFrameRightTop4    = orderViewFrames[1];
                var viewFrameLeftBottom4  = orderViewFrames[2];
                var viewFrameRightBottom4 = orderViewFrames[3];

                viewFrameLeftTop4.Visibility        = Visibility.Visible;
                viewFrameLeftTop4.Row               = 0;
                viewFrameLeftTop4.RowSpan           = 5;
                viewFrameLeftTop4.Column            = 0;
                viewFrameLeftTop4.ColumnSpan        = 15;
                viewFrameLeftTop4.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameLeftTop4.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameLeftTop4.VerticalAlignment = VerticalAlignment.Bottom;

                viewFrameRightTop4.Visibility        = Visibility.Visible;
                viewFrameRightTop4.Row               = 0;
                viewFrameRightTop4.RowSpan           = 5;
                viewFrameRightTop4.Column            = 15;
                viewFrameRightTop4.ColumnSpan        = 15;
                viewFrameRightTop4.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameRightTop4.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameRightTop4.VerticalAlignment = VerticalAlignment.Bottom;

                viewFrameLeftBottom4.Visibility        = Visibility.Visible;
                viewFrameLeftBottom4.Row               = 5;
                viewFrameLeftBottom4.RowSpan           = 5;
                viewFrameLeftBottom4.Column            = 0;
                viewFrameLeftBottom4.ColumnSpan        = 15;
                viewFrameLeftBottom4.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameLeftBottom4.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameLeftBottom4.VerticalAlignment = VerticalAlignment.Top;

                viewFrameRightBottom4.Visibility        = Visibility.Visible;
                viewFrameRightBottom4.Row               = 5;
                viewFrameRightBottom4.RowSpan           = 5;
                viewFrameRightBottom4.Column            = 15;
                viewFrameRightBottom4.ColumnSpan        = 15;
                viewFrameRightBottom4.Width             = GlobalData.Instance.ExtendedViewArea.Width / 2;
                viewFrameRightBottom4.Height            = GlobalData.Instance.ExtendedViewArea.Height / 2;
                viewFrameRightBottom4.VerticalAlignment = VerticalAlignment.Top;

                break;

            case 5:

                #region  托二

                #endregion

                #region 平均排列,两行三列

                var viewFrameLeftTop5     = orderViewFrames[0];
                var viewFrameMiddleTop5   = orderViewFrames[1];
                var viewFrameRightTop5    = orderViewFrames[2];
                var viewFrameLeftBottom5  = orderViewFrames[3];
                var viewFrameRightBottom5 = orderViewFrames[4];

                viewFrameLeftTop5.Visibility        = Visibility.Visible;
                viewFrameLeftTop5.Row               = 0;
                viewFrameLeftTop5.RowSpan           = 5;
                viewFrameLeftTop5.Column            = 0;
                viewFrameLeftTop5.ColumnSpan        = 10;
                viewFrameLeftTop5.Width             = GlobalData.Instance.ExtendedViewArea.Width * 0.3333;
                viewFrameLeftTop5.Height            = GlobalData.Instance.ExtendedViewArea.Width * 0.1875;
                viewFrameLeftTop5.VerticalAlignment = VerticalAlignment.Bottom;

                viewFrameMiddleTop5.Visibility        = Visibility.Visible;
                viewFrameMiddleTop5.Row               = 0;
                viewFrameMiddleTop5.RowSpan           = 5;
                viewFrameMiddleTop5.Column            = 10;
                viewFrameMiddleTop5.ColumnSpan        = 10;
                viewFrameMiddleTop5.Width             = GlobalData.Instance.ExtendedViewArea.Width * 0.3333;
                viewFrameMiddleTop5.Height            = GlobalData.Instance.ExtendedViewArea.Width * 0.1875;
                viewFrameMiddleTop5.VerticalAlignment = VerticalAlignment.Bottom;


                viewFrameRightTop5.Visibility        = Visibility.Visible;
                viewFrameRightTop5.Row               = 0;
                viewFrameRightTop5.RowSpan           = 5;
                viewFrameRightTop5.Column            = 20;
                viewFrameRightTop5.ColumnSpan        = 10;
                viewFrameRightTop5.Width             = GlobalData.Instance.ExtendedViewArea.Width * 0.3333;
                viewFrameRightTop5.Height            = GlobalData.Instance.ExtendedViewArea.Width * 0.1875;
                viewFrameRightTop5.VerticalAlignment = VerticalAlignment.Bottom;

                viewFrameLeftBottom5.Visibility        = Visibility.Visible;
                viewFrameLeftBottom5.Row               = 5;
                viewFrameLeftBottom5.RowSpan           = 5;
                viewFrameLeftBottom5.Column            = 0;
                viewFrameLeftBottom5.ColumnSpan        = 10;
                viewFrameLeftBottom5.Width             = GlobalData.Instance.ExtendedViewArea.Width * 0.3333;
                viewFrameLeftBottom5.Height            = GlobalData.Instance.ExtendedViewArea.Width * 0.1875;
                viewFrameLeftBottom5.VerticalAlignment = VerticalAlignment.Top;

                viewFrameRightBottom5.Visibility        = Visibility.Visible;
                viewFrameRightBottom5.Row               = 5;
                viewFrameRightBottom5.RowSpan           = 5;
                viewFrameRightBottom5.Column            = 10;
                viewFrameRightBottom5.ColumnSpan        = 10;
                viewFrameRightBottom5.Width             = GlobalData.Instance.ExtendedViewArea.Width * 0.3333;
                viewFrameRightBottom5.Height            = GlobalData.Instance.ExtendedViewArea.Width * 0.1875;
                viewFrameRightBottom5.VerticalAlignment = VerticalAlignment.Top;

                #endregion

                break;

            default:

                // LOG count of view frames is not between 0 and 5
                break;
            }
        }