コード例 #1
0
ファイル: QsysMeter.cs プロジェクト: RBSystems/Qsys
 private void Component_OnNewEvent(object sender, QsysInternalEventsArgs e)
 {
     QsysMeterEvent(this, new QsysEventsArgs(eQscEventIds.MeterUpdate, cName, Convert.ToBoolean(e.Value), Convert.ToInt16(e.Value), e.SValue, null));
 }
コード例 #2
0
        void Component_OnNewEvent(object sender, QsysInternalEventsArgs e)
        {
            switch (e.Name)
            {
            case "call_offhook":
                if (e.Value == 1)
                {
                    hookState = true;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerOffHook, cName, true, 1, "1", null));
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCurrentlyCalling, cName, true, currentlyCalling.Length, currentlyCalling, null));

                    if (onOffHookEvent != null)
                    {
                        onOffHookEvent(1);
                    }

                    if (onCurrentlyCallingEvent != null)
                    {
                        onCurrentlyCallingEvent(currentlyCalling);
                    }
                }
                else if (e.Value == 0)
                {
                    hookState = false;
                    dialString.Remove(0, dialString.Length);
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerOffHook, cName, false, 0, "0", null));

                    if (onOffHookEvent != null)
                    {
                        onOffHookEvent(0);
                    }


                    lastCalled       = currentlyCalling;
                    currentlyCalling = string.Empty;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCurrentlyCalling, cName, false, currentlyCalling.Length, currentlyCalling, null));
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialString, cName, false, 0, dialString.ToString(), null));

                    if (onCurrentlyCallingEvent != null)
                    {
                        onCurrentlyCallingEvent(currentlyCalling);
                    }

                    if (onDialStringEvent != null)
                    {
                        onDialStringEvent(dialString.ToString());
                    }
                }
                break;

            case "call_ringing":
                if (e.Value == 1)
                {
                    ringingState = true;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIsRinging, cName, true, 1, "1", null));

                    if (onRingingEvent != null)
                    {
                        onRingingEvent(1);
                    }
                }
                else if (e.Value == 0)
                {
                    ringingState = false;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIsRinging, cName, false, 0, "0", null));

                    if (onRingingEvent != null)
                    {
                        onRingingEvent(0);
                    }
                }
                break;

            case "call_autoanswer":
                autoAnswer = Convert.ToBoolean(e.Value);
                //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerAutoAnswerChange, cName, autoAnswer, Convert.ToInt16(e.Value), Convert.ToString(Convert.ToInt16(e.Value)), null));

                if (onAutoAnswerEvent != null)
                {
                    onAutoAnswerEvent(Convert.ToUInt16(e.Value));
                }

                break;

            case "call_dnd":
                dnd = Convert.ToBoolean(e.Value);
                //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDND_Change, cName, dnd, Convert.ToInt16(e.Value), Convert.ToString(Convert.ToInt16(e.Value)), null));

                if (onDndEvent != null)
                {
                    onDndEvent(Convert.ToUInt16(e.Value));
                }

                break;

            case "call_status":
                callStatus = e.SValue;
                //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCallStatusChange, cName, true, e.SValue.Length, e.SValue, null));

                if (onCurrentCallStatusChange != null)
                {
                    onCurrentCallStatusChange(e.SValue);
                }

                if (callStatus.Contains("Dialing") && dialingState == false)
                {
                    dialingState = true;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialing, cName, true, 1, "true", null));

                    if (onDialingEvent != null)
                    {
                        onDialingEvent(1);
                    }
                }
                else if (dialingState == true)
                {
                    dialingState = false;

                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialing, cName, false, 0, "false", null));

                    if (onDialingEvent != null)
                    {
                        onDialingEvent(0);
                    }
                }

                if (callStatus.Contains("Incoming Call"))
                {
                    incomingCall = true;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIncomingCall, cName, true, 1, "true", null));

                    if (onIncomingCallEvent != null)
                    {
                        onIncomingCallEvent(1);
                    }
                }
                else if (incomingCall == true)
                {
                    incomingCall = false;
                    //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIncomingCall, cName, false, 0, "false", null));

                    if (onIncomingCallEvent != null)
                    {
                        onIncomingCallEvent(0);
                    }
                }
                break;

            case "recent_calls":
                recentCalls.Clear();
                foreach (var choice in e.Choices)
                {
                    var newChoice = JsonConvert.DeserializeObject <ListBoxChoice>(choice);
                    recentCalls.Add(newChoice);
                }
                //QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerRecentCallsChange, cName, Convert.ToBoolean(recentCalls.Count), recentCalls.Count, recentCalls.Count.ToString(), recentCalls));

                if (onRecentCallsEvent != null)
                {
                    List <string> calls = new List <string>()
                    {
                        string.Empty, string.Empty, string.Empty, string.Empty, string.Empty
                    };

                    for (int i = 0; i <= 4; i++)
                    {
                        if (recentCalls.Count > i)
                        {
                            calls[i] = recentCalls[i].Text;
                        }
                        else
                        {
                            break;
                        }
                    }
                    onRecentCallsEvent(calls[0], calls[1], calls[2], calls[3], calls[4]);
                }
                if (onRecentCallListEvent != null)
                {
                    List <string> calls = new List <string>();

                    foreach (var call in calls)
                    {
                        var encodedBytes = XSig.GetBytes(calls.IndexOf(call), call);
                        onRecentCallListEvent(Encoding.GetEncoding(28591).GetString(encodedBytes, 0, encodedBytes.Length));
                    }
                }

                break;

            default:
                break;
            }
        }
