Пример #1
0
        private void FMain_Load(object sender, System.EventArgs e)
        {
            // display Recording Notification
            if (!System.Diagnostics.Debugger.IsAttached && recordNotify)
            {
                frmNotification notification = new frmNotification();
                notification.ShowDialog();
            }

            Cursor = Cursors.AppStarting;

            // Hook up this form to ConferenceAPI so it knows where to post back Events so they occur on the form thread.
            DisplayStatusInProgress("Loading ConferenceAPI.");

            Conference.CallingForm = this;

            // Set the default Conferencing behavior
            Conference.AutoPlayLocal = true;
            Conference.AutoPlayRemote = true;
            Conference.AutoPosition = Conference.AutoPositionMode.FourWay;

            // Hook the Conference events to this form's events
            Conference.ParticipantAdded += new Conference.ParticipantAddedEventHandler(OnParticipantAdded);
            Conference.ParticipantRemoved += new Conference.ParticipantRemovedEventHandler(OnParticipantRemoved);
            Conference.CapabilityAdded += new CapabilityAddedEventHandler(OnCapabilityAdded);
            Conference.CapabilityRemoved += new CapabilityRemovedEventHandler(OnCapabilityRemoved);
            Conference.DuplicateIdentityDetected += new Conference.DuplicateIdentityDetectedEventHandler(OnDuplicateIdentityDetected);

            // Make use of the internal socket exceptions to determine network status
            RtpEvents.HiddenSocketException += new RtpEvents.HiddenSocketExceptionEventHandler(HiddenSockExHandler);

            #region Load Settings from Registry
            try
            {
                // Load the form location settings from the registry
                object val;

                if ((val = cxpclientRegKey.GetValue("Top")) != null)
                {
                    this.Top = Convert.ToInt32(val);
                }
                else
                {
                    this.Top = SystemInformation.WorkingArea.Top;
                }

                if ((val = cxpclientRegKey.GetValue("Left")) != null)
                {
                    this.Left = Convert.ToInt32(val);
                }
                else
                {
                    this.Left = SystemInformation.WorkingArea.Right - this.Width;
                }

                if ((val = cxpclientRegKey.GetValue("Width")) != null)
                {
                    this.Width = Convert.ToInt32(val);
                }

                if ((val = cxpclientRegKey.GetValue("Height")) != null)
                {
                    this.Height = Convert.ToInt32(val);
                }

                if ((val = cxpclientRegKey.GetValue("AutoPlayRemote")) != null)
                {
                    Conference.AutoPlayRemote = Convert.ToBoolean(val);
                }

                if ((val = cxpclientRegKey.GetValue("AutoPlayLocal")) != null)
                {
                    Conference.AutoPlayLocal = Convert.ToBoolean(val);
                }

                if ((val = AVReg.ReadValue(AVReg.RootKey, AVReg.AutoPlayRemoteAudio)) != null)
                {
                    autoPlayRemoteAudio = bool.Parse((string)val);
                }

                if ((val = AVReg.ReadValue(AVReg.RootKey, AVReg.AutoPlayRemoteVideo)) != null)
                {
                    autoPlayRemoteVideo = bool.Parse((string)val);
                }

                if ((val = cxpclientRegKey.GetValue("AutoPosition")) != null)
                {
                    Conference.AutoPosition = (Conference.AutoPositionMode)Enum.Parse(Conference.AutoPosition.GetType(), val.ToString());
                }
            }
            catch
            {
                // Set the default location of the form to the top right corner of the working area
                this.Top = SystemInformation.WorkingArea.Top;
                this.Left = SystemInformation.WorkingArea.Right - this.Width;
                // Width and Height defaults are set by the development environment
            }
            #endregion

            #region Set RTDocs Viewers, Services, and Check for Student Mode
            DisplayRTDocumentViewers();

            // Pre-populate Archive service if there are no entries in the registry and one is specified in app.config
            string setting = null;
            if (archiversRegKey.ValueCount == 0)
            {
                string asKey = "MSR.LST.ConferenceXP.ArchiveService";
                if ((setting = ConfigurationManager.AppSettings[asKey]) != null)
                {
                    archiversRegKey.SetValue(setting, "False");
                }

                // The next entry in the app.config starts with the postfix 2
                // i.e. - MSR.LST.ConferenceXP.ArchiveService2
                int postfix = 2;

                while ((setting = ConfigurationManager.AppSettings[asKey + postfix]) != null)
                {
                    archiversRegKey.SetValue(setting, "False");
                    postfix++; // Move to the next entry
                }
            }

            // Pre-populate Reflector service if there are no entries in the
            // registry and one (or more) is specified in app.config
            // Disabled by default
            if (reflectorsRegKey.ValueCount == 0)
            {
                string rsKey = "MSR.LST.ConferenceXP.ReflectorService";

                if ((setting = ConfigurationManager.AppSettings[rsKey]) != null)
                {
                    reflectorsRegKey.SetValue(setting, "False");
                }

                // The next entry in the app.config starts with the postfix 2
                // i.e. - MSR.LST.ConferenceXP.ReflectorService2
                int postfix = 2;

                while ((setting = ConfigurationManager.AppSettings[rsKey + postfix]) != null)
                {
                    reflectorsRegKey.SetValue(setting, "False");
                    postfix++; // Move to the next entry
                }
            }

            // Check if student mode has been configured, and disable appropriate menus if needed
            setting = ConfigurationManager.AppSettings["MSR.LST.ConferenceXP.StudentMode"];
            bStudentMode = (setting != null && bool.Parse(setting));

            if (bStudentMode)
            {
                // Disable menu settings
                menuActions.Visible = false;
                menuSettingsAudioVideo2.Visible = false;
                menuSettingsServices.Visible = false;
                menuSettingsNetworkDiagnostics.Visible = false;
                menuSettingsNetworkDiagnostics.Visible = false;
                menuMyProfile.Visible = false;
            }
            else
            {
                DisplayStatusInProgress("Loading Venues.");
                InitVenueService();
                GetArchiveService();
                SetReflectorService();
                DisplayOtherCapabilitySenders();
                SetDefaultDevices();
            }
            #endregion

            InvokeActionArguments(arguments.Parameters);

            if (bStudentMode && Conference.ActiveVenue == null)
            {
                // Create a custom venue and enter it
                JoinVenue(AddLocalVenue(), false);
            }

            // Auto-start the connectivity detector, if it's set to
            setting = ConfigurationManager.AppSettings["MSR.LST.Net.ConnectivityDetector.AutoStart"];
            if (setting != null && bool.Parse(setting))
            {
                stoplight = new frmStopLight();
            }

            // Detect whether or not the UW Classroom Presenter Capability has been installed, and if so, display it on the Actions menu
            ArrayList alCapabilitySenders = new ArrayList(Conference.OtherCapabilitySenders);
            if (alCapabilitySenders.Contains("Classroom Presenter"))
            {
                menuActionsUWClassroomPresenter.Visible = true;
            }

            // A venue may already be entered by command line parameters
            if (Conference.ActiveVenue == null)
            {
                DisplayVenues();
            }
            else
            {
                InVenueUIState();
            }

            Cursor = Cursors.Default;
        }
