protected override void InitializeFormView(Form form, WinformsViewInfo viewInf)
 {
     base.InitializeFormView(form, viewInf);
     // If it's main form then access its content panel.
     if (form is MainForm)
     {
         contentPanel = form.Controls["contentPanel"] as OutlookPanelEx;
     }
 }
示例#2
0
        public FrmMain()
        {
            //Always intialize the WebRTC engine first!
            RTC.Init();

            InitializeComponent();

            currParticipants = new List <CurrentParticipants>();

            snd = new SoundPlayer();

            ShowStatus("Initializing RTC..");

            iconfRTC = new RTCControl {
                Dock = DockStyle.Fill
            };

            settings = new frmSettings(iconfRTC);

            //setup the signaling
            iconfRTC.SignalingUrl  = ConfigurationManager.AppSettings["SignalingUrl"];
            iconfRTC.SignalingType = SignalingTypes.Socketio;

            //logging
            iconfRTC.LoggingEnabled = true;
            iconfRTC.LogFilePath    = Path.GetTempPath() + @"\rtclog.txt";

            #region iConfRTC Events

            iconfRTC.DoubleClick            += IconfRTC_DoubleClick;
            iconfRTC.RTCInitialized         += IconfRTC_RTCInitialized;
            iconfRTC.IJoinedMeeting         += IconfRTC_IJoinedMeeting;
            iconfRTC.UserJoinedMeeting      += IconfRTC_UserJoinedMeeting;
            iconfRTC.UserLeftMeeting        += IconfRTC_UserLeftMeeting;
            iconfRTC.ILeftMeeting           += IconfRTC_ILeftMeeting;
            iconfRTC.NewDevices             += IconfRTC_NewDevices;
            iconfRTC.MeetingMessageReceived += IconfRTC_MeetingMessageReceived;

            #endregion


            var pnlMyViewerParent = new OutlookPanelEx()
            {
                Width = 480, Height = 360, Visible = true, HeaderText = ""
            };


            pnlMyViewerParent.Controls.Add(iconfRTC);



            pnlLayout.Controls.Add(pnlMyViewerParent);

            //rtf text  box for chat
            rtBox = new HtmlPanel {
                Parent = pnlFill, Dock = DockStyle.Fill, AutoScroll = true
            };

            chatFont = new Font(Font, FontStyle.Bold);

            pnlLayout.Show();

            PositionJoinPanel();
        }
示例#3
0
        private void ProcessParticipants(List <MeetingParticipants> participants, string sessionJoined, bool isSharing)
        {
            //when a user joins a meeting we receive a list of meeting participants ( including yourself )
            //we go through the list , create viewers (RTCControls) for each participant and call ViewSession,
            //passing along the participant's sessionId

            foreach (var participant in participants)
            {
                if (participant.Session != iconfRTC.MySession) //you are already seeing yourself :)
                {
                    if (participant.UserName == "sharing-" + iconfRTC.MyUserName)
                    {
                        return;
                    }

                    var sessionExists = currParticipants.Any(p => p.Session == participant.Session);

                    if (!sessionExists)
                    {
                        var viewer = new RTCControl
                        {
                            SignalingType = SignalingTypes.Socketio,
                            SignalingUrl  = iconfRTC.SignalingUrl,
                            Dock          = DockStyle.Fill
                        };



                        var pnlViewerParent = new OutlookPanelEx()
                        {
                            Tag    = participant.Session,
                            Width  = 480,
                            Height = 360
                        };


                        pnlViewerParent.Controls.Add(viewer);

                        if (participant.Session == sessionJoined && isSharing)
                        {
                            //overlay sharing picturebox
                            var overlayPicture = new PictureBox
                            {
                                SizeMode = PictureBoxSizeMode.AutoSize,
                                Image    = pbSharing.Image,
                                Dock     = DockStyle.Fill,
                                Anchor   = AnchorStyles.Bottom | AnchorStyles.Right
                            };
                            overlayPicture.Show();
                            pnlViewerParent.Controls.Add(overlayPicture);
                            overlayPicture.BringToFront();
                            var workingArea = pnlViewerParent.Bounds;
                            overlayPicture.Location = new Point(workingArea.Right - Size.Width,
                                                                workingArea.Bottom - Size.Height);
                        }

                        pnlViewerParent.Visible    = true;
                        pnlViewerParent.HeaderText = participant.UserName;
                        pnlLayout.Controls.Add(pnlViewerParent);

                        currParticipants.Add(new CurrentParticipants
                        {
                            Session     = participant.Session,
                            UserName    = participant.UserName,
                            PanelLayout = pnlViewerParent,
                            RTCControl  = viewer
                        });


                        //only call webrtc functions when WebRTC is ready!!
                        viewer.RTCInitialized += a =>
                        {
                            //you can add additional ice servers if you'd like
                            //  viewer.AddIceServer(url: "numb.viagenie.ca", userName: "******", password: "******", clearFirst: false, type: "turn");
                            //viewer.AddIceServer("stun.voiparound.com");

                            //webrtc is ready, connect to signaling
                            viewer.ViewSession(participant.UserName, participant.Session);
                        };
                    }
                }
            }
        }