private void cmbCamera_SelectionChanged(object sender, SelectionChangedEventArgs e) { StopAudioCapture(); StopVideoCapture(); CloseAllVideoWindow(); Destroy(); StringBuilder strID = new StringBuilder(Login._UserInfo.Id); StringBuilder strServerIP = new StringBuilder(Login._ServerServiceUri); int nResult = Init(strID, strServerIP); if (nResult == 0) { IntPtr result = GetLastErrorString(); string strError = Marshal.PtrToStringAnsi(result); ErrorCollection.GetInstance().SetErrorInfo(strError); } this.cameraView.BackgroundImage = ChatClient.Properties.Resources.videowindow; this.cameraView.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; int index = 0; if (cmbCamera.SelectedIndex >= 0) { index = cmbCamera.SelectedIndex; } nResult = StartVideoCapture(index); if (nResult == 0) { IntPtr result = GetLastErrorString(); string strError = Marshal.PtrToStringAnsi(result); ErrorCollection.GetInstance().SetErrorInfo(strError); } SetCaptureWindow(cameraView.Handle); //if (this.cameraConnector1.Connected) // this.cameraConnector1.Disconnect(); //this.cameraConnector1.BeginConnect(Login._UserInfo.Id); }
public WebCamSetting() { InitializeComponent(); CloseAllVideoWindow(); Destroy(); StringBuilder strID = new StringBuilder(Login._UserInfo.Id); StringBuilder strServerIP = new StringBuilder(Login._ServerServiceUri); int nResult = Init(strID, strServerIP); if (nResult == 0) { IntPtr result = GetLastErrorString(); string strError = Marshal.PtrToStringAnsi(result); ErrorCollection.GetInstance().SetErrorInfo(strError); } }