Пример #2
0
        private void FMain_Load(object sender, System.EventArgs e)
        {
            this.listView.Font = UIFont.StringFont;
            this.statusBar.Font = UIFont.StatusFont;
            this.btnLeaveConference.Font = UIFont.StringFont;

            this.statusBar.Text = Strings.Loading;
            this.btnLeaveConference.Text = Strings.LeaveVenue;
            this.menuSettings.Text = Strings.SettingsHotkey;
            this.menuSettingsAudioVideo2.Text = Strings.AudioVideoHotkey;
            this.menuSettingsServices.Text = Strings.ServicesHotkey;
            this.menuSettingsRTDocViewer.Text = Strings.PresentationViewerHotkey;
            //this.menuSettingsNetworkDiagnostics.Text = Strings.StartConnectivityHotkey;
            this.menuMyProfile.Text = Strings.ProfileHotkey;
            this.menuSettingsAppConfig.Text = Strings.AppConfigHotkey;
            this.menuActions.Text = Strings.ActionsHotkey;
            this.menuActionsPresentation.Text = Strings.StartPresentationHotkey;
            this.menuActionsChat.Text = Strings.StartChatHotkey;
            this.menuActionsWMPlayback.Text = Strings.StartWindowsMedia;
            this.menuActionsScreenScraper.Text = Strings.StartScreenStreaming;
            this.menuActionsSharedBrowser.Text = Strings.StartSharedBrowser;
            this.menuActionsUWClassroomPresenter.Text = Strings.StartUWPresenter;
            this.menuActionsCapabilities.Text = Strings.StartOtherCapabilitiesHotkey;
            this.menuActionsActiveCapabilities.Text = Strings.ActiveVenueCapabilitiesHotkey;
            this.menuActionsRecord.Text = Strings.RecordConferenceHotkey;
            this.menuActionsPlayback.Text = Strings.PlayRecordedConferenceHotkey;
            this.menuActionsDiagnostics.Text = Strings.ViewConferenceDiagnostics;
            this.menuActionsUnicast.Text = Strings.StartUnicastConference;
            this.menuActionsPersist.Text = Strings.PersistWindowPositions;
            this.menuItem5.Text = Strings.HelpHotkey;
            this.menuHelpConferenceXP.Text = Strings.ConferenceXPHelpHotkey;
            this.menuHelpCommunity.Text = Strings.CommunitySiteHotkey;
            this.menuHelpAbout.Text = Strings.AboutConferenceXPClientHotkey;
            this.Text = Strings.ConferenceXP;

            // display Recording Notification
            if (!System.Diagnostics.Debugger.IsAttached && recordNotify)
            {
                frmNotification notification = new frmNotification();
                notification.ShowDialog();
            }

            Cursor = Cursors.AppStarting;

            // Hook up this form to ConferenceAPI so it knows where to post back Events so they occur on the form thread.
            DisplayStatusInProgress(Strings.LoadingConferenceAPI);

            Conference.CallingForm = this;

            // Set the default Conferencing behavior
            Conference.AutoPlayLocal = true;
            Conference.AutoPlayRemote = true;
            Conference.AutoPosition = Conference.AutoPositionMode.FourWay;

            // Hook the Conference events to this form's events
            Conference.ParticipantAdded += new Conference.ParticipantAddedEventHandler(OnParticipantAdded);
            Conference.ParticipantRemoved += new Conference.ParticipantRemovedEventHandler(OnParticipantRemoved);
            Conference.CapabilityAdded += new CapabilityAddedEventHandler(OnCapabilityAdded);
            Conference.CapabilityRemoved += new CapabilityRemovedEventHandler(OnCapabilityRemoved);
            Conference.DuplicateIdentityDetected += new Conference.DuplicateIdentityDetectedEventHandler(OnDuplicateIdentityDetected);
            Conference.DiagnosticUpdate += new Conference.DiagnosticUpdateEventHandler(OnDiagnosticUpdate);

            // Make use of the internal socket exceptions to determine network status
            RtpEvents.HiddenSocketException += new RtpEvents.HiddenSocketExceptionEventHandler(HiddenSockExHandler);

            #region Load Settings from Registry
            try
            {
                // Load the form location settings from the registry
                object val;

                if ((val = cxpclientRegKey.GetValue("Top")) != null)
                {
                    this.Top = Convert.ToInt32(val, CultureInfo.InvariantCulture);
                }
                else
                {
                    this.Top = SystemInformation.WorkingArea.Top;
                }

                if ((val = cxpclientRegKey.GetValue("Left")) != null)
                {
                    this.Left = Convert.ToInt32(val, CultureInfo.InvariantCulture);
                }
                else
                {
                    this.Left = SystemInformation.WorkingArea.Right - this.Width;
                }

                if ((val = cxpclientRegKey.GetValue("Width")) != null)
                {
                    this.Width = Convert.ToInt32(val, CultureInfo.InvariantCulture);
                }

                if ((val = cxpclientRegKey.GetValue("Height")) != null)
                {
                    this.Height = Convert.ToInt32(val, CultureInfo.InvariantCulture);
                }

                if ((val = cxpclientRegKey.GetValue("AutoPlayRemote")) != null)
                {
                    Conference.AutoPlayRemote = Convert.ToBoolean(val, CultureInfo.InvariantCulture);
                }

                if ((val = cxpclientRegKey.GetValue("AutoPlayLocal")) != null)
                {
                    Conference.AutoPlayLocal = Convert.ToBoolean(val, CultureInfo.InvariantCulture);
                }

                if ((val = AVReg.ReadValue(AVReg.RootKey, AVReg.AutoPlayRemoteAudio)) != null)
                {
                    autoPlayRemoteAudio = bool.Parse((string)val);
                }

                if ((val = AVReg.ReadValue(AVReg.RootKey, AVReg.AutoPlayRemoteVideo)) != null)
                {
                    autoPlayRemoteVideo = bool.Parse((string)val);
                }

                if ((val = cxpclientRegKey.GetValue("AutoPosition")) != null)
                {
                    Conference.AutoPosition = (Conference.AutoPositionMode)Enum.Parse(Conference.AutoPosition.GetType(), val.ToString());
                }

                this.menuActionsPersist.Checked = Conference.PersistWindowPositions = false;
                if ((val = cxpclientRegKey.GetValue("PersistWindowPositions")) != null) {
                    this.menuActionsPersist.Checked = Conference.PersistWindowPositions = Convert.ToBoolean(val, CultureInfo.InvariantCulture);
                }

                if ((val = cxpclientRegKey.GetValue("EnableAudioFec")) != null) {
                    enableAudioFec = Convert.ToBoolean(val, CultureInfo.InvariantCulture);
                }

                if ((val = cxpclientRegKey.GetValue("EnableVideoFec")) != null) {
                    enableVideoFec = Convert.ToBoolean(val, CultureInfo.InvariantCulture);
                }


            }
            catch
            {
                // Set the default location of the form to the top right corner of the working area
                this.Top = SystemInformation.WorkingArea.Top;
                this.Left = SystemInformation.WorkingArea.Right - this.Width;
                // Width and Height defaults are set by the development environment
            }
            #endregion

            #region Set RTDocs Viewers, Services, and Check for Student Mode

            DisplayRTDocumentViewers();

            #region Pre-populate Reflector and Archive Services on first run
            /// If there is no existing registry configuration for services, we use whatever is in app.config
            /// to pre-populate it.  After the initial run, or until the registry configuration is removed, 
            /// the app.config is ignored.  
            
            // Pre-populate Archive service if there are no entries in the registry and one is specified in app.config
            string setting = null;
            if (archiversRegKey.ValueCount == 0)
            {
                string asKey = "MSR.LST.ConferenceXP.ArchiveService";
                if ((setting = ConfigurationManager.AppSettings[asKey]) != null)
                {
                    archiversRegKey.SetValue(setting, "False");
                }

                // The next entry in the app.config starts with the postfix 2
                // i.e. - MSR.LST.ConferenceXP.ArchiveService2
                int postfix = 2;

                while ((setting = ConfigurationManager.AppSettings[asKey + postfix]) != null)
                {
                    archiversRegKey.SetValue(setting, "False");
                    postfix++; // Move to the next entry
                }
            }

            // Pre-populate Reflector service if there are no entries in the 
            // registry and one (or more) is specified in app.config
            // Disabled by default
            if (reflectorsRegKey.ValueCount == 0)
            {
                string rsKey = "MSR.LST.ConferenceXP.ReflectorService";

                if ((setting = ConfigurationManager.AppSettings[rsKey]) != null)
                {
                    reflectorsRegKey.SetValue(setting, "False");
                }

                // The next entry in the app.config starts with the postfix 2
                // i.e. - MSR.LST.ConferenceXP.ReflectorService2
                int postfix = 2;

                while ((setting = ConfigurationManager.AppSettings[rsKey + postfix]) != null)
                {
                    reflectorsRegKey.SetValue(setting, "False");
                    postfix++; // Move to the next entry
                }
            }

            #endregion Pre-populate Services

            // Set the maximum extent of the video bitrate slider
            setting = ConfigurationManager.AppSettings["MSR.LST.ConferenceXP.MaximumVideoBitRate"];
            int vbr;
            if (int.TryParse(setting, out vbr)) {
                frmVideoSettings.MaximumVideoBitRate = vbr;
            }

            // Check if student mode has been configured, and disable appropriate menus if needed           
            setting = ConfigurationManager.AppSettings["MSR.LST.ConferenceXP.StudentMode"];
            bStudentMode = (setting != null && bool.Parse(setting));

            if (bStudentMode)
            {
                // Disable menu settings
                menuActions.Visible = false;
                menuSettingsAudioVideo2.Visible = false;
                menuSettingsServices.Visible = false;
                menuMyProfile.Visible = false;
            }
            else
            {
                DisplayStatusInProgress(Strings.LoadingVenues);
                InitVenueService();
                GetArchiveService();
                SetReflectorService();
                SetDiagnosticService();
                DisplayOtherCapabilitySenders();
                SetDefaultDevices();
            }
            #endregion

            InvokeActionArguments(arguments.Parameters);

            // load manual venue mappings from venues.txt
            LoadManualVenues();

            if (bStudentMode && Conference.ActiveVenue == null)
            {
                // Create a custom venue and enter it
                JoinVenue(AddLocalVenue(), false);
            }

            // Detect whether or not the UW Classroom Presenter Capability has been installed, and if so, display it on the Actions menu
            ArrayList alCapabilitySenders = new ArrayList(Conference.OtherCapabilitySenders);
            if (alCapabilitySenders.Contains("Classroom Presenter"))
            {
                menuActionsUWClassroomPresenter.Visible = true;
            }

            // A venue may already be entered by command line parameters
            if (Conference.ActiveVenue == null)
            {
                DisplayVenues();
            }
            else
            {
                InVenueUIState();
            }

            // Associate the toolTip with the listView
            this.toolTip.SetToolTip(this.listView, "foobar");

            Cursor = Cursors.Default;
        }