Exemplo n.º 1
0
 public frmNote(OCL.User AccessingUser,OCL.RecordingSession RS,OCL.Note CN)
 {
     this.AccessingUser = AccessingUser;
     this.RS = RS;
     this.CN = CN;
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     NewFiles = new ArrayList();
     DeletedFiles = new ArrayList();
     //
     // TODO: Add any constructor code after InitializeComponent call
     //
 }
Exemplo n.º 2
0
 public frmNote(OCL.User AccessingUser,OCL.RecordingSession RS,OCL.Note CN)
 {
     this.AccessingUser = AccessingUser;
     this.RS = RS;
     this.CN = CN;
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     NewFiles = new ArrayList();
     DeletedFiles = new ArrayList();
     OysterFTP = new OCL.FTPTransfer();
     OysterFTP.On_TransferProgress +=new OCL.FTPTransfer.FTPTransferEventHandler(OysterFTP_On_TransferProgress);
     //
     // TODO: Add any constructor code after InitializeComponent call
     //
 }
        public frmRecordingSessionPermissions(ref OCL.Group G,ref OCL.RecordingSession RS)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.RS = RS;
            this.G = G;

            this.Text = G.Description + "'s " + RS.Description + " Permissions";
            this.groupBox1.Text = "Modify User's access to " + RS.Description + " in group " +
                G.Description;
            this.gbRecordingSessions.Text = "Current permissions for " + RS.Description;
        }
