private void Main_FormClosing(object sender, FormClosingEventArgs e) { try { TapiApp.Shutdown(); } catch (Exception) { } }
public async Task Init() { FlashLabel(); ConfigCabbyTechOffice fig = ConfigUI.GetCabbyTechConfig(); System.Data.SqlClient.SqlConnectionStringBuilder connBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder { InitialCatalog = "TAXIDB", UserID = "sa", Password = fig.DbPassword, DataSource = fig.DatabaseComputerName + "\\" + fig.DatabaseInstanceName, ConnectTimeout = 8 }; udpBroadCastPort = fig.UDPTelephonePort; connStr = connBuilder.ConnectionString; try { await Task.Run(() => { TapiApp.SerialNumber = "7N8E3MN-XNVCPC8-XAVADBE-44PEM"; TapiApp.Initialize("CallerID"); }); InitDone = true; TapiApp.TapiError += OnTapiError; TapiApp.LineAdded += OnLineAdded; TapiApp.LineClosed += OnLineClosed; TapiApp.LineRemoved += OnLineRemoved; TapiApp.IncomingCall += OnIncommingCall; TapiApp.OutgoingCall += OnOutgoingCall; TapiApp.CallConnected += OnCallConnected; TapiApp.CallDisconnected += OnCallDisconnected; UpdateLinesCombobox1(); UpdateLinesCombobox2(); } catch (TapiException ex) { MessageBox.Show(ex.Message, "TapiException!", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { try { TapiApp.Shutdown(); } catch (TapiException exc) { MessageBox.Show(exc.Message, "TapiException!", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exc) { MessageBox.Show(exc.Message, "Exception!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Form1_Load(object sender, EventArgs e) { try { TapiApp.Initialize("تماسهای گرفته شده"); TapiApp.TapiError += OnTapiError; TapiApp.LineAdded += OnLineAdded; TapiApp.LineClosed += OnLineClosed; TapiApp.LineRemoved += OnLineRemoved; TapiApp.CallDisconnected += OnCallDisconnected; UpdateLinesCombobox(); if (_agentPhone != null) { txtPhone1.Text = _agentPhone; } if (_customerPhone != null) { txtPhone2.Text = _customerPhone; } if (_internalAgentPhone != null) { comboBoxLine.SelectedItem = TapiApp.Lines.SingleOrDefault(q => q.Name.Contains(_internalAgentPhone)); } } catch (TapiException exc) { MessageBox.Show(exc.Message, "TapiException!", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } catch (Exception exc) { MessageBox.Show(exc.Message, "Exception!", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } }