Пример #1
0
        static void hangUpTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (leftToThick <= 0)
            {
                hangUpTimer.Stop();
                Dialer.Cancel();
            }
            else
            {
                //StringBuilder sb = new StringBuilder();
                //int i = leftToThick;
                //while (i-- > 0) sb.Append('*');

                string message = string.Empty;
                //string subMessage = string.Empty;
                if (contactToDial is ContactUnknown)
                {
                    message = string.Format("Calling {0} ...", contactToDial.number);
                }
                else
                {
                    message = string.Format("Calling {0} ...", contactToDial.name);
                    //subMessage = string.Format("{0}", contactToDial.number);
                }

                MessagesHandler.Display(message, string.Format("Use phone now. {0} seconds to hang up...", leftToThick));
                leftToThick--;
            }
        }
Пример #2
0
        public void ExecuteCommand(Extension.IEnsoService service, Command command)
        {
            //Exception ee = new Exception("inner one");
            //Exception ee2 = new Exception("inner two",ee);
            //Exception ee3 = new Exception("test ex",ee2);
            //throw ee3;

            Logging.AddActionLog(string.Format("Caller: Executing command '{0}' ...", command.Name));

            if (command.Name == "call" || command.Name == "dial")
            {
                Dialer.service = service;
                if (command.parametersOnExecute[0] is StringWorkItem)
                {
                    Dialer.contactToDial = new ContactUnknown(command.parametersOnExecute[0].GetValueAsText());
                }
                else if (command.parametersOnExecute[0] is Contact)
                {
                    Dialer.contactToDial = (command.parametersOnExecute[0] as Contact);
                }

                WorkItemsProviders.CallerHistory.CallerHistory.Add(Dialer.contactToDial);
                Dialer.Dial();
            }
            else
            if (command.Name == "recall" || command.Name == "redial")
            {
                Dialer.service = service;
                Dialer.Redial();
            }
            else
            if (command.Name == "later")
            {
                Dialer.service = service;
                Dialer.Cancel();
            }
            else
            {
                throw new ApplicationException(string.Format("Caller: Command not found. Command: {0} {1}", command.Name, command.Postfix));
            }
        }