コード例 #3
0
 internal void Fire(QsysInternalEventsArgs e)
 {
     onNewEvent(null, e);
 }
コード例 #4
0
ファイル: QsysMeter.cs プロジェクト: ryanww/Qsys
 private void Component_OnNewEvent(object sender, QsysInternalEventsArgs e)
 {
     QsysMeterEvent(this, new QsysEventsArgs(eQscEventIds.MeterUpdate, this.componentName, Convert.ToBoolean(e.changeResult.Value), e.changeResult.Value, e.changeResult.String));
 }
コード例 #5
0
        void Component_OnNewEvent(object sender, QsysInternalEventsArgs e)
        {
            currentSource = Convert.ToInt16(e.changeResult.Value);

            QsysNv32hDecoderEvent(this, new QsysEventsArgs(eQscEventIds.Nv32hDecoderInputChange, this.componentName, Convert.ToBoolean(currentSource), currentSource, currentSource.ToString()));
        }
コード例 #6
0
ファイル: QsysPotsController.cs プロジェクト: RBSystems/Qsys
        void QsysPotsController_OnNewEvent(object sender, QsysInternalEventsArgs e)
        {
            switch (e.Name)
            {
            case "call_offhook":
                if (e.Value == 1)
                {
                    hookState = true;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerOffHook, cName, true, 1, "1", null));
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCurrentlyCalling, cName, true, currentlyCalling.Length, currentlyCalling, null));
                }
                else if (e.Value == 0)
                {
                    hookState = false;
                    dialString.Remove(0, dialString.Length);
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerOffHook, cName, false, 0, "0", null));
                    lastCalled       = currentlyCalling;
                    currentlyCalling = string.Empty;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCurrentlyCalling, cName, false, currentlyCalling.Length, currentlyCalling, null));
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialString, cName, false, 0, dialString.ToString(), null));
                }
                break;

            case "call_ringing":
                if (e.Value == 1)
                {
                    ringingState = true;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIsRinging, cName, true, 1, "1", null));
                }
                else if (e.Value == 0)
                {
                    ringingState = false;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIsRinging, cName, false, 0, "0", null));
                }
                break;

            case "call_autoanswer":
                autoAnswer = Convert.ToBoolean(e.Value);
                QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerAutoAnswerChange, cName, autoAnswer, Convert.ToInt16(e.Value), Convert.ToString(Convert.ToInt16(e.Value)), null));
                break;

            case "call_dnd":
                dnd = Convert.ToBoolean(e.Value);
                QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDND_Change, cName, dnd, Convert.ToInt16(e.Value), Convert.ToString(Convert.ToInt16(e.Value)), null));
                break;

            case "call_status":
                callStatus = e.SValue;
                QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCallStatusChange, cName, true, e.SValue.Length, e.SValue, null));

                if (callStatus.Contains("Dialing") && dialingState == false)
                {
                    dialingState = true;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialing, cName, true, 1, "true", null));
                }
                else if (dialingState == true)
                {
                    dialingState = false;

                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialing, cName, false, 0, "false", null));
                }

                if (callStatus.Contains("Incoming Call"))
                {
                    incomingCall = true;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIncomingCall, cName, true, 1, "true", null));
                }
                else if (incomingCall == true)
                {
                    incomingCall = false;
                    QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerIncomingCall, cName, false, 0, "false", null));
                }
                break;

            case "recent_calls":
                recentCalls.Clear();
                List <string> choices = e.Choices;
                foreach (var choice in choices)
                {
                    var newChoice = JsonConvert.DeserializeObject <ListBoxChoice>(choice);
                    recentCalls.Add(newChoice);
                }
                QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerRecentCallsChange, cName, Convert.ToBoolean(recentCalls.Count), recentCalls.Count, recentCalls.Count.ToString(), recentCalls));
                break;

            default:
                break;
            }
        }
コード例 #7
0
        void Control_OnNewEvent(object _sender, QsysInternalEventsArgs _e)
        {
            if (_e.changeResult.String != null)
            {
                this.controlString = _e.changeResult.String;
            }

            if (_e.changeResult.Value != null)
            {
                this.controlValue = _e.changeResult.Value;
            }

            if (_e.changeResult.Position != null)
            {
                this.controlPosition = _e.changeResult.Position;
            }

            //if (_e.changeResult.Color != null)
            //    ; //later

            if (_e.changeResult.Indeterminate != null)
            {
                this.controlIndeterminate = _e.changeResult.Indeterminate;
            }

            if (_e.changeResult.Invisible != null)
            {
                this.controlInvisible = _e.changeResult.Invisible;
            }

            if (_e.changeResult.Disabled != null)
            {
                this.controlDisabled = _e.changeResult.Disabled;
            }

            //legend
            //changes

            switch (this.controlType)
            {
            case eControlType.isIntegerValue:
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, "[[VAL]]", false, this.controlValue, this.controlString));
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, "[[POS]]", false, this.controlPosition, ""));
                break;

            case eControlType.isFloatValue:
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, "[[VAL]]", false, this.controlValue, this.controlString));
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, "[[POS]]", false, this.controlPosition, ""));
                break;

            case eControlType.isButton:
                this.controlBool = Convert.ToBoolean(this.controlValue);
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, this.controlName, this.controlBool, Convert.ToInt16(this.controlBool), Convert.ToString(this.controlBool)));
                break;

            case eControlType.isTrigger:
                this.controlBool = false;
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, this.controlName, false, 0, ""));
                break;

            case eControlType.isString:
                QsysNamedControlEvent(this, new QsysEventsArgs(eQscEventIds.NamedControl, this.controlName, false, 0, this.controlString));
                break;
            }
        }
コード例 #8
0
        void Component_OnNewEvent(object _sender, QsysInternalEventsArgs _e)
        {
            switch (_e.changeResult.Name)
            {
            case "call_offhook":
                if (_e.changeResult.Value == 1)
                {
                    this.hookState = true;
                    this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerOffHook, this.componentName, true, 1, "1"));
                }
                else if (_e.changeResult.Value == 0)
                {
                    this.hookState = false;
                    this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerOffHook, this.componentName, false, 0, "0"));
                }
                break;

            case "call_ringing":
                if (_e.changeResult.Value == 1)
                {
                    this.ringingState = true;
                }
                else
                {
                    this.ringingState = false;
                }
                CallStatusLogic();
                break;

            case "call_autoanswer":
                this.autoAnswer = Convert.ToBoolean(_e.changeResult.Value);
                this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerAutoAnswerChange, this.componentName, this.autoAnswer, Convert.ToInt16(_e.changeResult.Value), Convert.ToString(Convert.ToInt16(_e.changeResult.Value))));
                break;

            case "call_dnd":
                this.dnd = Convert.ToBoolean(_e.changeResult.Value);
                this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDND_Change, this.componentName, this.dnd, Convert.ToInt16(_e.changeResult.Value), Convert.ToString(Convert.ToInt16(_e.changeResult.Value))));
                break;

            case "call_cid_name":
                this.cidName = _e.changeResult.String;
                this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCID, this.componentName, false, 0, this.cidName));
                break;

            case "call_cid_number":
                this.cidNumber = _e.changeResult.String;
                this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerCID, this.componentName, false, 1, this.cidNumber));
                break;

            case "call_number":
                this.dialString = _e.changeResult.String;
                this.QsysPotsControllerEvent(this, new QsysEventsArgs(eQscEventIds.PotsControllerDialString, this.componentName, false, 0, this.dialString));
                break;

            case "call_status":
                this.progressState = _e.changeResult.String;
                CallStatusLogic();
                break;


            default:
                break;
            }
        }