public Main() { InitializeComponent(); FormClosing += Main_FormClosing; line1Record = new TelRecordClass(); line2Record = new TelRecordClass(); }
private void OnIncommingCall(object sender, TapiEventArgs args) { MethodInvoker m = new MethodInvoker(() => { if (objLine1 != null) { if (args.Line.Name == objLine1.Name) { line1Record = new TelRecordClass(); RINGCOUNTER1 = 1; label1.BackColor = Color.Red; label1.Text = $"RINGING {RINGCOUNTER1}"; timer1.Start(); line1Record.answered = false; line1Record.CallbeginTime = DateTime.Now; line1Record.telNumber = args.Call.CallerID; AddToLog($"{Environment.NewLine} INCOMMING CALL {objLine1} {args.Call.CallerID}"); } } if (objLine2 != null) { if (args.Line.Name == objLine2.Name) { line2Record = new TelRecordClass(); RINGCOUNTER2 = 1; label2.BackColor = Color.Red; label2.Text = $"RINGING {RINGCOUNTER2}"; timer2.Start(); line2Record.answered = false; line2Record.CallbeginTime = DateTime.Now; line1Record.telNumber = args.Call.CallerID; AddToLog($"{Environment.NewLine} INCOMMING CALL {objLine2} {args.Call.CallerID}"); } } }); this.Invoke(m); }