private void handle_event()
        {
            IntelligentEvent evt = MiddleWareCore.get_a_event();

            if (evt != null)
            {
                IntelligentEvent IEvent         = (IntelligentEvent)evt;
                string           epcID          = IEvent.epcID;
                string           remoteDeviceID = IEvent.remoteDeviceID;
                string           check_time     = IEvent.time_stamp;
                string           studentName    = string.Empty;
                string           question_value = IEvent.questionValue.ToUpper();;

                //终端发送的答案必须符合要求 A B C 或者 D

                if (question_value != "A" && question_value != "B" && question_value != "C" && question_value != "D")
                {
                    return;
                }

                //1 更改本地信息
                //2 更改饼图
                //3 更改座位状态

                int totalCount = MemoryTable.studentInfoTable.Rows.Count;

                Person            person = MemoryTable.getPersonByEpc(epcID);
                equipmentPosition ep     = MemoryTable.getEquipmentConfigMapInfoByDeviceID(remoteDeviceID);
                if (ep != null)
                {
                    if (IEvent.event_unit_list.IndexOf(IntelligentEventUnit.epc_on_another_device) >= 0)
                    {
                        ////这里要处理一下同一个学生用不一个设备发送答案的情况
                        equipmentPosition ep_old = MemoryTable.getEquipmentInfoByEpc(epcID);
                        this.setChairState(ep_old, DocumentFileState.InitialState, "");
                        MemoryTable.clearEquipmentAndStudentCombining(epcID);
                    }

                    if (person != null)
                    {
                        studentName = person.name;
                        this.setChairState(ep, studentName);
                        MemoryTable.setEquipmentInfoCombineStudentID(ep, person.epc);
                        this.setPersonAnswer(person.id_num, question_value);
                    }


                    DocumentFileState dfs = this.getStateByAnswer(question_value);
                    this.setChairState(ep, dfs);

                    this.refreshPie();
                }
            }
        }
        public void setColorStyle(string docName, DocumentFileState _state)
        {
            bool bFind = false;

            foreach (CarbinetFloor cf in this.floors)
            {
                foreach (DocumentFile df in cf.documentList)
                {
                    if (df.name == docName)
                    {
                        df.setColorStyle(_state);
                        bFind = true;
                        break;
                    }
                }
                if (bFind)
                {
                    break;
                }
            }
        }
        public void setColorStyle(DocumentFileState _state)
        {
            MetroFramework.MetroColorStyle style = MetroFramework.MetroColorStyle.Blue;
            switch (_state)
            {
            case DocumentFileState.InitialState:
                style = MetroFramework.MetroColorStyle.Blue;
                break;

            case DocumentFileState.Green:
                style = MetroFramework.MetroColorStyle.Green;
                break;

            case DocumentFileState.Orange:
                style = MetroFramework.MetroColorStyle.Orange;
                break;

            case DocumentFileState.Red:
                style = MetroFramework.MetroColorStyle.Red;
                break;
            }
            this.doc.Style = style;
        }
        private DocumentFileState getStateByAnswer(string answer)
        {
            DocumentFileState dfs = DocumentFileState.InitialState;

            switch (answer)
            {
            case "A":
                dfs = DocumentFileState.Green;
                break;

            case "B":
                dfs = DocumentFileState.Orange;
                break;

            case "C":
                dfs = DocumentFileState.Red;
                break;

            case "D":
                dfs = DocumentFileState.Blue;
                break;
            }
            return(dfs);
        }
 private void setChairState(equipmentPosition ep, DocumentFileState dfs)
 {
     Program.frmClassRoom.changeChairState(ep.group, ep.formatedPosition(), dfs);
 }
Example #6
0
        public void changeChairState(int _groupIndex, string _equipmentID, DocumentFileState _state)
        {
            Carbinet _carbinet = this.groups[_groupIndex];

            _carbinet.setColorStyle(_equipmentID, _state);
        }
Example #7
0
        /*
         * 对于一个本页面来说,只需要接受改变具体某个座位状态的能力即可
         * 将某个座位设置为枚举的状态
         * 座位上的文字的改变
         * 座位恢复为初始状态
         */
        public void changeChairState(int _groupIndex, int _rowIndex, int _columnIndex, DocumentFileState _state, string _text)
        {
            string id = string.Format("{0},{1},{2}", _groupIndex, _rowIndex, _columnIndex);

            changeChairState(_groupIndex, id, _text);
            changeChairState(_groupIndex, id, _state);
        }