private void MainForm_Load(object sender, EventArgs e) { try { // Try to create Loudtalks Mesh control instance // We demonstrate how to create control dynamically here // This way we can easily handle situation when Loudtalks Mesh ActiveX control is not registered in system // Alternative is to add the control to form in design mode axMesh = new AxPttLib.AxPtt(); axMesh.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right); axMesh.TabIndex = textPassword.TabIndex + 1; axMesh.TabStop = false; Controls.Add(axMesh); } catch (System.Runtime.InteropServices.COMException) { axMesh = null; } catch (Exception) { axMesh = null; } bExitOnSignout = false; if (axMesh != null) { // Wire Loudtalks Mesh control events axMesh.SignInStarted += new EventHandler(axMesh_SignInStarted); axMesh.SignInSucceeded += new EventHandler(axMesh_SignInSucceeded); axMesh.SignInFailed += new AxPttLib.IPttEvents_SignInFailedEventHandler(axMesh_SignInFailed); axMesh.SignInRequested += new EventHandler(axMesh_SignInRequested); axMesh.SignOutStarted += new EventHandler(axMesh_SignOutStarted); axMesh.SignOutComplete += new EventHandler(axMesh_SignOutComplete); axMesh.GetCanSignIn += new AxPttLib.IPttEvents_GetCanSignInEventHandler(axMesh_GetCanSignIn); axMesh.MessageInBegin += new AxPttLib.IPttEvents_MessageInBeginEventHandler(axMesh_MessageInBegin); axMesh.MessageInEnd += new AxPttLib.IPttEvents_MessageInEndEventHandler(axMesh_MessageInEnd); axMesh.MessageOutBegin += new AxPttLib.IPttEvents_MessageOutBeginEventHandler(axMesh_MessageOutBegin); axMesh.MessageOutEnd += new AxPttLib.IPttEvents_MessageOutEndEventHandler(axMesh_MessageOutEnd); axMesh.MessageOutError += new AxPttLib.IPttEvents_MessageOutErrorEventHandler(axMesh_MessageOutError); axMesh.AudioMessageInStart += new AxPttLib.IPttEvents_AudioMessageInStartEventHandler(axMesh_AudioMessageInStart); axMesh.AudioMessageInStop += new AxPttLib.IPttEvents_AudioMessageInStopEventHandler(axMesh_AudioMessageInStop); axMesh.PlayerAudioMessageStart += new AxPttLib.IPttEvents_PlayerAudioMessageStartEventHandler(axMesh_PlayerAudioMessageStart); axMesh.PlayerAudioMessageStop += new AxPttLib.IPttEvents_PlayerAudioMessageStopEventHandler(axMesh_PlayerAudioMessageStop); axMesh.PlayerAudioMessageProgress += new AxPttLib.IPttEvents_PlayerAudioMessageProgressEventHandler(axMesh_PlayerAudioMessageProgress); // Configure Loudtalks Mesh network parameters axMesh.Network.NetworkName = "default"; axMesh.Network.LoginServer = "default.loudtalks.net"; axMesh.Network.WebServer = "http://default.zellowork.com"; PttLib.INetwork2 ntw2 = axMesh.Network as PttLib.INetwork2; if (ntw2 != null) { ntw2.EnableTls("tls.zellowork.com"); } // Customize using embedded oem.config byte[] OemConfig = Resource.oem_config; axMesh.Customization.set_OemConfigData(ref OemConfig); // Update UI UpdateCompactState(); UpdateMenuState(); UpdateControlsState(); } else { // Loudtalks Mesh control is unavailable // Hide all controls foreach (MenuItem Item in menu.MenuItems) { Item.Enabled = false; } foreach (Control Ctrl in Controls) { Ctrl.Visible = false; } // Disable menu commands exitToolStripMenuItem.Enabled = true; helpWebToolStripMenuItem.Enabled = true; // Show error description labelError.Top = 0; labelError.Visible = true; } }
private void MainForm_Load(object sender, EventArgs e) { cbSendAudioFile.ItemCheck += new ItemCheckEventHandler(cbSendAudioFile_ItemCheck); cbForwardAudio.ItemCheck += new ItemCheckEventHandler(cbForwardAudio_ItemCheck); tbSendWavPath.Enter += new EventHandler(tbSendWavPath_Enter); tbSendWavPath.Leave += new EventHandler(tbSendWavPath_Leave); tbSendWavPath.Text = "Select *.wav file"; tbSendWavPath.ForeColor = Color.Gray; tbSaveMessagesPath.Enter += new EventHandler(tbSaveMessagesPath_Enter); tbSaveMessagesPath.Leave += new EventHandler(tbSaveMessagesPath_Leave); tbSaveMessagesPath.Text = "Select folder to save wav files"; tbSaveMessagesPath.ForeColor = Color.Gray; try { // Try to create Loudtalks Mesh control instance // We demonstrate how to create control dynamically here // This way we can easily handle situation when Loudtalks Mesh ActiveX control is not registered in system // Alternative is to add the control to form in design mode axMesh = new AxPtt(); axMesh.BeginInit(); //axMesh.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | // System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right); axMesh.TabIndex = textPassword.TabIndex + 1; axMesh.TabStop = false; //Controls.Add(axMesh); axMesh.Dock = DockStyle.Fill; split.Panel1.Controls.Add(axMesh); axMesh.EndInit(); axMesh.Dock = DockStyle.None; Invalidate(true); axMesh.Dock = DockStyle.Fill; axMesh.Visible = false; } catch (System.Runtime.InteropServices.COMException) { axMesh = null; } catch (Exception) { axMesh = null; } bExitOnSignout = false; if (axMesh != null) { // Wire Loudtalks Mesh control events axMesh.SignInStarted += new EventHandler(axMesh_SignInStarted); axMesh.SignInSucceeded += new EventHandler(axMesh_SignInSucceeded); axMesh.SignInFailed += new IPttEvents_SignInFailedEventHandler(axMesh_SignInFailed); axMesh.SignInRequested += new EventHandler(axMesh_SignInRequested); axMesh.SignOutStarted += new EventHandler(axMesh_SignOutStarted); axMesh.SignOutComplete += new EventHandler(axMesh_SignOutComplete); axMesh.GetCanSignIn += new IPttEvents_GetCanSignInEventHandler(axMesh_GetCanSignIn); axMesh.MessageInBegin += new IPttEvents_MessageInBeginEventHandler(axMesh_MessageInBegin); axMesh.MessageInEnd += new IPttEvents_MessageInEndEventHandler(axMesh_MessageInEnd); axMesh.MessageOutBegin += new IPttEvents_MessageOutBeginEventHandler(axMesh_MessageOutBegin); axMesh.MessageOutEnd += new IPttEvents_MessageOutEndEventHandler(axMesh_MessageOutEnd); axMesh.MessageOutError += new IPttEvents_MessageOutErrorEventHandler(axMesh_MessageOutError); axMesh.AudioMessageInStart += new IPttEvents_AudioMessageInStartEventHandler(axMesh_AudioMessageInStart); axMesh.AudioMessageInStop += new IPttEvents_AudioMessageInStopEventHandler(axMesh_AudioMessageInStop); axMesh.PlayerAudioMessageStart += new IPttEvents_PlayerAudioMessageStartEventHandler(axMesh_PlayerAudioMessageStart); axMesh.PlayerAudioMessageStop += new IPttEvents_PlayerAudioMessageStopEventHandler(axMesh_PlayerAudioMessageStop); axMesh.PlayerAudioMessageProgress += new IPttEvents_PlayerAudioMessageProgressEventHandler(axMesh_PlayerAudioMessageProgress); axMesh.ContactListChanged += new EventHandler(axMesh_ContactListChanged); // Configure Loudtalks Mesh network parameters axMesh.Network.NetworkName = "default"; axMesh.Network.LoginServer = "default.loudtalks.net"; axMesh.Network.WebServer = "http://default.zellowork.com"; PttLib.INetwork2 ntw2 = axMesh.Network as PttLib.INetwork2; if (ntw2 != null) { ntw2.EnableTls("tls.zellowork.com"); } // Customize using embedded oem.config System.Array OemConfig = Resource.oem_config; axMesh.Customization.set_OemConfigData(ref OemConfig); // Install tray icon axMesh.Settings.ShowTrayIcon = true; // Update UI UpdateCompactState(); UpdateMenuState(); UpdateControlsState(); tmUpdateOnlineContacts.Interval = 5000; tmUpdateOnlineContacts.Tick += new EventHandler(tmUpdateOnlineContacts_Tick); } else { // Loudtalks Mesh control is unavailable // Hide all controls foreach (ToolStripMenuItem Item in menu.Items) { foreach (ToolStripItem SubItem in Item.DropDownItems) { SubItem.Enabled = false; } } foreach (Control Ctrl in Controls) { Ctrl.Visible = false; } menu.Show(); // Disable menu commands exitToolStripMenuItem.Enabled = true; helpWebToolStripMenuItem.Enabled = true; // Show error description labelError.Top = menu.Location.Y + menu.Size.Height + 10; labelError.Visible = true; } }