public void p2pCall(string peerInfo) { log.InfoFormat("p2pCall: {0}", peerInfo); Rest.ServerRest.P2PUserRest peerUser = JsonConvert.DeserializeObject <Rest.ServerRest.P2PUserRest>(peerInfo); if (null == peerUser) { log.InfoFormat("Failed to parse p2pCall data: {0}", peerInfo); return; } string userId = peerUser.userId.ToString(); if (string.IsNullOrEmpty(userId.Trim())) { log.Info("Failed P2P Call for empty userId"); return; } if (LoginManager.Instance.CurrentLoginStatus == LoginStatus.LoggedIn && !LoginManager.Instance.IsRegistered) { IMasterDisplayWindow ownerWindow = (MainWindow)System.Windows.Application.Current.MainWindow; MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("FAIL_TO_CALL_FOR_REGISTER_FAILURE"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } CallController.Instance.P2pCallPeer(userId, peerUser.imageUrl, peerUser.displayName); }
private void UploadPic_OnClick(object sender, MouseButtonEventArgs e) { Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog(); String Desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); //dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory + Desktop + "\\"; dialog.InitialDirectory = "C:\\"; dialog.Filter = "JPG|*.jpg"; if (dialog.ShowDialog() == true) { string fullFileName = dialog.FileName; filePath = dialog.FileName; string fileName = Utils.GetFileNameFromPath(fullFileName); long fileSize = Utils.GetFileSize(fullFileName); if (fileSize > 1 * 1024 * 1024) // larger than 1M { //MessageBox.Show(LanguageUtil.Instance.GetValueByKey("PIC_TOO_LARGE")); MessageBoxTip tip = new MessageBoxTip(_ownerWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("PIC_TOO_LARGE"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } //uploadTextBlock.Text = fullFileName; //uploadFileSize.Content = Utils.GetFileSize(fullFileName); //picPathStack.Visibility = Visibility.Visible; FilePathReal.Text = fullFileName; updateImg(fullFileName); finishPicGrid.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#f04848")); } }
public void ShowPromptTip(string prompt, string extraInfo) { IMasterDisplayWindow masterWindow = GetCurrentMainDisplayWindow(); if (null == masterWindow) { log.Info("Can not show error message for master window is null"); return; } CloseMessageBoxTip(); _messageBoxTip = new MessageBoxTip(); _messageTipExtraInfo = extraInfo; Window tipOwner = null; if ( null != (masterWindow as VideoPeopleWindow) && LayoutBackgroundWindow.Instance.IsLoaded && LayoutBackgroundWindow.Instance.LayoutOperationbarWindow.IsLoaded ) { tipOwner = LayoutBackgroundWindow.Instance.LayoutOperationbarWindow; } log.InfoFormat("ShowPromptTip(MessageBoxTip), hash: {0}, tipOwner is null:{1}, ", _messageBoxTip.GetHashCode(), null == tipOwner); DisplayUtil.SetWindowCenterAndOwner(_messageBoxTip, masterWindow, tipOwner); _messageBoxTip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), prompt, LanguageUtil.Instance.GetValueByKey("CONFIRM")); _messageBoxTip.ShowDialog(); _messageBoxTip = null; _messageTipExtraInfo = ""; }
public void Diagnostic(IMasterDisplayWindow msgOwner) { WaitingCollectLogView waitingview = new WaitingCollectLogView(); string appDataFolder = Utils.GetConfigDataPath(); LogFileCollector collector = new LogFileCollector(appDataFolder); Task.Run(() => { collector.Collect(); _isLogUploadSuccess = collector.UploadToOss(); CollectLogFinished(this, waitingview); }); waitingview.Owner = msgOwner.GetWindow(); waitingview.Topmost = true; waitingview.ShowDialog(); if (!_isLogUploadSuccess) { using (CommonOpenFileDialog dialog = new CommonOpenFileDialog()) { dialog.Title = LanguageUtil.Instance.GetValueByKey("CHOOSE_LOG_FILE_PATH"); dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); dialog.IsFolderPicker = true; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { try { collector.SaveAsTo(dialog.FileName); } catch (Exception ex) { log.ErrorFormat("Error:\n {0}", ex.Message); MessageBoxTip tip1 = new MessageBoxTip(msgOwner); tip1.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), string.Format("Error:\n {0}", ex.Message), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip1.ShowDialog(); return; } } else { // no save file, just exit. return; } } } MessageBoxTip tip2 = new MessageBoxTip(msgOwner); string msg = LanguageUtil.Instance.GetValueByKey("SAVE_LOG_FILE_SUCCESS"); if (_isLogUploadSuccess) { msg = LanguageUtil.Instance.GetValueByKey("UPLOAD_LOG_FILE_SUCCESS"); } tip2.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), msg, LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip2.ShowDialog(); }
public void CloseMessageBoxTip() { if (null != _messageBoxTip && _messageBoxTip.IsLoaded) { // only keep the last prompt message to show log.InfoFormat("Prompt message arrived, but previous message is still displayed, close it. Message -- {0}", _messageTipExtraInfo); _messageBoxTip.Close(); _messageBoxTip = null; } }
private void SaveDisplayName_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { string newName = displayNameTextBox.Text.Trim(); log.InfoFormat("Prepare to change display name to {0}", newName); if (string.IsNullOrEmpty(newName)) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("EMPTY_NAME"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } else { if (Regex.IsMatch(newName, Utils.INVALID_DISPLAY_NAME_REGEX)) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("UPDATE_USER_NAME"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } } if (newName.Length > 20) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , LanguageUtil.Instance.GetValueByKey("NAME_MAX_LENGTH") , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } Task.Run(() => { bool result = EVSdkManager.Instance.ChangeDisplayName(newName); if (result) { Application.Current.Dispatcher.InvokeAsync(() => { UpdateUserDisplayName(); this.displayNameReadOnlyPanel.Visibility = Visibility.Visible; this.displayNameEditPanel.Visibility = Visibility.Collapsed; }); } }) .ContinueWith((t) => { Application.Current.Dispatcher.InvokeAsync(() => { ProgressDialog.Instance.Hide(); }); }); ProgressDialog.Instance.ShowDialog(); }
private void ShowNotFoundNewVersion() { MessageBoxTip tip = new MessageBoxTip(((MainWindow)Application.Current.MainWindow).GetCurrentMainDisplayWindow()); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , LanguageUtil.Instance.GetValueByKey("NOT_FOUND_NEW_VERSION") , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); }
//private void SystemEvents_PowerModeChanged(object sender, Microsoft.Win32.PowerModeChangedEventArgs e) private void MonitorOnChanged(object sender, EventArgs e) { if (PowerManager.IsMonitorOn) { return; } // stop sending content. if ( CurrentCallStatus == CallStatus.Connected || CallStatus.ConfIncoming == CurrentCallStatus || CallStatus.P2pIncoming == CurrentCallStatus || CallStatus.P2pOutgoing == CurrentCallStatus ) { if (ContentStreamStatus.SendingContentStarted == CurrentContentStreamStatus || ContentStreamStatus.SendingWhiteBoardStarted == CurrentContentStreamStatus) { StopContent(); } log.Info("Terminate call for system power turned off monitor"); // terminate call, white board will be cleared automatically. if (CallStatus.ConfIncoming == CurrentCallStatus || CallStatus.P2pIncoming == CurrentCallStatus) { CurrentCallStatus = CallStatus.Idle; DeclineIncommingCall(CallInfo.conference_number); } else { TerminateCall(); } App.Current.Dispatcher.InvokeAsync(() => { MessageBoxTip tip; if ( LoginProgressEnum.EnterpriseJoinConf == LoginManager.Instance.LoginProgress || LoginProgressEnum.CloudJoinConf == LoginManager.Instance.LoginProgress ) { tip = new MessageBoxTip((IMasterDisplayWindow)LoginManager.Instance.LoginWindow); } else { tip = new MessageBoxTip((MainWindow)App.Current.MainWindow); } string errPrompt = LanguageUtil.Instance.GetValueByKey("MONITOR_OFF_CALL_HANGUP"); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), errPrompt, LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); }); } }
private void EVSdkWrapper_EventError(ManagedEVSdk.Structs.EVErrorCli err) { log.Info("EventError"); if (EVSdkManager.ACTION_UPLOADUSERIMAGE == err.action) { Application.Current.Dispatcher.InvokeAsync(() => { ProgressDialog.Instance.Hide(); MessageBoxTip tip = new MessageBoxTip(_ownerWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("UPLOAD_PIC_FAILURE"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); }); } log.Info("EventError end"); }
private void ConfirmBtn_Click(object sender, RoutedEventArgs e) { string szNameDisplayedInConf = this.textBoxDisplayName.Text.Trim(); if (string.IsNullOrEmpty(szNameDisplayedInConf)) { this.textBoxDisplayName.Tag = LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF"); } Window window = Window.GetWindow(this); IMasterDisplayWindow ownerWindow = window as IMasterDisplayWindow; if (null == ownerWindow) { ownerWindow = (MainWindow)Application.Current.MainWindow; } if (szNameDisplayedInConf.Length > Utils.DISPLAY_NAME_MAX_LENGTH) { log.InfoFormat("The length of name exceeds {0}.", Utils.DISPLAY_NAME_MAX_LENGTH); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , string.Format(LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF_MAX_LENGTH"), Utils.DISPLAY_NAME_MAX_LENGTH) , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } if (Regex.IsMatch(szNameDisplayedInConf, Utils.INVALID_DISPLAY_NAME_REGEX)) { log.Info("Invalid char in name."); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF_INCORRECT_PROMPT") , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } ConfirmEvent?.Invoke(szNameDisplayedInConf); }
void ShowUnhandledException(DispatcherUnhandledExceptionEventArgs e) { string procName = Process.GetCurrentProcess().ProcessName; using (PerformanceCounter pc = new PerformanceCounter("Process", "Private Bytes", procName)) { log.InfoFormat("Current memory used: {0}", pc.NextValue()); } log.Error("App ShowUnhandledException: " + e.Exception); e.Handled = true; string errorMessage = string.Format("An application error occurred.\n\nError: {0}", e.Exception.Message + (e.Exception.InnerException != null ? "\n" + e.Exception.InnerException.Message : null)); try { MessageBoxTip tip; MainWindow mainWindow = Current.MainWindow as MainWindow; if (null == mainWindow) { tip = new MessageBoxTip(null); } else { tip = new MessageBoxTip(mainWindow.GetCurrentMainDisplayWindow()); } tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), errorMessage, LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); } catch (Exception ex) { log.Error("Failed to ShowUnhandledException, detail: " + ex); } CefSharpUtil.ShutdownCefSharp(); View.LayoutBackgroundWindow.Instance.Dispose(); Application.Current.Shutdown(); }
protected void JoinConference(string conferenceNumber, string displayName, string password, IMasterDisplayWindow ownerWindow) { if (string.IsNullOrEmpty(conferenceNumber.Trim())) { return; } if (LoginManager.Instance.CurrentLoginStatus == LoginStatus.LoggedIn && !LoginManager.Instance.IsRegistered) { if (null == ownerWindow) { ownerWindow = (MainWindow)System.Windows.Application.Current.MainWindow; } MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("FAIL_TO_CALL_FOR_REGISTER_FAILURE"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } CallController.Instance.JoinConference(conferenceNumber, displayName, password); }
private void EVSdkWrapper_EventUploadUserImageComplete(string path) { log.Info("EventUploadUserImageComplete"); Application.Current.Dispatcher.InvokeAsync(() => { ProgressDialog.Instance.Hide(); this.DialogResult = true; this.Close(); MessageBoxTip tip = new MessageBoxTip(_ownerWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("UPLOAD_PIC_SUCCESS"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); try { File.Delete(path); } catch (Exception ex) { log.InfoFormat("Failed to local avatar for upload: {0}, exception: {1}", path, ex); } }); log.Info("EventUploadUserImageComplete end"); }
public bool Collect() { try { log.Info("Collect"); ClearTheFolder(); log.Info("Finished log clean"); CollectSystemInfoEx(); log.Info("Finished get System info"); PackageCachedFolderIntoZip(); log.Info("Finished package log"); } catch (Exception ex) { //MessageBox.Show(string.Format("Error:\n {0}", ex.Message), "Error"); Application.Current.Dispatcher.InvokeAsync(() => { IMasterDisplayWindow masterWin; if (LoginStatus.LoginFailed == LoginManager.Instance.CurrentLoginStatus || LoginStatus.NotLogin == LoginManager.Instance.CurrentLoginStatus) { masterWin = (IMasterDisplayWindow)LoginManager.Instance.LoginWindow; } else { masterWin = (MainWindow)Application.Current.MainWindow; } MessageBoxTip tip = new MessageBoxTip(masterWin); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), string.Format("Error:\n {0}", ex.Message), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); //if (!EventLog.SourceExists("HexMeetLogCollect")) // EventLog.CreateEventSource("HexMeetLogCollect", "Application"); //EventLog.WriteEntry("HexMeetLogCollect -- Collect", ex.ToString(), EventLogEntryType.Error); }); return(false); } return(true); }
private void Ok_Click(object sender, RoutedEventArgs e) { bool valid = true; string szPort = this.textBoxPort.Text.Trim(); if (string.IsNullOrEmpty(szPort)) { szPort = this.checkBoxUseHttps.IsChecked.HasValue && this.checkBoxUseHttps.IsChecked.Value ? "443" : "80"; } int nPort; if (!int.TryParse(szPort, out nPort)) { valid = false; } else { if (nPort < 1 || nPort > 65535) { valid = false; } } if (!valid) { MessageBoxTip tip = new MessageBoxTip((IMasterDisplayWindow)LoginManager.Instance.LoginWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("VALID_PORT_VALUE_PROMPT"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } Utils.SetServerPort(nPort); Utils.SetUseHttps(this.checkBoxUseHttps.IsChecked.Value); LoginManager.Instance.LoginProgress = LoginManager.Instance.PreviousLoginProgress; }
// delete the useless file in the folder private void ClearTheFolder() { string[] files = Directory.GetFiles(this._appdatafolder, "*Logs*.zip", SearchOption.TopDirectoryOnly); if (files != null) { foreach (string f in files) { try { File.Delete(f); } catch (Exception ex) { //MessageBox.Show(string.Format("Error:\n {0}", ex.Message), "Error"); MessageBoxTip tip = new MessageBoxTip((MainWindow)System.Windows.Application.Current.MainWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), string.Format("Error:\n {0}", ex.Message), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); //if (!EventLog.SourceExists("HexMeetLogCollect")) // EventLog.CreateEventSource("HexMeetLogCollect", "Application"); //EventLog.WriteEntry("HexMeetLogCollect -- ClearFolder", ex.ToString(), EventLogEntryType.Error); //ignore the exception } } } // remove the redundant log files for there is only 2 usefull files for the log files = Directory.GetFiles(this._appdatafolder, LOG_FILE_SEARCH_PATTERN, SearchOption.TopDirectoryOnly); if (null != files) { foreach (string file in files) { Match mat = Regex.Match(file, USELESS_LOG_FILE_REGEX); if (!mat.Success) { continue; } try { File.Delete(file); } catch (Exception e) { log.InfoFormat("Failed to delete log file: {0}, exception: {1}", file, e); } } } // remove the redundant dump files that only the newest dump file for 73 hours is usefull files = Directory.GetFiles(this._appdatafolder, DUMP_FILE_SEARCH_PATTERN, SearchOption.TopDirectoryOnly); if (null != files) { foreach (string file in files) { FileInfo fi = new FileInfo(file); long nowTicks = DateTime.Now.Ticks; double timePast = new TimeSpan(nowTicks - fi.CreationTime.Ticks).TotalMilliseconds; if (timePast < 72 * 60 * 60 * 1000) { continue; } try { File.Delete(file); } catch (Exception e) { log.InfoFormat("Failed to delete dump file: {0}, exception: {1}", file, e); } } } }
private void ConfirmBtn_Click(object sender, RoutedEventArgs e) { string oldPwd = this.oldPasswordBox.Password.Trim(); string newPwd1 = this.newPassowrdBox.Password.Trim(); string newPwd2 = this.confirmPassowrdBox.Password.Trim(); if (oldPwd == "" || oldPwd.Length < 4 || oldPwd.Length > 16) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("CHECK_INPUT_OLD_PASSWORD"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } if (newPwd1 == "" || newPwd1.Length < 4 || newPwd1.Length > 16) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("CHECK_INPUT_NEW_PASSWORD"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } if (newPwd2 == "" || newPwd2.Length < 4 || newPwd2.Length > 16) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("CHECK_INPUT_CONFIRM_PASSWORD"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } if (newPwd1 != newPwd2) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("NEW_PASSWORD_DIFFERENT"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } if (oldPwd == newPwd2) { MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("THE_SAME_NEW_AND_OLD_PASSWORD"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } Task.Run(() => { bool result = EVSdkManager.Instance.ChangePassword(oldPwd, newPwd1); if (result) { Application.Current.Dispatcher.InvokeAsync(() => { log.Info("Succeed to change password."); Utils.SetPassword(LoginManager.Instance.ServiceType, newPwd1); LoginManager.Instance.LoginPassword = newPwd1; MessageBoxTip tip = new MessageBoxTip(this); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("CHANGE_PASSWORD_SUCCESS"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); ClearPasswordContent(); CloseBtn_Click(null, null); }); } else { log.Info("Failed to change password."); } }) .ContinueWith((t) => { Application.Current.Dispatcher.InvokeAsync(() => { ProgressDialog.Instance.Hide(); }); }); ProgressDialog.Instance.ShowDialog(); }
private void Join_Click(object sender, RoutedEventArgs e) { log.Info("Join conference click"); bool valid = true; string szServerAddress; if (LoginProgressEnum.EnterpriseJoinConf == LoginManager.Instance.LoginProgress) { szServerAddress = this.textBoxServerAddress.Text.Trim(); if (string.IsNullOrEmpty(szServerAddress)) { this.textBoxServerAddress.Tag = LanguageUtil.Instance.GetValueByKey("SERVER"); valid = false; } } else { szServerAddress = Utils.CloudServerDomain; } string szConfId = this.comboBoxConfId.Text.Trim(); if (string.IsNullOrEmpty(szConfId)) { valid = false; } string szNameDisplayedInConf = this.textBoxNameDisplayedInConf.Text.Trim(); if (string.IsNullOrEmpty(szNameDisplayedInConf)) { this.textBoxNameDisplayedInConf.Tag = LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF"); } if (!valid) { log.Info("Null value."); return; } Window window = Window.GetWindow(this); IMasterDisplayWindow ownerWindow = window as IMasterDisplayWindow; if (null == ownerWindow) { ownerWindow = (MainWindow)Application.Current.MainWindow; } if (!Regex.IsMatch(szConfId, VALID_CONF_ID)) { log.Info("Invalid conf id."); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , LanguageUtil.Instance.GetValueByKey("INVALID_CONFERENCE_ID") , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } if (szNameDisplayedInConf.Length > Utils.DISPLAY_NAME_MAX_LENGTH) { log.InfoFormat("The lenght of name exceeds {0}.", Utils.DISPLAY_NAME_MAX_LENGTH); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , string.Format(LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF_MAX_LENGTH"), Utils.DISPLAY_NAME_MAX_LENGTH) , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } if (Regex.IsMatch(szNameDisplayedInConf, Utils.INVALID_DISPLAY_NAME_REGEX)) { log.Info("Invalid char in name."); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF_INCORRECT_PROMPT") , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } log.Info("Correct value and go ahead."); Utils.SetDisplayNameInConf(szNameDisplayedInConf); bool enableCamera = null == this.turnOffCamera.IsChecked || !this.turnOffCamera.IsChecked.Value; bool enableMicrophone = null == this.turnOffMicrophone.IsChecked || !this.turnOffMicrophone.IsChecked.Value; Utils.SetDisableCameraOnJoinConf(!enableCamera); Utils.SetDisableMicOnJoinConf(!enableMicrophone); // join the conference if (LoginStatus.LoggedIn == LoginManager.Instance.CurrentLoginStatus) { EVSdkManager.Instance.EnableCamera(enableCamera); EVSdkManager.Instance.EnableMic(enableMicrophone); if (string.IsNullOrEmpty(szNameDisplayedInConf)) { szNameDisplayedInConf = LoginManager.Instance.DisplayName; } log.Info("Join conf -- start video call."); this._viewModel.StartJoinConference(szConfId, szNameDisplayedInConf, _confPassword, ownerWindow); } else if (LoginStatus.NotLogin == LoginManager.Instance.CurrentLoginStatus || LoginStatus.LoginFailed == LoginManager.Instance.CurrentLoginStatus) { log.Info("Join conf -- anonymous."); LoginManager.Instance.AnonymousJoinConference( false , LoginManager.Instance.EnableSecure , szServerAddress , LoginManager.Instance.ServerPort , szConfId , "" , enableCamera , enableMicrophone ); } }
private void Join_Click(object sender, RoutedEventArgs e) { string szNameDisplayedInConf = this.textBoxDisplayName.Text.Trim(); if (string.IsNullOrEmpty(szNameDisplayedInConf)) { this.textBoxDisplayName.Tag = LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF"); } Window window = Window.GetWindow(this); IMasterDisplayWindow ownerWindow = window as IMasterDisplayWindow; if (null == ownerWindow) { ownerWindow = (MainWindow)Application.Current.MainWindow; } if (szNameDisplayedInConf.Length > Utils.DISPLAY_NAME_MAX_LENGTH) { log.InfoFormat("The lenght of name exceeds {0}.", Utils.DISPLAY_NAME_MAX_LENGTH); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , string.Format(LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF_MAX_LENGTH"), Utils.DISPLAY_NAME_MAX_LENGTH) , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } if (Regex.IsMatch(szNameDisplayedInConf, Utils.INVALID_DISPLAY_NAME_REGEX)) { log.Info("Invalid char in name."); MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg( LanguageUtil.Instance.GetValueByKey("PROMPT") , LanguageUtil.Instance.GetValueByKey("NAME_DISPLAYED_IN_CONF_INCORRECT_PROMPT") , LanguageUtil.Instance.GetValueByKey("CONFIRM") ); tip.ShowDialog(); return; } Utils.SetDisplayNameInConf(szNameDisplayedInConf); bool enableCamera = null == this.turnOffCamera.IsChecked || !this.turnOffCamera.IsChecked.Value; bool enableMicrophone = null == this.turnOffMicrophone.IsChecked || !this.turnOffMicrophone.IsChecked.Value; Utils.SetDisableCameraOnJoinConf(!enableCamera); Utils.SetDisableMicOnJoinConf(!enableMicrophone); Application.Current.Dispatcher.InvokeAsync(() => { LoginManager.Instance.AnonymousJoinConference( _isJoinDirectly , ("https" == _joinConfProtocol.ToLower()) , _joinConfAddress , (uint)_joinConfPort , _joinConfId , _joinConfPassword , enableCamera , enableMicrophone ); }); ClearJoinConfData(); }