示例#1
0
 private void processCallAlert(CallAlert alert)
 {
     if (alert != null)
     {
         //if (alert.Action == alert.Incoming )
         if (alert.Action == alert.Initiated ||
             alert.Action == alert.Connected ||
             alert.Action == alert.Waiting ||
             alert.Action == alert.Answered)
         {
             if (m_callStatusDlg == null)
             {
                 m_callStatusDlg = new CallStatusDlg();
                 m_callStatusDlg.Show();
                 m_callStatusDlg.CallStatusDlgClosedEvent += new CallStatusDlgClosedEventHandler(m_callStatusDlg_CallStatusDlgClosedEvent);
             }
             m_callStatusDlg.displayAlert(alert);
         }
         else if (alert.Action == alert.Disconnected)
         {
             if (m_callStatusDlg != null)
             {
                 m_callStatusDlg.Close();
                 m_callStatusDlg = null;
             }
         }
     }
 }
        public void displayAlert(CallAlert alert)
        {
            try
            {
                if (alert != null)
                {
                    alert.ImageFile         = Contacts.Instance.getImageFile(alert.PhoneNumber, null);
                    alert.XSLFile           = "callStatus.xslt";
                    webBrowser.DocumentText = alert.HTML;

                    this.Visible = true;
                    this.TopMost = true;
                    this.BringToFront();
                    //this.TopMost = false;
                }
            }
            catch (Exception)
            {
            }
        }
        static public AlertBase CreateAlert(string data)
        {
            AlertBase retVal = null;

            try
            {
                AlertBase       msg  = new AlertBase(data);
                DisplayItemType type = msg.ItemType;
                switch (type)
                {
                case DisplayItemType.UNKNOWN:
                {
                    break;
                }

                case DisplayItemType.STATUS:
                {
                    retVal = new StatusAlert(data);
                    break;
                }

                case DisplayItemType.CONNECT:
                {
                    retVal = new ConnectAlert(data);
                    break;
                }

                case DisplayItemType.EMAIL:
                {
                    retVal = new EmailAlert(data);
                    break;
                }

                case DisplayItemType.CALL:
                {
                    retVal = new CallAlert(data);
                    break;
                }

                case DisplayItemType.LOCK:
                {
                    retVal = new LockAlert(data);
                    break;
                }

                case DisplayItemType.SMS:
                {
                    retVal = new SMSAlert(data);
                    break;
                }

                case DisplayItemType.SCREEN:
                {
                    retVal = new ScreenCaptureAlert(data);
                    break;
                }

                case DisplayItemType.CONTACTS:
                {
                    retVal = new ContactAlert(data);
                    break;
                }

                case DisplayItemType.CLIPBOARD:
                {
                    retVal = new ClipboardAlert(data);
                    break;
                }

                case DisplayItemType.DISCONNECT:
                {
                    retVal = new DisconnectAlert(data);
                    break;
                }

                case DisplayItemType.LEVEL:
                {
                    retVal = new LevelAlert(data);
                    break;
                }

                case DisplayItemType.MACRO:
                {
                    retVal = new MacroAlert(data);
                    break;
                }

                case DisplayItemType.PIN_MSG:
                {
                    retVal = new PINMsgAlert(data);
                    break;
                }

                case DisplayItemType.INPUT_MSG:
                {
                    retVal = new InputAlert(data);
                    break;
                }

                case DisplayItemType.READFILE:
                {
                    retVal = new ReadFileAlert(data);
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("process Message Error:" + Environment.NewLine + ex.ToString());
                retVal = null;
            }
            return(retVal);
        }