Exemplo n.º 4
0
		public void OpenRecordingSession(OCL.RecordingSession RS,
			OCL.User AccessingUser,AxUMediaControlLib.AxUMediaPlayer Preview_Player,
			AxUMediaControlLib.AxUMediaPlayer PlayBack_Player)
		{
			
			pLUser = AccessingUser;			
			PreviewPlayer = Preview_Player;
			PlayBackPlayers = new ArrayList();
			if(PlayBack_Player != null)
				PlayBackPlayers.Add(PlayBack_Player);
			TStatusChecker = new System.Timers.Timer(500);
			TStatusChecker.Elapsed +=new System.Timers.ElapsedEventHandler(TStatusChecker_Elapsed);			
	
			CameraAngles = new ArrayList();
			CurrentRecordingSession = RS;						
			PresentationViews = RS.CurrentRecordings(pLUser);									
							
			if(RS.IsPresentation)
			{				
				foreach(OCL.Recording CurrentRecording in PresentationViews)
				{
					OCL.VideoStorageServer VSS = CurrentRecording.CurrentVideoStorageServer;
					OCL.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;
								
					if(CurrentRecording.IsPrimaryCamera)
					{
						CurrentCameraIndex = CameraAngles.Count;
						CameraAngles.Add(CurrentRecording);
						try
						{
							if(VST.Description == "Windows Media Server")
							{
								try
								{
									PreviewPlayer.Stop();
								}
								catch(Exception Err)
								{
									string sPeek = Err.Message;
								}
								PreviewPlayer.UseTCP();           
								PreviewPlayer.UseMediaServer(VSS.ControlAddress + ":5119");
								PreviewPlayer.UseFile(VSS.StorageDirectory + @"\" + CurrentRecording.Description);											
							}
						}
						catch(Exception Err)
						{
							MessageBox.Show(Err.Message,"Error occurred while loading media");
							return;
						}
					}
					else if(CurrentRecording.IsDesktopCapture)
					{
						try
						{
							if(PlayBackPlayers.Count != 1)
							{								
								throw new Exception("Functional Error: Not enough cameras are available to display Presentation");
							}
							if(VST.Description == "Windows Media Server")
							{								
								try
								{
									((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).Stop();
								
								}
								catch(Exception Err)
								{
									string sPeek = Err.Message;
								}

								((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).UseTCP();           
								((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).UseMediaServer(VSS.ControlAddress + ":5119");
								((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).UseFile(VSS.StorageDirectory + @"\" + CurrentRecording.Description);											
							}
						}
						catch(Exception Err)
						{
							MessageBox.Show(Err.Message,"Error occurred while loading media");
							return;
						} 
					}
					else
					{						
						CameraAngles.Add(CurrentRecording);
					}
				}					
			}
			else
			{				
				CurrentCameraIndex = 0;
				bool bFirstPass = true;
				foreach(OCL.Recording CurrentRecording in PresentationViews)
				{
					OCL.VideoStorageServer VSS = CurrentRecording.CurrentVideoStorageServer;
					OCL.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;
					
					if(bFirstPass)
					{
						bFirstPass = false;
						CurrentCameraIndex = CameraAngles.Count;
						CameraAngles.Add(CurrentRecording);
						try
						{
							if(VST.Description == "Windows Media Server")
							{
								try
								{
									PreviewPlayer.Stop();
								}
								catch(Exception Err)
								{
									string sPeek = Err.Message;
								}
								PreviewPlayer.UseTCP();           
								PreviewPlayer.UseMediaServer(VSS.ControlAddress + ":5119");
								PreviewPlayer.UseFile(VSS.StorageDirectory + @"\" + CurrentRecording.Description);											
							}
						}
						catch(Exception Err)
						{
							MessageBox.Show(Err.Message,"Error occurred while loading media");
							return;
						}
					}
					else
						CameraAngles.Add(CurrentRecording);					
				}				
			}			
			this.Play();
					
			TStatusChecker.Enabled = true;			
			return;
		}
Exemplo n.º 5
0
        void StartRecording()
        {
            frmRecordOptions frm = new frmRecordOptions();

            if(!System.IO.Directory.Exists(frm.CurrentRecordOptions.WMVDirectory))
            {
                try
                {
                    System.IO.Directory.CreateDirectory(frm.CurrentRecordOptions.WMVDirectory);
                }
                catch(Exception Err)
                {
                    MessageBox.Show("Error details:" + Err.Message,"Temporary storage directory does not exist. Creation attempt failed.",MessageBoxButtons.OK,MessageBoxIcon.Error);
                    return;
                }
            }
            frmStatusWindow StatusWindow = new frmStatusWindow("Desktop Recorder: Preparing Session Capture","Please wait...");

            bDontClick = true;
            StatusWindow.Owner = this;
            StatusWindow.Show();
            bool bRecordCamera = true, bRecordScreen = true; // bError = false;
            int NumCams = 0;
            string sErrorBody = "";
            string sErrorCaption = "";

            //btnStartStop.Text = "Preparing...";

            //btnStartStop.Update();
            Application.DoEvents();

            //			clock.DigitalDisplayColor = SriClocks.DigitalColor.GreenColor;
            //			clock.ClockDisplayType = SriClocks.ClockType.StopWatch;
            //			clock.Reset();
            //			btnStartStop.Text = "STOP";

            // startup the oyster encoder

            RecordOptions ro = frm.CurrentRecordOptions;
            bool bIsSession = false;

            System.Diagnostics.Debug.Assert(m_oec == null,"OEC should be null when starting a recording.");
            #region SCREEN SELECTION

            object oparams = null;
            ScreenEncoder.CapturePerformance cp = ScreenEncoder.CapturePerformance.VeryLow;
            ScreenEncoder.CaptureType ct = ScreenEncoder.CaptureType.FullScreen;
            switch (frm.CurrentRecordOptions.RecordType)
            {
                case RecordOptions.ScreenRecordType.ScreenRecordNone:
                    bRecordScreen = false;
                    break;
                case RecordOptions.ScreenRecordType.ScreenRecordFullScreen:

                    //					oparams = "N/A";
                    /*Changed By Kevin Gray 5-6-05 due to errors in typecasting "N/A" to an object[]*/
                    oparams = new object[1];
                    cp = frm.CurrentRecordOptions.ScreenCapturePerformance;
                    ct = ScreenEncoder.CaptureType.FullScreen;
                    bRecordScreen = true;
                    break;
                case RecordOptions.ScreenRecordType.ScreenRecordWindow:
                    CarverLab.Utility.Win32Wrapper w32 = new CarverLab.Utility.Win32Wrapper();
                    CarverLab.Utility.Window CapWin = w32[frm.CurrentRecordOptions.WindowTitleToRecord];

                    cp = frm.CurrentRecordOptions.ScreenCapturePerformance;
                    if (frm.CurrentRecordOptions.WindowTitleToRecord == string.Empty ||
                        CapWin == null)
                    {
                        if (System.Windows.Forms.MessageBox.Show(this,"Could not find the specified window entitled: " + frm.CurrentRecordOptions.WindowTitleToRecord + ". Continue and record the full screen instead?",
                            "Record the Entire Screen?",System.Windows.Forms.MessageBoxButtons.YesNo,
                            System.Windows.Forms.MessageBoxIcon.Question,System.Windows.Forms.MessageBoxDefaultButton.Button1)
                            == System.Windows.Forms.DialogResult.Yes)
                        {
                            ct = ScreenEncoder.CaptureType.FullScreen;
                            oparams = "N/A";
                        }
                        else
                        {
                            if(bRecordCamera)
                            {

                                if (System.Windows.Forms.MessageBox.Show(this,"Would you like to continue recording camera(s)?",
                                    "Record Cameras without Screen Capture?",System.Windows.Forms.MessageBoxButtons.YesNo,
                                    System.Windows.Forms.MessageBoxIcon.Question,System.Windows.Forms.MessageBoxDefaultButton.Button1)
                                    != System.Windows.Forms.DialogResult.Yes)
                                {
                                    bRecordScreen = false;
                                }
                            }
                        }
                    }
                    else
                    {
                        System.Diagnostics.Debug.Assert(CapWin != null,"CapWin should not be null!");
                        ct = ScreenEncoder.CaptureType.WindowByHandle;
                        oparams = CapWin;
                    }
                    break;
                default:
                    System.Diagnostics.Debug.Assert(false,"Invalid recording type selected for screen recording.");
                    break;
            }

            #endregion

            #region SET UP FOR SCREEN RECORD

            if (bRecordScreen)
            {
                if (!m_encoder.Execute(ScreenEncoder.Command.SetupEncoder,cp,ct,oparams))
                {
                    sErrorBody = "Could not start the screen recording process. This is a serious error. Contact your system administrator.";
                    sErrorCaption = "Screen Recording Failure...";
                    goto Label_Screen_Error;
                }
                Application.DoEvents();
                System.Threading.Thread.Sleep(1500);
                Application.DoEvents();
            }
            #endregion

            #region CAMERA SELECTION

            switch (ro.SelectedCamera)
            {
                case RecordOptions.CameraSelection.CameraNone:
                    bRecordCamera = false;
                    NumCams = 0;
                    break;
                case RecordOptions.CameraSelection.CameraOne:
                    NumCams = 1;

                    m_sCameraRecordingName = new string[1];
                    m_oec = new OysterEncoderController.Control[1];
                    m_oec[0] = new OysterEncoderController.Control(ro.DefaultOysterDeviceAddress,OysterEncoderController.Control.CameraDefaultPort(1),ref mLogger);

                    if (!m_oec[0].Open())
                    {
                        sErrorBody = "Could not start the camera one recording process. Camera may be in use or this could be a serious error. Contact your system administrator.";
                        sErrorCaption = "Camera Recording Failure...";
                        //bRecordCamera = false;
                        //bError = true;
                        //Reset();
                        goto Label_Camera_Error;
                    }
                    break;
                case RecordOptions.CameraSelection.CameraTwo:
                    NumCams = 1;
                    m_sCameraRecordingName = new string[1];
                    m_oec = new OysterEncoderController.Control[1];
                    m_oec[0] = new OysterEncoderController.Control(ro.DefaultOysterDeviceAddress,OysterEncoderController.Control.CameraDefaultPort(2),ref mLogger);
                    if (!m_oec[0].Open())
                    {
                        sErrorBody = "Could not start the camera two recording process. Camera may be in use or this could be a serious error. Contact your system administrator.";
                        sErrorCaption = "Camera Recording Failure...";
                        goto Label_Camera_Error;
                    }
                    break;
                case RecordOptions.CameraSelection.CameraOneAndTwo:
                    NumCams = 2;
                    bIsSession = true;
                    m_sCameraRecordingName = new string[2];
                    m_oec = new OysterEncoderController.Control[2];
                    m_oec[0] = new OysterEncoderController.Control(ro.DefaultOysterDeviceAddress,OysterEncoderController.Control.CameraDefaultPort(1),ref mLogger);
                    if (!m_oec[0].Open())
                    {
                        sErrorBody = "Could not start the camera one recording process. Camera may be in use or this could be a serious error. Contact your system administrator.";
                        sErrorCaption = "Camera Recording Failure...";
                        goto Label_Camera_Error;
                    }
                    m_oec[1] = new OysterEncoderController.Control(ro.DefaultOysterDeviceAddress,OysterEncoderController.Control.CameraDefaultPort(2),ref mLogger);
                    if (!m_oec[1].Open())
                    {
                        sErrorBody = "Could not start the camera two recording process. Camera may be in use or this could be a serious error. Contact your system administrator.";
                        sErrorCaption = "Camera Recording Failure...";
                        goto Label_Camera_Error;
                    }
                    break;
                default:
                    System.Diagnostics.Debug.Assert(false,"Invalid SelectedCamera enum");

                    sErrorBody = "A programmer error detected.  Please try reselected the desired camera in the options menu. If problem persist please contact your Administrator.";
                    sErrorCaption = "Programmer Error: Invalid SelectedCamera enum";
                    //bRecordCamera = false;
                    //bError = true;
                    goto Label_Camera_Error;
            }

            #endregion

            #region Require Oyster Objects
            //OCL.Oyster oyster = new OCL.Oyster();
            OCL.Oyster oyster = new OCL.Oyster(frm.CurrentRecordOptions.DefaultOysterAddress,frm.CurrentRecordOptions.DefaultOysterConnectionPort);
            OCL.User me = oyster.GetUserById(m_me.ID);
            OCL.VideoStorageServer vss;// = (OCL.VideoStorageServer)oyster.GetUnassignedObject(OCL.OysterUnassignedObjects.VideoStorageServer);

            OCL.Scene sce;// = (OCL.Scene)oyster.GetUnassignedObject(OCL.OysterUnassignedObjects.Scene);
            OCL.Source src = null;// = (OCL.Source)oyster.GetUnassignedObject(OCL.OysterUnassignedObjects.Source);
            foreach (OCL.Source srcx in oyster.AllVisibleSources(me))
            {
                string shostname = System.Net.Dns.GetHostByAddress(System.Net.IPAddress.Parse(frm.CurrentRecordOptions.DefaultOysterDeviceAddress)).HostName;
                //strip off domain info
                if (shostname.IndexOf(".") != -1)
                {
                    shostname = shostname.Substring(0,shostname.IndexOf("."));
                }
                if (srcx.ControlAddress.ToLower() == shostname.ToLower() ||
                    srcx.ControlAddress.ToLower() == frm.CurrentRecordOptions.DefaultOysterDeviceAddress.ToLower())
                {
                    src = srcx;
                    break;
                }
            }
            if (src == null)
            {

                sErrorBody = "The data for the Oyster Device that was selected for this recording is not configured correctly. Contact the system administrator.";
                sErrorCaption = "Camera Recording Failure";
                //bRecordCamera = false;
                //bError = true;
                goto Label_Camera_Error;
            }
            sce = src.CurrentScene;
            vss = sce.AssignedVideoStorageServer;
            #endregion

            #region START RECORDING

            if (bRecordScreen)
            {
                if (bRecordCamera)
                {
                    bIsSession = true;
                }
                m_sScreenRecordingName = System.Guid.NewGuid().ToString();
                Application.DoEvents();
                System.Threading.Thread T = new System.Threading.Thread(new System.Threading.ThreadStart(StartScreenCapture));
                T.Start();
                //m_encoder.Execute(ScreenEncoder.Command.StartRecording,m_sScreenRecordingName);

            }

            if (bRecordCamera)
            {
                for (int i = 0; i < m_oec.GetLength(0); i++)
                {
                    m_sCameraRecordingName[i] = System.Guid.NewGuid().ToString();
                    m_oec[i].FilePath = vss.OysterRootDirectory;
                    if (m_oec[i].LastError.Length > 0)
                    {
                        sErrorBody = m_oec[i].LastError;
                        sErrorCaption = "Recording Startup Error...";
                        goto Label_Camera_Error;
                    }
                    m_oec[i].StartRecording(m_sCameraRecordingName[i]);
                    m_oec[i].OnConnectionError +=new OysterEncoderController.Control.OnConnectionErrorHandler(frmDisplay_OnConnectionError);

                }
            }
            #endregion

            if (bIsSession)
            {
                m_sRecordingSessionId = System.Guid.NewGuid().ToString();
            }
            else
                m_sRecordingSessionId = null;

            #region Create Database Entries

            bool bIsPresentation = false;
            if(bRecordScreen && bRecordCamera)
            {
                bIsPresentation = true;
            }
            int NumRecordings = NumCams;
            if(bRecordScreen)
                NumRecordings++;

            CurrentRecordingSession = me.CreateASession(DateTime.Now.ToString(),bIsPresentation);
            CurrentRecordings = new OCL.Recording[NumRecordings];
            int iRecIndex = 0;

            /// Create Camera Recording Entries
            if(bRecordCamera)
            {
                for (int i = 0; i < NumCams; i++)
                {
                    bool bIsPrimaryCamera;

                    if (i == System.Convert.ToInt32(frm.CurrentRecordOptions.CameraPrimary))
                        bIsPrimaryCamera = true;
                    else
                        bIsPrimaryCamera = false;

                    CurrentRecordings[iRecIndex] = CurrentRecordingSession.CreateRecording(m_sCameraRecordingName[i] + ".wmv",
                        "Camera " + (i+1),me,sce,src,false,bIsPrimaryCamera);
                    //CurrentRecordings[iRecIndex].UpdateFileSizeOnDisk();
                    //CurrentRecordings[iRecIndex].Update(TotalTime.ToString());
                    iRecIndex++;
                }
            }
            /// Create Desktop Recording Entry
            if(bRecordScreen)
            {

                string sRawFileName = m_sScreenRecordingName;
                string sRName = sRawFileName + ".wmv";

                string sFileLocation = frm.CurrentRecordOptions.WMVDirectory + @"\" + sRName;

                System.IO.FileInfo FID = new System.IO.FileInfo(sFileLocation);
                m_DesktopRecordingSize = FID.Length;
                CurrentRecordings[iRecIndex] = CurrentRecordingSession.CreateRecording(sRName,"Presentation",
                    me,sce,src,true,false);
                //CurrentRecordings[iRecIndex].Update(m_DesktopRecordingSize);
                //CurrentRecordings[iRecIndex].Update(TotalTime.ToString());
                DataRow R = null;
                string SourceFile = frm.CurrentRecordOptions.WMVDirectory + @"\" + sRName;
                try
                {
                    R = dsFileTransfer.Tables["File"].NewRow();
                    R["ObjectID"] = CurrentRecordings[iRecIndex].ID;
                    R["OysterObjectTypeID"]= 2; //Recording Type
                    R["RecordingSessionID"] = CurrentRecordings[iRecIndex].SessionID;
                    R["UserID"] = m_me.ID;
                    R["UserDescription"]= m_me.Description;
                    R["VideoStorageServerID"]= vss.ID;
                    R["OysterServerAddress"] = frm.CurrentRecordOptions.DefaultOysterAddress;
                    R["SourceFile"] = frm.CurrentRecordOptions.WMVDirectory + @"\" + sRName;
                    R["DestinationFileName"] = sRName;
                    R["DeleteAfterTransfer"] = true;
                    dsFileTransfer.Tables["File"].Rows.Add(R);
                    dsFileTransfer.Tables["File"].AcceptChanges();
                    dsFileTransfer.WriteXml(frm.CurrentRecordOptions.WMVDirectory + @"\" + sRawFileName + ".xml");
                }
                catch(Exception Err)
                {
                    MessageBox.Show(Err.Message,"Programmer Error during writing xml");
                }
            }
            #endregion

            clock.DigitalDisplayColor = SriClocks.DigitalColor.GreenColor;
            clock.ClockDisplayType = SriClocks.ClockType.StopWatch;
            clock.Reset();
            btnStartStop.Text = "STOP";
            btnStartStop.Enabled = true;
            clock.StartTimer();
            StartRecordingTime = DateTime.Now;
            m_bRecording = true;
            m_ScreenIsCaptured = bRecordScreen;
            m_CameraIsCaptured = bRecordCamera;
            this.TopMost = false;
            bDontClick = false;
            StatusWindow.Hide();
            StatusWindow.Dispose();
            return;

            Label_Camera_Error:
            {
                bDontClick = false;
                StatusWindow.Hide();
                StatusWindow.Dispose();
                System.Windows.Forms.MessageBox.Show(this,sErrorBody,
                    sErrorCaption,System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
                if(m_oec != null)
                {
                    for(int i=0; i< m_oec.Length;i++)
                    {
                        m_oec[i] = null;
                    }
                    m_oec = null;
                }
                Reset();
                m_CameraIsCaptured = false;
                m_ScreenIsCaptured = false;
                this.TopMost = true;
                return;
            }
            Label_Screen_Error:
            {
                bDontClick = false;
                StatusWindow.Hide();
                StatusWindow.Dispose();
                System.Windows.Forms.MessageBox.Show(this,sErrorBody,
                    sErrorCaption,System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
                if(m_oec != null)
                {
                    for(int i=0; i< m_oec.Length;i++)
                    {
                        m_oec[i].StopRecording();
                        m_oec[i].Close();
                        m_oec[i] = null;
                    }
                    m_oec = null;
                }
                m_CameraIsCaptured = false;
                m_ScreenIsCaptured = false;
                Reset();
                this.TopMost = true;
                return;
            }
        }