private SimpleButton getButton(TelNumber tel) { SimpleButton btn = new SimpleButton(); btn.Appearance.BackColor = System.Drawing.Color.Gray; btn.Appearance.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); btn.Appearance.ForeColor = System.Drawing.Color.White; btn.Appearance.Options.UseBackColor = true; btn.Appearance.Options.UseFont = true; btn.Appearance.Options.UseForeColor = true; btn.Appearance.Options.UseTextOptions = true; btn.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; btn.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat; btn.Location = new System.Drawing.Point(20, 45 + count * 50); btn.Size = new System.Drawing.Size(160, 40); btn.Tag = tel.Number; btn.Text = tel.FormatedString.Replace(" ", "\r\n "); btn.Click += btn_Click; count++; return(btn); }
private void OnNewCall(int sessionId) { try { timerEndCall.Stop(); IStateMachine call = CallManager.getCall(sessionId); string number = Globals.NormalizeTelNumber(call.CallingNumber); if (sesje.ContainsKey(sessionId)) { sesje.Remove(sessionId); } sesje.Add(sessionId, new CallInfo(number, call.Incoming, sessionId)); if (Globals.FindByNumber(number) != null) { Contact con = Globals.FindByNumber(number); lACFullName.Text = con.Fullname; TelNumber tn = con.getTelByNumber(number); lACNumber.Text = tn.Number; lACTelType.Text = tn.TypeString + ":"; picAvatar.EditValue = con.Photo; } else { if (call.CallingNumber == "") { lACFullName.Text = "Nieznany"; } else { lACFullName.Text = number; } lACNumber.Text = ""; lACTelType.Text = ""; picAvatar.EditValue = Resources.phone_256; } if (call.Incoming) { CallSmall callSmall = new CallSmall(lACFullName.Text, lACNumber.Text); callSmall.Show(this); tlpACButtons.SetColumnSpan(btnEndCall, 2); tlpACButtons.SetColumn(btnEndCall, 2); btnAnswerCall.Visible = btnEndCall.Visible = btnTransferCall.Visible = true; btnAnswerCall.Enabled = true; } else { btnAnswerCall.Visible = false; tlpACButtons.SetColumn(btnEndCall, 0); tlpACButtons.SetColumnSpan(btnEndCall, 4); btnEndCall.Visible = true; btnTransferCall.Visible = true; } btnAnswerCall.Visible = call.Incoming; btnEndCall.Visible = true; btnTransferCall.Visible = true; lCallStatus.Text = call.Incoming ? "Przychodzące" : "Łączenie"; lTime.Text = "00:00"; lTime.Visible = false; lCallStatus.BackColor = Color.Green; lTime.BackColor = Color.Green; tabActiveCall.PageVisible = true; tabControll.SelectedTabPage = tabActiveCall; Send("NEWCALL:" + number + ";" + call.Incoming.ToString() + ";" + DateTime.Now.ToString() + ";" + TimeSpan.Zero.ToString()); dtmf = ""; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }