Example #1
0
        private LineControl getLineControlFromPeerEntry(PeerEntryEvent pee)
        {
            log.Debug("Peer entry channel: " + pee.Channel + ", status:" + pee.Status);
            LineControl lc = null;

            lc = new LineControl();
            //lc.directoryNumber = pee.ChannelType + "/" + pee.ObjectName;
            lc.directoryNumber       = pee.ObjectName;
            lc.doNotDisturb          = false;
            lc.forward               = "";
            lc.mwiOn                 = getMWI(pee.ObjectName);
            lc.lineControlConnection = null;
            switch (pee.Status)
            {
            case "UNKNOWN":
                lc.status = Status.inactive;
                break;

            default:
                //OK
                lc.status = Status.available;
                break;
            }
            linecontrols.Add(lc);
            getDND(lc.directoryNumber);
            getForward(lc.directoryNumber);
            return(lc);
        }
Example #2
0
    private GameObject DuplicateLine(GameObject obj)
    {
        GameObject line = Instantiate(bar, parentPanel.transform, false);

        LineControl.Copy(line.GetComponent <LineControl>(), obj.GetComponent <LineControl>());
        return(line);
    }
Example #3
0
        private LineControl setLineControlForward(string dn, string forward)
        {
            LineControl lc = getLineControl(dn);

            lc.forward = forward;
            return(lc);
        }
Example #4
0
        private LineControl setLineControlDND(string dn, bool dnd)
        {
            LineControl lc = getLineControl(dn);

            lc.doNotDisturb = dnd;
            return(lc);
        }
Example #5
0
        private LineControl getLineControlFromExtensionStatusEvent(ExtensionStatusEvent ese)
        {
            log.Debug("Extension status event: " + ese.Exten + ", " + ese.Channel + ", status:" + ese.Status.ToString());
            LineControl lc = getLineControl(ese.Exten);

            switch (ese.Status)
            {
            case 0:
                if (lc.lineControlConnection == null)
                {
                    lc.status = Status.available;
                }
                break;

            case 1:
                lc.status = Status.busy;
                break;

            case 8:
                lc.status = Status.busy;
                break;

            case 4:
                lc.status = Status.inactive;
                lc.lineControlConnection = null;
                break;
            }
            return(lc);
        }
Example #6
0
 private void Awake()
 {
     lineControl   = FindObjectOfType <LineControl>();
     columnControl = GameObject.Find("Column Control");
     anim          = GetComponent <Animator>();
     rb            = GetComponent <Rigidbody2D>();
 }
Example #7
0
        public void ShowPropertyWindow(UIElement element)
        {
            _lineControl = element as LineControl;//旧的
            if (_lineControl == null)
            {
                return;
            }
            #region 如果是新建连线就创对_lineObject对象
            if (_lineObject == null)
            {
                LineObject obj = LineObjects.Where(p => p.LineId.Equals(_lineControl.UniqueID)).SingleOrDefault();
                if (obj == null)
                {
                    _lineObject        = new LineObject();
                    _lineObject.LineId = _lineControl.UniqueID;
                }
                else
                {
                    _lineObject = obj;
                }

                UpdateLineObject(_lineObject);
            }
            #endregion
        }
 public LineItem()
 {
     _currentUIElement                    = new Path();
     _currentUIElement.Stroke             = new SolidColorBrush(normalStroke.HexToColor());
     _currentUIElement.StrokeThickness    = 5;
     _currentUIElement.StrokeStartLineCap = PenLineCap.Square;
     _currentUIElement.StrokeEndLineCap   = PenLineCap.Square;
     UIElement = new LineControl(_currentUIElement);
 }
Example #9
0
 private static bool FindLineControl(LineControl lc)
 {
     if (lc.directoryNumber == dnToFind)
     {
         return(true);
     }
     {
         return(false);
     }
 }
        public LineViewModel(ILineViewModelService lineViewModelService, Line line)
        {
            this.lineViewModelService = lineViewModelService;
            Line = line;
            line.View.ViewModel = this;
            LineControl         = lineViewModelService.GetLineControl(line);
            ItemZIndex          = -1;

            UpdateLine();
            TrackSourceOrTargetChanges();
        }
Example #11
0
 public static void Copy(LineControl newLC, LineControl oldLC)
 {
     newLC.x      = oldLC.x;
     newLC.y      = oldLC.y;
     newLC.v      = oldLC.v;
     newLC.index  = oldLC.index;
     newLC.array  = oldLC.array;
     newLC.tx     = oldLC.tx;
     newLC.ty     = oldLC.ty;
     newLC.tindex = oldLC.tindex;
     newLC.tarray = oldLC.tarray;
     newLC.DrawValue();
 }
Example #12
0
    // Standard top-down Merge Sort for an integer array A.
    private IEnumerator MergeSort(int[] A, GameObject[] A_ob, GameObject[] B_ob)
    {
        int L = A.Length;

        int[] B = new int[L];

        int target = 2020;

        for (int i = 0; i < L; i++)
        {
            B[i] = A[i];
            // copy each A_ob into the second array.
            Destroy(B_ob[i]);
            B_ob[i] = Instantiate(bar, parentPanel.transform, false);
            LineControl.Copy(B_ob[i].GetComponent <LineControl>(), A_ob[i].GetComponent <LineControl>());
            B_ob[i].GetComponent <LineControl>().MoveToLocation(i, (A_ob[i].GetComponent <LineControl>().array + 1) % 2);
            yield return(new WaitForSeconds(0.01f));
        }

        while (!B_ob[B_ob.Length - 1].GetComponent <LineControl>().finishedMoving)
        {
            yield return(new WaitForSeconds(0.001f));
        }

        yield return(StartCoroutine(SplitSubArray(A, 0, L, B, A_ob, B_ob)));

        yield return(new WaitForSeconds(3.0f));

        foreach (GameObject obj in A_ob)
        {
            Destroy(obj);
        }

        array1.alpha = 0;

        yield return(StartCoroutine(Staircase(A, B_ob, target, 0.1f, -1, 1)));

        yield return(StartCoroutine(Staircase2(A, B_ob, target)));

        /*
         * for (int i = 0; i < L; i++)
         * {
         *  A[i] = B[i];
         *  Destroy(A_ob[i]);
         *  A_ob[i] = Instantiate(bar, parentPanel.transform, false);
         *  LineControl.Copy(A_ob[i].GetComponent<LineControl>(), B_ob[i].GetComponent<LineControl>());
         *  A_ob[i].GetComponent<LineControl>().MoveToLocation(i, (B_ob[i].GetComponent<LineControl>().array + 1) % 2);
         * }
         */
    }
Example #13
0
        void manager_LineRemoved(object sender, LineRemovedEventArgs e)
        {
            foreach (TapiAddress ad in e.Line.Addresses)
            {
                LineControl lc = new LineControl();
                lc.directoryNumber       = ad.Address;
                lc.doNotDisturb          = false;
                lc.forward               = GetForward(ad);
                lc.mwiOn                 = false;
                lc.monitored             = "";
                lc.status                = Status.inactive;
                lc.lineControlConnection = null;
                ss.SetLineControl(lc);
            }

            log.Debug("Manager line removed: " + e.Line.ToString());
        }
        public static GenControl LoadControl(BinaryReader reader, ScheduleGenWindow window)
        {
            GenControl control = null;
            var        type    = reader.ReadString();

            if (type == LineControl.Type)
            {
                control = LineControl.Load(reader, window);
            }
            else if (type == RunBeforeControl.Type)
            {
                control = RunBeforeControl.Load(reader, window);
            }
            else if (type == TextureControl.Type)
            {
                control = TextureControl.Load(reader, window);
            }
            else if (type == WasteControl.Type)
            {
                control = WasteControl.Load(reader, window);
            }
            else if (type == SalesNumbersControl.Type)
            {
                control = SalesNumbersControl.Load(reader, window);
            }
            else if (type == SalesPrediction.Type)
            {
                control = SalesPrediction.Load(reader, window);
            }
            else if (type == PurgeWiPControl.Type)
            {
                control = PurgeWiPControl.Load(reader, window);
            }
            else if (type == WidthControl.Type)
            {
                control = WidthControl.Load(reader, window);
            }
            else
            {
                throw new ArgumentOutOfRangeException("Type of control not recognized");
            }

            return(control);
        }
Example #15
0
        public LineControlResponse GetLineControl(LineControl lc, string token)
        {
            log.Debug("GetLineControl: " + lc.ToString());
            LineControl newlc = null;

            if (ValidateToken(token, lc.directoryNumber))
            {
                log.Debug("Token is valid...Retreive line control (" + lc.directoryNumber + ") from LineControlService");
                try
                {
                    newlc = LineControlService.GetLineControl(lc);
                }
                catch (Exception e)
                {
                    log.Error("Unable to retreive lineControl from LineControlService: " + e.Message);
                }
            }
            return(new LineControlResponse(newlc, AuthenticationService.UpdateToken(token)));
        }
Example #16
0
    private IEnumerator MergeArray(int[] A, int start, int middle, int end, int[] B, GameObject[] A_ob, GameObject[] B_ob)
    {
        int i = start;
        int j = middle;

        for (int k = start; k < end; k++)
        {
            if (i < middle && (j >= end || A[i] <= A[j]))
            {
                B[k] = A[i];

                Destroy(B_ob[k]);
                B_ob[k] = Instantiate(bar, parentPanel.transform, false);
                LineControl.Copy(B_ob[k].GetComponent <LineControl>(), A_ob[i].GetComponent <LineControl>());
                B_ob[k].GetComponent <LineControl>().MoveToLocation(k, (A_ob[i].GetComponent <LineControl>().array + 1) % 2);

                //B_ob[k].GetComponent<LineControl>().Instantiate(k, (A_ob[i].GetComponent<LineControl>().array + 1) % 2, A_ob[i].GetComponent<LineControl>().v);
                //while (!B_ob[k].GetComponent<LineControl>().finishedMoving)

                yield return(new WaitForSeconds(0.001f));

                i++;
            }
            else
            {
                B[k] = A[j];
                Destroy(B_ob[k]);
                B_ob[k] = Instantiate(bar, parentPanel.transform, false);
                LineControl.Copy(B_ob[k].GetComponent <LineControl>(), A_ob[j].GetComponent <LineControl>());
                B_ob[k].GetComponent <LineControl>().MoveToLocation(k, (A_ob[j].GetComponent <LineControl>().array + 1) % 2);

                //B_ob[k].GetComponent<LineControl>().Instantiate(k, (A_ob[j].GetComponent<LineControl>().array + 1) % 2, A_ob[j].GetComponent<LineControl>().v);
                yield return(new WaitForSeconds(0.001f));

                j++;
            }

            while (!B_ob[end - 1].GetComponent <LineControl>().finishedMoving)
            {
                yield return(new WaitForSeconds(0.01f));
            }
        }
    }
Example #17
0
        private LineControl getLineControl(string dn)
        {
            LineControl lc = null;

            dnToFind = dn;
            log.Debug("Looking for LineControl: " + dn);
            lc = linecontrols.Find(FindLineControl);
            if (lc == null)
            {
                log.Debug("LineControl: " + dn + " not exists");
                lc = new LineControl();
                lc.directoryNumber       = dn;
                lc.doNotDisturb          = false;
                lc.forward               = "";
                lc.mwiOn                 = false;
                lc.lineControlConnection = null;
            }
            return(lc);
        }
Example #18
0
    public void Update()
    {
        // Find the Camera object
        GameObject Camera = GameObject.Find("Calibration/Scene Root/Camera");
        // access the ARCamera script of Camera
        ARCamera arCamera = Camera.GetComponent <ARCamera>();

        // find the transformation from marker to camera
        MarkerToCamera = arCamera.myPose;

        // Set the input positions for start and end
        GameObject  AugmentLine = GameObject.Find("Calibration/Scene Root/Marker/Augment Line");
        LineControl line        = AugmentLine.GetComponent <LineControl>();

        // the input end position is the position of needle tip wrt marker
        float inputEndX = line.endPosition.x;
        float inputEndY = line.endPosition.y;
        float inputEndZ = line.endPosition.z;
        // the input start position is the start position of needle tip wrt marker
        float inputStartX = line.startPosition.x;
        float inputStartY = line.startPosition.y;
        float inputStartZ = line.startPosition.z;

        // Now we need to convert these positions to be wrt RGBD camera
        Vector4 inputStart = new Vector4(inputStartX, inputStartY, inputStartZ, 1.0f);
        Vector4 inputEnd   = new Vector4(inputEndX, inputEndY, inputEndZ, 1.0f);

        Vector4 StartPosition4 = MarkerToCamera * inputStart;
        Vector4 EndPosition4   = MarkerToCamera * inputEnd;

        SentStartPosition = new Vector3(StartPosition4.x, StartPosition4.y, StartPosition4.z);
        SentEndPosition   = new Vector3(EndPosition4.x, EndPosition4.y, EndPosition4.z);

        // print("Sent End Position is defined.\n");
        // print("Sent Start Position is defined.\n");
        string sendMessage = makeMessage(SentStartPosition, SentEndPosition, MarkerToCamera);

        print(sendMessage + "\n");

        // send the message
        sendString(sendMessage);
    }
Example #19
0
        public override void InitialiseControls()
        {
            var horizontalAlignment = Menu.Centred ? HorizontalAlignment.Center : HorizontalAlignment.Left;
            var verticalAlignment   = Menu.Centred ? VerticalAlignment.Center : VerticalAlignment.Top;

            var background = new BackgroundControl {
                Position = Position, Padding = Padding, HorizontalAlignment = horizontalAlignment, VerticalAlignment = verticalAlignment
            };

            Controls.Add(background);

            MenuActions = new MenuActionsControl {
                AvailableActions = Menu.AvailableActions, SelectedAction = Menu.SelectedAction, SelectedColor = Color.Blue, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Right
            };
            background.Controls.Add(MenuActions);

            var topFlow = new FlowContainerControl {
                HorizontalAlignment = horizontalAlignment, VerticalAlignment = verticalAlignment, ShrinkToContents = true
            };

            var titleText = new LargeTextControl {
                Parameters = Menu.MenuName
            };

            topFlow.Controls.Add(titleText);

            var lineControl = new LineControl();

            topFlow.Controls.Add(lineControl);

            background.Controls.Add(topFlow);

            PagedMenuControl = new PagedMenuControl {
                MenuItems = Menu.MenuItems, SelectedItem = Menu.SelectedItem, ShrinkToContents = true, Margin = new Padding(4, 1, 1, 1), HorizontalAlignment = horizontalAlignment, VerticalAlignment = verticalAlignment
            };

            topFlow.Controls.Add(PagedMenuControl);
        }
Example #20
0
        private UIElement ElementFactory(ElementType type)
        {
            //SetZoom(1.0);//置放大或者缩小为原点
            UIElement element = null;
            double    left = 0, right = 0;

            switch (type)
            {
            case ElementType.Begin:
            {
                element = new BeginControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height);
                break;
            }

            case ElementType.Activity:
            {
                element = new SMT.Workflow.Platform.Designer.DesignerControl.ActivityControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height);
                ((DesignerControl.ActivityControl)element).Title = "新建活动" + this.GetActivieyIdentityNo();
                break;
            }

            case ElementType.Line:
            {
                element = new LineControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height);
                ((DesignerControl.LineControl)element).Title = "新建连线" + this.GetLineIdentityNo();
                break;
            }

            case ElementType.Finish:
            {
                element = new FinishControl(left, right, cnsDesignerContainer.Width, cnsDesignerContainer.Height);
                break;
            }
            }
            return(element);
        }
Example #21
0
        private LineControl GetLineControl(TapiAddress address)
        {
            LineControl lc = new LineControl();

            lc.directoryNumber = address.Address;
            lc.doNotDisturb    = false;
            lc.forward         = GetForward(address);
            lc.mwiOn           = false;
            lc.monitored       = "";
            if (address.Calls.Length > 0)
            {
                List <LineControlConnection> lcs = new List <LineControlConnection>();
                foreach (TapiCall tc in address.Calls)
                {
                    if (tc.CallState != CallState.Idle && tc.CallState != CallState.Unknown)
                    {
                        LineControlConnection lcc = new LineControlConnection();
                        lcc.callid = tc.Id.ToString();
                        if (tc.CallOrigin == CallOrigins.Outbound)
                        {
                            lcc.contact = tc.CalledId;
                        }
                        else
                        {
                            lcc.contact = tc.CallerId;
                        }
                        SetLineControlConnection(lcc, tc.CallState);
                        lcs.Add(lcc);
                    }
                }
                lc.lineControlConnection = lcs.ToArray();
                if (address.Calls.Length > 1)
                {
                    lc.status = Status.busy;
                }
                else
                {
                    switch (address.Calls[0].CallState)
                    {
                    case CallState.Dialing:
                        lc.status = Status.dialing;
                        break;

                    case CallState.Offering:
                        lc.status = Status.ringing;
                        break;

                    case CallState.Idle:
                        lc.status = Status.available;
                        break;

                    case CallState.Disconnected:
                        lc.status = Status.available;
                        break;

                    case CallState.None:
                        lc.status = Status.available;
                        break;

                    case CallState.Unknown:
                        lc.status = Status.available;
                        break;

                    case CallState.Accepted:
                        lc.status = Status.busy;
                        break;

                    case CallState.Busy:
                        lc.status = Status.busy;
                        break;

                    default:
                        lc.status = Status.busy;
                        break;
                    }
                }
            }
            else
            {
                lc.status = Status.available;
            }
            return(lc);
        }
Example #22
0
 private void LinePrevious(object sender, MouseButtonEventArgs e)
 {
     LineControl.Previous(ExamplesMapper.LineAndAreaAexamples);
 }
Example #23
0
 public abstract LineControl GetLineControl(LineControl lc);
Example #24
0
 public static LineControl GetLineControl(LineControl lc)
 {
     return(_provider.GetLineControl(lc));
 }
Example #25
0
        void manager_UnhandledEvent(object sender, ManagerEvent e)
        {
            log.Debug("New unhandled event received: " + e.GetType().Name);
            LineControl lc = null;

            //StateServer
            switch (e.GetType().Name)
            {
            case "AGIExecEvent":
                AGIExecEvent agievent = e as AGIExecEvent;
                break;

            case "AlarmClearEvent":
                AlarmClearEvent alarmclear = e as AlarmClearEvent;
                break;

            case "AlarmEvent":
                AlarmEvent alarmevent = e as AlarmEvent;
                break;

            case "AsyncAGIEvent":
                AsyncAGIEvent asyncagievent = e as AsyncAGIEvent;
                break;

            case "BridgeEvent":
                BridgeEvent bridgeevent = e as BridgeEvent;
                break;

            case "CdrEvent":
                CdrEvent cdrevent = e as CdrEvent;
                break;

            case "ChannelReloadEvent":
                ChannelReloadEvent channelreload = e as ChannelReloadEvent;
                break;

            case "ChannelUpdateEvent":
                ChannelUpdateEvent channelupdate = e as ChannelUpdateEvent;
                break;

            case "ConnectEvent":
                ConnectEvent connectevent = e as ConnectEvent;
                break;

            case "ConnectionStateEvent":
                ConnectionStateEvent connectionstate = e as ConnectionStateEvent;
                break;

            case "DBGetResponseEvent":
                DBGetResponseEvent dbget = e as DBGetResponseEvent;
                log.Debug("DBGet response: " + dbget.ToString());
                switch (dbget.Family)
                {
                case "DND":
                    ss.SetLineControl(setLineControlDND(dbget.Key, true));
                    break;

                case "CF":
                    ss.SetLineControl(setLineControlForward(dbget.Key, dbget.Val));
                    break;
                }
                break;

            case "DialEvent":
                DialEvent dial = e as DialEvent;
                log.Debug("Dial event: " + dial.ToString());
                break;

            case "DisconnectEvent":
                DisconnectEvent disconnect = e as DisconnectEvent;
                log.Debug("Disconnect event: " + disconnect.ToString());
                break;

            case "DNDStateEvent":
                DNDStateEvent dndstate = e as DNDStateEvent;
                log.Debug("DND state event: " + dndstate.ToString());
                break;

            case "ExtensionStatusEvent":
                ExtensionStatusEvent extensionstatus = e as ExtensionStatusEvent;
                log.Debug("Extension status event: " + extensionstatus.ToString() + ", status: " + extensionstatus.Status + ", hint: " + extensionstatus.Hint);
                ss.SetLineControl(getLineControlFromExtensionStatusEvent(extensionstatus));
                break;

            case "FaxReceivedEvent":
                FaxReceivedEvent faxreceived = e as FaxReceivedEvent;
                break;

            case "HangupEvent":
                HangupEvent hangup = e as HangupEvent;
                log.Debug("Hangup event: " + hangup.ToString() + " callerid: " + hangup.CallerId + " calleridnum: " + hangup.CallerIdNum);
                //line control
                if (channels.Contains(hangup.Channel))
                {
                    lc = getLineControl((string)channels[hangup.Channel]);
                    int hi = 0;
                    LineControlConnection[] newLCC = null;
                    if (lc.lineControlConnection.Length > 1)
                    {
                        newLCC = new LineControlConnection[lc.lineControlConnection.Length - 1];
                        foreach (LineControlConnection hlcc in lc.lineControlConnection)
                        {
                            if (hlcc.callid != hangup.Channel)
                            {
                                newLCC[hi] = hlcc;
                                hi++;
                            }
                        }
                    }
                    lc.lineControlConnection = newLCC;
                    ss.SetLineControl(lc);
                    channels.Remove(hangup.Channel);
                }

                //missed calls
                callToFind = hangup.UniqueId.Substring(0, 6) + "," + hangup.UniqueId.Substring(6);
                Call mCall = missedCalls.Find(FindCall);
                if (mCall != null)
                {
                    log.Debug("Missed call finded for callid: " + hangup.UniqueId);
                    AddCallLogs(mCall.callee, mCall);
                    if (missedCalls.Remove(mCall))
                    {
                        log.Debug("Call " + mCall.callId + " successfully removed from missedcall cache");
                    }
                    else
                    {
                        log.Debug("Call " + mCall.callId + " cannot be removed from missedcall cache");
                    }
                }
                break;

            case "HoldedCallEvent":
                HoldedCallEvent holdedcall = e as HoldedCallEvent;
                break;

            case "HoldEvent":
                HoldEvent holdevent = e as HoldEvent;
                break;

            case "JabberEvent":
                JabberEvent jabberevent = e as JabberEvent;
                break;

            case "JitterBufStatsEvent":
                JitterBufStatsEvent jitter = e as JitterBufStatsEvent;
                break;

            case "JoinEvent":
                JoinEvent join = e as JoinEvent;
                break;

            case "LeaveEvent":
                LeaveEvent leave = e as LeaveEvent;
                break;

            case "LinkEvent":
                LinkEvent link = e as LinkEvent;
                log.Debug("Link event: " + link.ToString());
                lc = getLineControl(link.CallerId1);
                if (lc != null)
                {
                    foreach (LineControlConnection linklcc in lc.lineControlConnection)
                    {
                        if (linklcc.callid == link.Channel1)
                        {
                            linklcc.contact = link.CallerId2;
                            ss.SetLineControl(lc);
                            break;
                        }
                    }
                }
                lc = getLineControl(link.CallerId2);
                if (lc != null)
                {
                    foreach (LineControlConnection linklcc in lc.lineControlConnection)
                    {
                        if (linklcc.callid == link.Channel2)
                        {
                            linklcc.contact = link.CallerId1;
                            ss.SetLineControl(lc);
                            break;
                        }
                    }
                }
                break;

            case "LogChannelEvent":
                LogChannelEvent logchannel = e as LogChannelEvent;
                break;

            case "ManagerEvent":
                ManagerEvent managerevent = e;
                break;

            case "MeetmeEndEvent":
                MeetmeEndEvent meetmeend = e as MeetmeEndEvent;
                break;

            case "MeetmeJoinEvent":
                MeetmeJoinEvent meetmejoin = e as MeetmeJoinEvent;
                break;

            case "MeetmeLeaveEvent":
                MeetmeLeaveEvent meetmeleave = e as MeetmeLeaveEvent;
                break;

            case "MeetmeMuteEvent":
                MeetmeMuteEvent meetmemute = e as MeetmeMuteEvent;
                break;

            case "MeetmeStopTalkingEvent":
                MeetmeStopTalkingEvent meetmestoptalking = e as MeetmeStopTalkingEvent;
                break;

            case "MeetmeTalkingEvent":
                MeetmeTalkingEvent meetmetalking = e as MeetmeTalkingEvent;
                break;

            case "MeetmeTalkRequestEvent":
                MeetmeTalkRequestEvent meetmetalkrequest = e as MeetmeTalkRequestEvent;
                break;

            case "MessageWaitingEvent":
                MessageWaitingEvent messagewaiting = e as MessageWaitingEvent;
                log.Debug("Message waiting event: " + messagewaiting.ToString());
                lc = getLineControl(messagewaiting.Mailbox.Substring(0, messagewaiting.Mailbox.IndexOf("@")));
                if (lc != null)
                {
                    if (messagewaiting.Waiting > 0)
                    {
                        lc.mwiOn = true;
                    }
                    else
                    {
                        lc.mwiOn = false;
                    }
                    ss.SetLineControl(lc);
                }
                break;

            case "MobileStatusEvent":
                MobileStatusEvent mobilestatus = e as MobileStatusEvent;
                break;

            case "ModuleLoadReportEvent":
                ModuleLoadReportEvent moduleload = e as ModuleLoadReportEvent;
                break;

            case "MonitorStartEvent":
                MonitorStartEvent monitorstart = e as MonitorStartEvent;
                break;

            case "MonitorStopEvent":
                MonitorStopEvent monitorstop = e as MonitorStopEvent;
                break;

            case "NewAccountCodeEvent":
                NewAccountCodeEvent newaccountcode = e as NewAccountCodeEvent;
                break;

            case "NewCallerIdEvent":
                NewCallerIdEvent newcallerid = e as NewCallerIdEvent;
                log.Debug("New caller id envent: " + newcallerid.ToString());
                break;

            case "NewChannelEvent":
                NewChannelEvent newchannel = e as NewChannelEvent;
                log.Debug("New Channel event: " + newchannel.ToString());
                CommandAction   ca = new CommandAction("core show channel " + newchannel.Channel);
                CommandResponse cr = (CommandResponse)manager.SendAction(ca, 10000);
                log.Debug("Channel info: " + cr.ToString());
                string dn = newchannel.CallerIdNum;
                log.Debug("Retreive call information...");
                bool callerIdUnknown = true;
                if (newchannel.CallerIdNum != "<unknown>")
                {
                    callerIdUnknown = false;
                }
                else
                {
                    foreach (string s in cr.Result)
                    {
                        if (s.Contains("Caller ID:"))
                        {
                            dn = s.Substring(s.LastIndexOf(" "));
                            break;
                        }
                    }
                }
                Call newOutboundCall = getOutboundCallFromChannelInfo(cr.Result, callerIdUnknown);
                if (newOutboundCall != null)
                {
                    Call missedCall = newOutboundCall;
                    AddCallLogs(dn, newOutboundCall);
                    dnToFind = newOutboundCall.callee;
                    if (linecontrols.Find(FindLineControl) != null)
                    {
                        log.Debug("This call will be put in missedcall cache: " + missedCall.callId);
                        missedCall.type = CallType.missed;
                        missedCalls.Add(missedCall);
                    }
                }
                break;

            case "NewExtenEvent":
                NewExtenEvent newexten = e as NewExtenEvent;
                log.Debug("New exten event: " + newexten.ToString());
                string   channel      = "";
                char[]   splitter     = { '/' };
                string[] splitchannel = newexten.Channel.Split(splitter);
                splitter[0]  = '-';
                splitchannel = splitchannel[1].Split(splitter);
                channel      = splitchannel[0];
                //DND?
                if (newexten.Extension == Properties.Settings.Default.FeatureCodeDNDToggle && newexten.Application == "Playback")
                {
                    switch (newexten.AppData)
                    {
                    case "do-not-disturb&activated":
                        log.Debug("Successfully activate dnd for channel: " + channel);
                        ss.SetLineControl(setLineControlDND(channel, true));
                        break;

                    case "do-not-disturb&de-activated":
                        log.Debug("Successfully deactivate dnd for channel: " + channel);
                        ss.SetLineControl(setLineControlDND(channel, false));
                        break;
                    }
                }
                //Forward all?
                else if (newexten.Extension.Contains(Properties.Settings.Default.FeatureCodeCallForwardAllActivate) && newexten.Application == "Playback" && newexten.AppData == "call-fwd-unconditional&for&extension")
                {
                    string forward = newexten.Extension.Substring(Properties.Settings.Default.FeatureCodeCallForwardAllActivate.Length);
                    log.Debug("Call forward all from channel: " + channel + " to " + forward);
                    ss.SetLineControl(setLineControlForward(channel, forward));
                }
                // UnForwardAll
                else if (newexten.Extension == Properties.Settings.Default.FeatureCodeCallForwardAllDeactivate && newexten.Application == "Playback" && newexten.AppData == "call-fwd-unconditional&de-activated")
                {
                    log.Debug("Call unforward all from channel: " + channel);
                    ss.SetLineControl(setLineControlForward(channel, ""));
                }
                break;

            case "NewStateEvent":
                NewStateEvent newstate = e as NewStateEvent;
                log.Debug("New State event: " + newstate.ToString());
                LineControl             newstateLc   = getLineControl(newstate.CallerId);
                LineControlConnection[] newStateLccs = null;
                int i = 0;
                if (newstateLc.lineControlConnection != null)
                {
                    bool isContained = false;
                    foreach (LineControlConnection elcc in newstateLc.lineControlConnection)
                    {
                        if (elcc.callid == newstate.Channel)
                        {
                            isContained  = true;
                            newStateLccs = newstateLc.lineControlConnection;
                            break;
                        }
                        i++;
                    }
                    if (!isContained)
                    {
                        i            = 0;
                        newStateLccs = new LineControlConnection[newstateLc.lineControlConnection.Length + 1];
                        foreach (LineControlConnection newstateLcc in newstateLc.lineControlConnection)
                        {
                            newStateLccs[i] = newstateLcc;
                            i++;
                        }
                    }
                }
                else
                {
                    newStateLccs    = new LineControlConnection[1];
                    newStateLccs[0] = new LineControlConnection();
                }
                try
                {
                    switch (newstate.State)
                    {
                    case "Up":
                        //received call?
                        callToFind = newstate.UniqueId;
                        Call rCall = missedCalls.Find(FindCall);
                        if (rCall != null)
                        {
                            log.Debug("Missed call finded: " + callToFind + ", this call will be received");
                            rCall.type = CallType.received;
                            AddCallLogs(rCall.callee, rCall);
                            missedCalls.Remove(rCall);
                        }
                        if (newStateLccs != null)
                        {
                            if (!channels.Contains(newstate.Channel))
                            {
                                channels.Add(newstate.Channel, newstate.CallerId);
                            }
                            newStateLccs[i].callid        = newstate.Channel;
                            newStateLccs[i].remoteState   = Wybecom.TalkPortal.CTI.Proxy.ConnectionState.established;
                            newStateLccs[i].state         = Wybecom.TalkPortal.CTI.Proxy.ConnectionState.established;
                            newStateLccs[i].terminalState = TerminalState.talking;
                        }
                        break;

                    case "Ringing":
                        if (newStateLccs != null)
                        {
                            if (!channels.Contains(newstate.Channel))
                            {
                                channels.Add(newstate.Channel, newstate.CallerId);
                            }
                            newStateLccs[i].callid        = newstate.Channel;
                            newStateLccs[i].remoteState   = Wybecom.TalkPortal.CTI.Proxy.ConnectionState.established;
                            newStateLccs[i].state         = Wybecom.TalkPortal.CTI.Proxy.ConnectionState.alerting;
                            newStateLccs[i].terminalState = TerminalState.ringing;
                        }
                        break;

                    case "Ring":
                        if (newStateLccs != null)
                        {
                            if (!channels.Contains(newstate.Channel))
                            {
                                channels.Add(newstate.Channel, newstate.CallerId);
                            }
                            newStateLccs[i].callid        = newstate.Channel;
                            newStateLccs[i].remoteState   = Wybecom.TalkPortal.CTI.Proxy.ConnectionState.alerting;
                            newStateLccs[i].state         = Wybecom.TalkPortal.CTI.Proxy.ConnectionState.dialing;
                            newStateLccs[i].terminalState = TerminalState.inuse;
                        }
                        break;
                    }
                }
                catch (Exception stateException)
                {
                    log.Debug("NewState exception: " + stateException.Message);
                }
                if (newstateLc != null)
                {
                    newstateLc.lineControlConnection = newStateLccs;
                    ss.SetLineControl(newstateLc);
                }
                break;

            case "OriginateResponseEvent":
                OriginateResponseEvent originateresponse = e as OriginateResponseEvent;
                break;

            case "ParkedCallEvent":
                ParkedCallEvent parkedcall = e as ParkedCallEvent;
                break;

            case "ParkedCallGiveUpEvent":
                ParkedCallGiveUpEvent parkedcallgiveup = e as ParkedCallGiveUpEvent;
                break;

            case "ParkedCallsCompleteEvent":
                ParkedCallsCompleteEvent parkedcallscomplete = e as ParkedCallsCompleteEvent;
                break;

            case "ParkedCallTimeOutEvent":
                ParkedCallTimeOutEvent parkedcalltimeout = e as ParkedCallTimeOutEvent;
                break;

            case "PeerEntryEvent":
                log.Debug("SipAction: one peer entry event received, " + e.ToString());
                PeerEntryEvent peerentry = e as PeerEntryEvent;
                peers.Add(peerentry);
                ss.SetLineControl(getLineControlFromPeerEntry(peerentry));
                break;

            case "PeerlistCompleteEvent":
                log.Debug("SipAction: peer list completed " + e.ToString());
                PeerlistCompleteEvent peerlistcomplete = e as PeerlistCompleteEvent;
                acs.setPeers(peers);
                break;

            case "PeerStatusEvent":
                PeerStatusEvent peerstatus = e as PeerStatusEvent;
                log.Debug("Peer status: " + peerstatus.ToString());
                break;

            case "PRIEvent":
                PRIEvent pri = e as PRIEvent;
                break;

            case "RegistryEvent":
                RegistryEvent registry = e as RegistryEvent;
                break;

            case "ReloadEvent":
                ReloadEvent reload = e as ReloadEvent;
                break;

            case "RenameEvent":
                RenameEvent rename = e as RenameEvent;
                break;

            case "ResponseEvent":
                ResponseEvent response = e as ResponseEvent;
                break;

            case "RTCPReceivedEvent":
                RTCPReceivedEvent rtcpreceived = e as RTCPReceivedEvent;
                break;

            case "RTCPSentEvent":
                RTCPSentEvent rtcpsent = e as RTCPSentEvent;
                break;

            case "RTPReceiverStatEvent":
                RTPReceiverStatEvent rtpreceiver = e as RTPReceiverStatEvent;
                break;

            case "RTPSenderStatEvent":
                RTPSenderStatEvent rtpsender = e as RTPSenderStatEvent;
                break;

            case "ShowDialPlanCompleteEvent":
                ShowDialPlanCompleteEvent showdialplan = e as ShowDialPlanCompleteEvent;
                break;

            case "ShutdownEvent":
                ShutdownEvent shutdown = e as ShutdownEvent;
                break;

            case "StatusCompleteEvent":
                StatusCompleteEvent statuscomplete = e as StatusCompleteEvent;
                break;

            case "StatusEvent":
                StatusEvent status = e as StatusEvent;
                break;

            case "TransferEvent":
                TransferEvent transfer = e as TransferEvent;
                break;

            case "UnholdEvent":
                UnholdEvent unhold = e as UnholdEvent;
                break;

            case "UnknownEvent":
                UnknownEvent unknown = e as UnknownEvent;
                break;

            case "UnlinkEvent":
                UnlinkEvent unlink = e as UnlinkEvent;
                log.Debug("Unlink event : " + unlink.ToString());
                LineControlConnection[] lccs = null;
                i  = 0;
                lc = getLineControl(unlink.CallerId1);
                if (lc != null)
                {
                    if (lc.lineControlConnection.Length > 1)
                    {
                        lccs = new LineControlConnection[lc.lineControlConnection.Length - 1];
                        foreach (LineControlConnection linklcc in lc.lineControlConnection)
                        {
                            if (linklcc.callid != unlink.Channel1)
                            {
                                lccs[i] = linklcc;
                                i++;
                                break;
                            }
                        }
                    }
                    else
                    {
                        lc.lineControlConnection = null;
                    }
                    ss.SetLineControl(lc);
                }
                i  = 0;
                lc = getLineControl(unlink.CallerId2);
                if (lc != null)
                {
                    if (lc.lineControlConnection.Length > 1)
                    {
                        lccs = new LineControlConnection[lc.lineControlConnection.Length - 1];
                        foreach (LineControlConnection linklcc in lc.lineControlConnection)
                        {
                            if (linklcc.callid != unlink.Channel2)
                            {
                                lccs[i] = linklcc;
                                i++;
                                break;
                            }
                        }
                    }
                    else
                    {
                        lc.lineControlConnection = null;
                    }
                    ss.SetLineControl(lc);
                }
                break;

            case "UnparkedCallEvent":
                UnparkedCallEvent unparked = e as UnparkedCallEvent;
                break;

            case "UserEvent":
                UserEvent user = e as UserEvent;
                break;

            case "VarSetEvent":
                VarSetEvent varset = e as VarSetEvent;
                break;

            case "ZapShowChannelsCompleteEvent":
                ZapShowChannelsCompleteEvent zapshowchannelscomplete = e as ZapShowChannelsCompleteEvent;
                break;

            case "ZapShowChannelsEvent":
                ZapShowChannelsEvent zapshowchannels = e as ZapShowChannelsEvent;
                break;
            }
            //ACDConnector
            switch (e.GetType().Name)
            {
            case "AgentCallbackLoginEvent":
                AgentCallbackLoginEvent agentcallbacklogin = e as AgentCallbackLoginEvent;
                break;

            case "AgentCallbackLogoffEvent":
                AgentCallbackLogoffEvent agentcallbacklogoff = e as AgentCallbackLogoffEvent;
                break;

            case "AgentCalledEvent":
                AgentCalledEvent agentcalled = e as AgentCalledEvent;
                break;

            case "AgentCompleteEvent":
                AgentCompleteEvent agentcomplete = e as AgentCompleteEvent;
                break;

            case "AgentConnectEvent":
                AgentConnectEvent agentconnect = e as AgentConnectEvent;
                break;

            case "AgentDumpEvent":
                AgentDumpEvent agentdump = e as AgentDumpEvent;
                break;

            case "AgentLoginEvent":
                AgentLoginEvent agentlogin = e as AgentLoginEvent;
                break;

            case "AgentLogoffEvent":
                AgentLogoffEvent agentlogoff = e as AgentLogoffEvent;
                break;

            case "AgentsCompleteEvent":
                AgentsCompleteEvent agentscomplete = e as AgentsCompleteEvent;
                break;

            case "AgentsEvent":
                AgentsEvent agentevent = e as AgentsEvent;
                break;

            case "QueueCallerAbandonEvent":
                QueueCallerAbandonEvent queuecallerabandon = e as QueueCallerAbandonEvent;
                break;

            case "QueueEntryEvent":
                QueueEntryEvent queueentry = e as QueueEntryEvent;
                break;

            case "QueueEvent":
                QueueEvent queue = e as QueueEvent;
                break;

            case "QueueMemberEvent":
                QueueMemberEvent queuemember = e as QueueMemberEvent;
                break;

            case "QueueMemberPausedEvent":
                QueueMemberPausedEvent queuememberpaused = e as QueueMemberPausedEvent;
                break;

            case "QueueMemberPenaltyEvent":
                QueueMemberPenaltyEvent queuememberpenalty = e as QueueMemberPenaltyEvent;
                break;

            case "QueueMemberRemovedEvent":
                QueueMemberRemovedEvent queuememberremoved = e as QueueMemberRemovedEvent;
                break;

            case "QueueMemberStatusEvent":
                QueueMemberStatusEvent queuememberstatus = e as QueueMemberStatusEvent;
                break;

            case "QueueParamsEvent":
                QueueParamsEvent queueparams = e as QueueParamsEvent;
                break;

            case "QueueStatusCompleteEvent":
                QueueStatusCompleteEvent queuestatuscomplete = e as QueueStatusCompleteEvent;
                break;
            }
        }
Example #26
0
 public override LineControl GetLineControl(LineControl lc)
 {
     return(_lcs.GetLineControl(lc));
 }
Example #27
0
 public LineControlResponse(LineControl lc, string tok)
 {
     linecontrol = lc;
     token       = tok;
 }
Example #28
0
 public LineControlResponse()
 {
     linecontrol = null;
     token       = null;
 }
Example #29
0
        public override void InitialiseControls()
        {
            var backgroundControl = new BackgroundControl {
                Position = Position, Padding = Padding
            };

            var topFlow = new FlowContainerControl {
                Position = Position, ShrinkToContents = true
            };

            var titleText = new LargeTextControl {
                Parameters = Form.Title
            };

            topFlow.Controls.Add(titleText);
            var lineControl = new LineControl();

            topFlow.Controls.Add(lineControl);

            var buttonFlowContainer = new FlowContainerControl {
                Position = Position, FlowDirection = FlowDirection.BottomUp, VerticalAlignment = VerticalAlignment.Bottom, ShrinkToContents = true
            };
            var buttonFlow = new FlowContainerControl {
                Position = Position, FlowDirection = FlowDirection.LeftToRight, ShrinkToContents = true, VerticalAlignment = VerticalAlignment.Bottom
            };

            buttonFlowContainer.Controls.Add(buttonFlow);

            Buttons = new List <ButtonControl>();
            foreach (var button in Form.Buttons.GetFlags())
            {
                var buttonControl = new ButtonControl {
                    Text = button.ToString(), Margin = new Padding(2)
                };
                buttonControl.OnClick += FormButtonControl_OnClick;
                buttonFlow.Controls.Add(buttonControl);
                Buttons.Add(buttonControl);
            }

            FormControls = new List <FormData>();
            foreach (var formField in Form.Fields)
            {
                var nameText = new TextControl {
                    Parameters = formField.Key + ": "
                };
                var formFieldControl = formField.Value;

                formFieldControl.OnClick += FormFieldControl_OnClick;
                FormControls.Add(formFieldControl);

                var subFlow = new FlowContainerControl {
                    FlowDirection = FlowDirection.LeftToRight, ShrinkToContents = true, Margin = new Padding {
                        Top = 1
                    }
                };
                subFlow.Controls.Add(nameText);
                subFlow.Controls.Add(formFieldControl);
                topFlow.Controls.Add(subFlow);
            }

            Controls.Add(backgroundControl);
            backgroundControl.Controls.Add(topFlow);
            backgroundControl.Controls.Add(buttonFlow);
        }
Example #30
0
        /// <summary>
        /// element选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GridElements_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var select = gridElements.SelectedValue;

            if (select != null)
            {
                WatchElement element = (WatchElement)select;
                foreach (UIElement item in canvasMain.Children)
                {
                    Selector.SetIsSelected(item, false);
                }
                if (element.DesignerControl.Visibility == Visibility.Visible)
                {
                    Selector.SetIsSelected(element.DesignerControl, true);
                }

                if (element.HWElement is HWImage)
                {
                    ImageControl image = new ImageControl();
                    image.WatchElement = element;
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(image);
                }
                else if (element.HWElement is HWBox)
                {
                    BoxControl boxControl = new BoxControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(boxControl);
                }
                else if (element.HWElement is HWLine)
                {
                    LineControl Line = new LineControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(Line);
                }
                else if (element.HWElement is HWCircle)
                {
                    CircleControl circelControl = new CircleControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(circelControl);
                }
                else if (element.HWElement is HWSelectImage)
                {
                    SelecteImageControl selecte = new SelecteImageControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(selecte);
                }
                else if (element.HWElement is HWTextareaWithOneWildCard)
                {
                    TextareaWithOneWildCardControl textCtrl = new TextareaWithOneWildCardControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(textCtrl);
                }
                else if (element.HWElement is HWTextareaWithTwoWildCard)
                {
                    TextareaWithTwoWildCardControl textCtrl = new TextareaWithTwoWildCardControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(textCtrl);
                }
                else if (element.HWElement is HWTextureMapper)
                {
                    TextureMapperControl texture = new TextureMapperControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(texture);
                }
                else
                {
                    gridAttribute.Children.Clear();
                }
            }
        }