public Approach_DetailContent()
        {
            InitializeComponent();

            this.Group = "畢業學生進路";
            _RunningKey = "";

            this.Load += new EventHandler(Form_Load);
            this.form_loaded = false;
            _Errors = new ErrorProvider();
            _Listener = new ChangeListener();
            _Listener.Add(new DataGridViewSource(this.dgvData));
            _Listener.Add(new TextBoxSource(this.txtSurveyYear));
            _Listener.Add(new TextBoxSource(this.txtMemo));
            _Listener.StatusChanged += new EventHandler<ChangeEventArgs>(Listener_StatusChanged);

            this.dgvData.CellEnter += new DataGridViewCellEventHandler(dgvData_CellEnter);
            this.dgvData.CurrentCellDirtyStateChanged += new EventHandler(dgvData_CurrentCellDirtyStateChanged);
            this.dgvData.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(dgvData_EditingControlShowing);
            this.dgvData.DataError += new DataGridViewDataErrorEventHandler(dgvData_DataError);
            this.dgvData.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_ColumnHeaderMouseClick);
            this.dgvData.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_RowHeaderMouseClick);
            this.dgvData.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dgvData_MouseClick);

            _BGWLoadData = new BackgroundWorker();
            _BGWLoadData.DoWork += new DoWorkEventHandler(_BGWLoadData_DoWork);
            _BGWLoadData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWLoadData_RunWorkerCompleted);

            _BGWSaveData = new BackgroundWorker();
            _BGWSaveData.DoWork += new DoWorkEventHandler(_BGWSaveData_DoWork);
            _BGWSaveData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWSaveData_RunWorkerCompleted);
        }
        public StudABCard04Content()
        {
            InitializeComponent();
            _StudentIDList = new List<string>();
            _dataDict = new Dictionary<string, UDTSingleRecordDef>();
            _txtControlTag = new Dictionary<string, string>();
            _insertDataList = new List<UDTSingleRecordDef>();
            _updateDataList = new List<UDTSingleRecordDef>();
            _bgWorker = new BackgroundWorker();

            _bgWorker.DoWork += new DoWorkEventHandler(_bgWorker_DoWork);
            _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
            this.Group = "綜合表現紀錄表-自傳";

            setTabIndex();
            SetControlTag();
            _ChangeListener = new ChangeListener();
            _ChangeListener.StatusChanged += new EventHandler<ChangeEventArgs>(_ChangeListener_StatusChanged);
            // 加入 listener
            foreach (Control cr in this.Controls)
            {
                if (cr is TextBoxX)
                {
                    TextBoxX tb = cr as TextBoxX;
                    _ChangeListener.Add(new TextBoxSource(tb));
                }
            }
        }
Exemple #3
0
        public StudABCard04Content()
        {
            InitializeComponent();

            _StudentIDList  = new List <string>();
            _dataDict       = new Dictionary <string, UDTSingleRecordDef>();
            _txtControlTag  = new Dictionary <string, string>();
            _insertDataList = new List <UDTSingleRecordDef>();
            _updateDataList = new List <UDTSingleRecordDef>();
            _bgWorker       = new BackgroundWorker();

            _bgWorker.DoWork             += new DoWorkEventHandler(_bgWorker_DoWork);
            _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
            this.Group = "綜合表現紀錄表-自傳";

            setTabIndex();
            SetControlTag();
            _ChangeListener = new ChangeListener();
            _ChangeListener.StatusChanged += new EventHandler <ChangeEventArgs>(_ChangeListener_StatusChanged);
            // 加入 listener
            foreach (Control cr in this.Controls)
            {
                if (cr is TextBoxX)
                {
                    TextBoxX tb = cr as TextBoxX;
                    _ChangeListener.Add(new TextBoxSource(tb));
                }
            }
        }
        public async Task StopPath1()
        {
            //Arrange
            LogEntry logEntry = null;
            var      log      = new StubIFeedback <LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntry = e;
                    return(Task.FromResult(0));
                }
            };
            var cts = new CancellationTokenSource();
            var tm  = new ChangeListener(log, new UnitTestDbConnection());

            //Act
            await tm.StartAsync(cts.Token);

            await tm.StopAsync(cts.Token);

            //Assert
            Assert.IsTrue(logEntry.Level == LogEntryLevel.Info);
            Assert.IsTrue(logEntry.Message.Contains("stopped"), "Manger not started or word started not in the log.");
        }
Exemple #5
0
        public BaseInfoPalmerwormItem()
        {
            InitializeComponent();
            Group         = "基本資料";
            _DataListener = new ChangeListener();
            _DataListener.Add(new TextBoxSource(txtName));
            _DataListener.Add(new TextBoxSource(txtSSN));
            _DataListener.Add(new TextBoxSource(txtBirthDate));
            _DataListener.Add(new TextBoxSource(txtBirthPlace));
            _DataListener.Add(new TextBoxSource(txtEngName));
            _DataListener.Add(new TextBoxSource(txtLoginID));
            _DataListener.Add(new TextBoxSource(txtLoginPwd));
            _DataListener.Add(new ComboBoxSource(cboGender, ComboBoxSource.ListenAttribute.Text));
            _DataListener.Add(new ComboBoxSource(cboNationality, ComboBoxSource.ListenAttribute.Text));
            _DataListener.Add(new ComboBoxSource(cboAccountType, ComboBoxSource.ListenAttribute.Text));
            _DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(_DataListener_StatusChanged);

            _BGWorker                     = new BackgroundWorker();
            _BGWorker.DoWork             += new DoWorkEventHandler(_BGWorker_DoWork);
            _BGWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWorker_RunWorkerCompleted);
            prlp = new PermRecLogProcess();
            Initialize();
            JHStudent.AfterChange += new EventHandler <K12.Data.DataChangedEventArgs>(JHStudent_AfterChange);
            JHStudent.AfterDelete += new EventHandler <K12.Data.DataChangedEventArgs>(JHStudent_AfterDelete);
            Disposed += new EventHandler(BaseInfoPalmerwormItem_Disposed);
        }
Exemple #6
0
        public Approach_DetailContent()
        {
            InitializeComponent();

            this.Group  = "畢業學生進路";
            _RunningKey = "";

            this.Load       += new EventHandler(Form_Load);
            this.form_loaded = false;
            _Errors          = new ErrorProvider();
            _Listener        = new ChangeListener();
            _Listener.Add(new DataGridViewSource(this.dgvData));
            _Listener.Add(new TextBoxSource(this.txtSurveyYear));
            _Listener.Add(new TextBoxSource(this.txtMemo));
            _Listener.StatusChanged += new EventHandler <ChangeEventArgs>(Listener_StatusChanged);

            this.dgvData.CellEnter += new DataGridViewCellEventHandler(dgvData_CellEnter);
            this.dgvData.CurrentCellDirtyStateChanged += new EventHandler(dgvData_CurrentCellDirtyStateChanged);
            this.dgvData.EditingControlShowing        += new DataGridViewEditingControlShowingEventHandler(dgvData_EditingControlShowing);
            this.dgvData.DataError += new DataGridViewDataErrorEventHandler(dgvData_DataError);
            this.dgvData.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_ColumnHeaderMouseClick);
            this.dgvData.RowHeaderMouseClick    += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_RowHeaderMouseClick);
            this.dgvData.MouseClick             += new System.Windows.Forms.MouseEventHandler(this.dgvData_MouseClick);

            _BGWLoadData                     = new BackgroundWorker();
            _BGWLoadData.DoWork             += new DoWorkEventHandler(_BGWLoadData_DoWork);
            _BGWLoadData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWLoadData_RunWorkerCompleted);

            _BGWSaveData                     = new BackgroundWorker();
            _BGWSaveData.DoWork             += new DoWorkEventHandler(_BGWSaveData_DoWork);
            _BGWSaveData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWSaveData_RunWorkerCompleted);
        }
        public BaseInfoPalmerwormItem()
        {
            InitializeComponent();
            Group = "基本資料";
            _DataListener = new ChangeListener();
            _DataListener.Add(new TextBoxSource(txtName));
            _DataListener.Add(new TextBoxSource(txtSSN));
            _DataListener.Add(new TextBoxSource(txtBirthDate));
            _DataListener.Add(new TextBoxSource(txtBirthPlace));
            _DataListener.Add(new TextBoxSource(txtEngName));
            _DataListener.Add(new TextBoxSource(txtLoginID));
            _DataListener.Add(new TextBoxSource(txtLoginPwd));
            _DataListener.Add(new ComboBoxSource(cboGender, ComboBoxSource.ListenAttribute.Text));
            _DataListener.Add(new ComboBoxSource(cboNationality, ComboBoxSource.ListenAttribute.Text));
            _DataListener.Add(new ComboBoxSource(cboAccountType, ComboBoxSource.ListenAttribute.Text));
            _DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(_DataListener_StatusChanged);

            _BGWorker = new BackgroundWorker();
            _BGWorker.DoWork += new DoWorkEventHandler(_BGWorker_DoWork);
            _BGWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWorker_RunWorkerCompleted);
            prlp = new PermRecLogProcess();
            Initialize();
            K12.Data.Student.AfterChange += Student_AfterChange;
            K12.Data.Student.AfterDelete += Student_AfterDelete;
            Disposed += BaseInfoPalmerwormItem_Disposed;
        }
        public ClubRestrictItem()
        {
            InitializeComponent();

            Group = "選社限制";

            UserPermission = UserAcl.Current[FISCA.Permission.FeatureCodeAttribute.GetCode(GetType())];
            this.Enabled   = UserPermission.Editable;

            BGW.DoWork             += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            Save_BGW.DoWork             += new DoWorkEventHandler(Save_BGW_DoWork);
            Save_BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Save_BGW_RunWorkerCompleted);

            ClubEvents.ClubChanged += new EventHandler(ClubEvents_ClubChanged);

            DataListener = new ChangeListener();
            DataListener.Add(new TextBoxSource(tbGrade1Limit));
            DataListener.Add(new TextBoxSource(tbGrade2Limit));
            DataListener.Add(new TextBoxSource(tbGrade3Limit));
            DataListener.Add(new TextBoxSource(tbLimit));
            DataListener.Add(new ComboBoxSource(cbGenderRestrict, ComboBoxSource.ListenAttribute.SelectedIndex));
            DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(DataListener_StatusChanged);
        }
Exemple #9
0
        public StudABCard01Content()
        {
            InitializeComponent();

            _StudenIDList   = new List <string>();
            _udtMrFlp01Dict = new Dictionary <string, UDTMultipleRecordDef>();
            _udtMrFlp02Dict = new Dictionary <string, UDTMultipleRecordDef>();

            _QDMang       = new ABCardQuestionDataManager();
            _QuestionDict = _QDMang.GetQuestionDataByGroupName(GroupName);
            this.Group    = "綜合表現紀錄表-本人概況";
            _bgWorker     = new BackgroundWorker();

            List <string> grYear = Utility.GetClassGradeYear();

            if (grYear.Count > 3)
            {
                SetDgColumn4_6Visable(true);
            }
            else
            {
                SetDgColumn4_6Visable(false);
            }

            _ChangeManager = new ChangeListener();
            _ChangeManager.StatusChanged += new EventHandler <ChangeEventArgs>(_ChangeManager_StatusChanged);
            LoadQuestionToUI();
            _bgWorker.DoWork             += new DoWorkEventHandler(_bgWorker_DoWork);
            _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
            EventHub.CounselChanged      += new EventHandler(EventHub_CounselChanged);
        }
Exemple #10
0
        public TeacherItem()
        {
            InitializeComponent();
            Group                       = "教師基本資料_雙語部";
            _BGWork                     = new BackgroundWorker();
            _BGWork.DoWork             += new DoWorkEventHandler(_BGWork_DoWork);
            _BGWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWork_RunWorkerCompleted);
            _AllTeacherNameDic          = new Dictionary <string, string>();
            _AllLogIDDic                = new Dictionary <string, string>();
            prlp          = new K12StudentPhoto.PermRecLogProcess();
            _DataListener = new ChangeListener();
            _DataListener.Add(new TextBoxSource(txtName));
            _DataListener.Add(new TextBoxSource(txtIDNumber));
            _DataListener.Add(new TextBoxSource(txtNickname));
            _DataListener.Add(new TextBoxSource(txtPhone));
            _DataListener.Add(new TextBoxSource(txtEmail));
            _DataListener.Add(new TextBoxSource(txtCategory));
            _DataListener.Add(new TextBoxSource(txtSTLoginAccount));
            _DataListener.Add(new TextBoxSource(txtSTLoginPwd));
            _DataListener.Add(new TextBoxSource(txtCellPhone));
            _DataListener.Add(new ComboBoxSource(cboAccountType, ComboBoxSource.ListenAttribute.Text));
            _DataListener.Add(new ComboBoxSource(cboGender, ComboBoxSource.ListenAttribute.Text));
            _DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(_DataListener_StatusChanged);
            cboGender.DropDownStyle      = ComboBoxStyle.DropDownList;
            JHTeacher.AfterChange       += new EventHandler <K12.Data.DataChangedEventArgs>(JHTeacher_AfterChange);
            JHTeacher.AfterDelete       += new EventHandler <K12.Data.DataChangedEventArgs>(JHTeacher_AfterDelete);
            Disposed += new EventHandler(BaseInfoItem_Disposed);

            //啟動更新事件
            eh = FISCA.InteractionService.PublishEvent(EventCord);
        }
        public PhonePalmerwormItem()
            : base()
        {
            InitializeComponent();
            DataListener = new ChangeListener();
            DataListener.Add(new TextBoxSource(txtEverPhone));
            DataListener.Add(new TextBoxSource(txtContactPhone));
            DataListener.Add(new TextBoxSource(txtSMS));
            DataListener.Add(new TextBoxSource(txtOtherPhone));
            DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(DataListener_StatusChanged);


            Group = "電話資料";
            //skypeProxy = new SkypeControl.SkypeProxy();
            //skypeProxy.CountryInfo = new SkypeControl.CountryInfo("886", "台灣");
            //skypeProxy.OnSkypeStatusChange += new SkypeControl.SkypeStatusChangeHandler(skypeProxy_OnSkypeStatusChange);
            //skypeProxy_OnSkypeStatusChange(null, null);

            _bwWork                     = new BackgroundWorker();
            _bwWork.DoWork             += new DoWorkEventHandler(_bwWork_DoWork);
            _bwWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bwWork_RunWorkerCompleted);

            JHPhone.AfterUpdate += new EventHandler <K12.Data.DataChangedEventArgs>(JHPhone_AfterUpdate);
            prlp      = new PermRecLogProcess();
            Disposed += new EventHandler(PhonePalmerwormItem_Disposed);
        }
        public Approach_DetailContent()
        {
            InitializeComponent();

            Access = new AccessHelper();
            Query = new QueryHelper();
            dicSurveyFields = new Dictionary<decimal, IEnumerable<string>>();

            this.Group = "畢業學生進路";
            _RunningKey = "";

            this.Load += new EventHandler(Form_Load);
            this.form_loaded = false;
            _Errors = new ErrorProvider();
            _Listener = new ChangeListener();
            _Listener.Add(new DataGridViewSource(this.dgvData));
            _Listener.Add(new TextBoxSource(this.txtMemo));
            _Listener.Add(new NumericUpDownSource(this.txtSurveyYear));
            _Listener.StatusChanged += new EventHandler<ChangeEventArgs>(Listener_StatusChanged);

            this.dgvData.CellEnter += new DataGridViewCellEventHandler(dgvData_CellEnter);
            this.dgvData.CurrentCellDirtyStateChanged += new EventHandler(dgvData_CurrentCellDirtyStateChanged);
            this.dgvData.DataError += new DataGridViewDataErrorEventHandler(dgvData_DataError);
            this.dgvData.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_ColumnHeaderMouseClick);
            this.dgvData.RowHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_RowHeaderMouseClick);
            this.dgvData.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dgvData_MouseClick);

            _BGWLoadData = new BackgroundWorker();
            _BGWLoadData.DoWork += new DoWorkEventHandler(_BGWLoadData_DoWork);
            _BGWLoadData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWLoadData_RunWorkerCompleted);

            _BGWSaveData = new BackgroundWorker();
            _BGWSaveData.DoWork += new DoWorkEventHandler(_BGWSaveData_DoWork);
            _BGWSaveData.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWSaveData_RunWorkerCompleted);
        }
        public AssessmentSetupManager()
        {
            InitializeComponent();
            HideNavigationBar();

            //AssessmentSetup.Instance.ItemUpdated += delegate(object sender, ItemUpdatedEventArgs e)
            //{
            //    if (e.PrimaryKeys.Count > 0)
            //        RefreshItemPanel(e.PrimaryKeys[0]);
            //};
            JHAssessmentSetup.AfterDelete += new EventHandler <K12.Data.DataChangedEventArgs>(JHAssessmentSetup_AfterChanged);
            JHAssessmentSetup.AfterInsert += new EventHandler <K12.Data.DataChangedEventArgs>(JHAssessmentSetup_AfterChanged);
            JHAssessmentSetup.AfterUpdate += new EventHandler <K12.Data.DataChangedEventArgs>(JHAssessmentSetup_AfterChanged);

            _errors = new EnhancedErrorProvider();
            _exam   = new List <JHExamRecord>();
            //_as = new List<JHAssessmentSetupRecord>();
            _listener = new ChangeListener();
            _listener.StatusChanged += new EventHandler <ChangeEventArgs>(Listener_StatusChanged);
            _listener.Add(new DataGridViewSource(dataview));
            _listener.Add(new TextBoxSource(txtOStartTime));
            _listener.Add(new TextBoxSource(txtOEndTime));
            _listener.Add(new TextBoxSource(txtTStartTime));
            _listener.Add(new TextBoxSource(txtTEndTime));
        }
Exemple #14
0
        private void ClassItem_Load(object sender, EventArgs e)
        {
            Errors           = new EnhancedErrorProvider();
            _ClassNameIDDic  = new Dictionary <string, string>();
            _ClassSeatNoList = new List <int>();

            JHSchool.Data.JHStudent.AfterChange += new EventHandler <K12.Data.DataChangedEventArgs>(JHStudent_AfterChange);

            objStudent                 = JHSchool.Data.JHStudent.SelectByID(PrimaryKey);
            _AllClassRecs              = JHSchool.Data.JHClass.SelectAll();
            _AllStudRecList            = new List <JHSchool.Data.JHStudentRecord>();
            _studRecList               = new List <JHSchool.Data.JHStudentRecord>();
            BGWork                     = new BackgroundWorker();
            BGWork.DoWork             += new DoWorkEventHandler(BGWork_DoWork);
            BGWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGWork_RunWorkerCompleted);

            DataListener = new ChangeListener();
            DataListener.Add(new TextBoxSource(txtStudentNumber));
            DataListener.Add(new ComboBoxSource(cboClass, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cboSeatNo, ComboBoxSource.ListenAttribute.Text));
            DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(ValueManager_StatusChanged);
            prlp = new PermRecLogProcess();

            if (!string.IsNullOrEmpty(PrimaryKey))
            {
                BGWork.RunWorkerAsync();
            }

            Disposed += new EventHandler(ClassItem_Disposed);
        }
 public BaseInfoItem()
 {
     InitializeComponent();
     Group = "教師基本資料";
     _BGWork = new BackgroundWorker();
     _BGWork.DoWork += new DoWorkEventHandler(_BGWork_DoWork);
     _BGWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWork_RunWorkerCompleted);
     _AllTeacherNameDic = new Dictionary<string, string>();
     _AllLogIDDic = new Dictionary<string, string>();
     prlp = new PermRecLogProcess();
     _DataListener = new ChangeListener();
     _DataListener.Add(new TextBoxSource(txtName));
     _DataListener.Add(new TextBoxSource(txtIDNumber));
     _DataListener.Add(new TextBoxSource(txtNickname));
     _DataListener.Add(new TextBoxSource(txtPhone));
     _DataListener.Add(new TextBoxSource(txtEmail));
     _DataListener.Add(new TextBoxSource(txtCategory));
     _DataListener.Add(new TextBoxSource(txtSTLoginAccount));
     _DataListener.Add(new TextBoxSource(txtSTLoginPwd));
     _DataListener.Add(new ComboBoxSource(cboAccountType, ComboBoxSource.ListenAttribute.Text));
     _DataListener.Add(new ComboBoxSource(cboGender, ComboBoxSource.ListenAttribute.Text));
     _DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(_DataListener_StatusChanged);
     cboGender.DropDownStyle = ComboBoxStyle.DropDownList;
     K12.Data.Teacher.AfterChange += new EventHandler<K12.Data.DataChangedEventArgs>(JHTeacher_AfterChange);
     K12.Data.Teacher.AfterDelete += new EventHandler<K12.Data.DataChangedEventArgs>(JHTeacher_AfterDelete);
     Disposed += new EventHandler(BaseInfoItem_Disposed);
 }
 public BasicInfoItem()
 {
     _ClassIDNameDict = new Dictionary<string, string>();
     _ClassNameIDDict = new Dictionary<string, string>();
     _TeacherIDNameDict = new Dictionary<string, string>();
     _TeacherNameIDDict = new Dictionary<string, string>();
     _TCInstructRecordList = new List<K12.Data.TCInstructRecord>();
     _bgWorker = new BackgroundWorker();
     _bgWorker.DoWork += _bgWorker_DoWork;
     _bgWorker.RunWorkerCompleted += _bgWorker_RunWorkerCompleted;
     InitializeComponent();
     Group = "基本資料";
     // 檢查資料是否變更
     _DataListener = new ChangeListener();
     _DataListener.Add(new TextBoxSource(txtCourseName));
     _DataListener.Add(new TextBoxSource(txtSubject));
     _DataListener.Add(new TextBoxSource(txtPeriodCredit));
     _DataListener.Add(new ComboBoxSource(cboClass,ComboBoxSource.ListenAttribute.Text));
     _DataListener.Add(new ComboBoxSource(cboMultiTeacher, ComboBoxSource.ListenAttribute.Text));
     _DataListener.Add(new ComboBoxSource(cbxSchoolYear, ComboBoxSource.ListenAttribute.Text));
     _DataListener.Add(new ComboBoxSource(cbxSemester, ComboBoxSource.ListenAttribute.Text));
     _DataListener.StatusChanged += _DataListener_StatusChanged;
     K12.Data.Course.AfterChange += Course_AfterChange;
     K12.Data.Course.AfterDelete += Course_AfterDelete;
     Disposed += new EventHandler(BaseInfoItem_Disposed);
 }
Exemple #17
0
        public AssessmentSetupManager()
        {
            InitializeComponent();
            HideNavigationBar();

            List <string> cols = new List <string>()
            {
                "比重", "開始時間", "結束時間"
            };

            Campus.Windows.DataGridViewImeDecorator dec = new Campus.Windows.DataGridViewImeDecorator(this.dataview, cols);


            JHAssessmentSetup.AfterDelete += new EventHandler <K12.Data.DataChangedEventArgs>(JHAssessmentSetup_AfterChanged);
            JHAssessmentSetup.AfterInsert += new EventHandler <K12.Data.DataChangedEventArgs>(JHAssessmentSetup_AfterChanged);
            JHAssessmentSetup.AfterUpdate += new EventHandler <K12.Data.DataChangedEventArgs>(JHAssessmentSetup_AfterChanged);

            _errors   = new EnhancedErrorProvider();
            _exam     = new List <JHExamRecord>();
            OriginAEs = new List <JHAEIncludeRecord>();

            Listener = new ChangeListener();
            Listener.StatusChanged += new EventHandler <ChangeEventArgs>(Listener_StatusChanged);
            Listener.Add(new DataGridViewSource(dataview));
            Listener.Add(new TextBoxSource(txtOStartTime));
            Listener.Add(new TextBoxSource(txtOEndTime));
            Listener.Add(new TextBoxSource(txtTStartTime));
            Listener.Add(new TextBoxSource(txtTEndTime));
            Listener.Reset();
        }
    public bool RemoveChangeListener(ChangeCallback callback, object userData)
    {
        ChangeListener item = new ChangeListener();

        item.SetCallback(callback);
        item.SetUserData(userData);
        return(this.m_changeListeners.Remove(item));
    }
 public void ConstructorTest()
 {
     //arrange 
     //act
     var result = new ChangeListener(new StubIFeedback<LogEntry>(), new ZvsEntityContextConnection());
     //assert 
     Assert.IsNotNull(result);
 }
 private void RunAsyncListener(ChangeListener listener)
 {
     listener.BeginInvoke((ar) =>
     {
         AsyncResult result    = (AsyncResult)ar;
         ChangeListener caller = (ChangeListener)result.AsyncDelegate;
         caller.EndInvoke(ar);
     }, null);
 }
Exemple #21
0
        public void AddChangeListener(ChangeListener listener, bool callListener)
        {
            SubscribeToChangeListener(listener);

            if (callListener)
            {
                listener(this, GameValueChangedComponent.All, 0, 0);
            }
        }
        public void ConstructorTest()
        {
            //arrange
            //act
            var result = new ChangeListener(new StubIFeedback <LogEntry>(), new UnitTestDbConnection());

            //assert
            Assert.IsNotNull(result);
        }
Exemple #23
0
        protected internal virtual void fireStateChanged()
        {
            ChangeEvent changeEvent = new ChangeEvent(this);
            Iterator    iterator    = this.__listeners.iterator();

            while (iterator.hasNext())
            {
                ChangeListener changeListener = (ChangeListener)iterator.next();
                changeListener.stateChanged(changeEvent);
            }
        }
Exemple #24
0
        public GraduationScoreItem()
        {
            InitializeComponent();
            InitializeBackgroundWorker();
            InitializeDomains();

            _listener = new ChangeListener();
            _listener.Add(new DataGridViewSource(dgv));

            _listener.StatusChanged += new EventHandler <ChangeEventArgs>(Listener_StatusChanged);
        }
        public StudentFitnessContent()
        {
            InitializeComponent();
            // 資料項目名稱
            this.Group = "體適能";

            _bgWorker = new BackgroundWorker();
            _ChangeListener = new ChangeListener();
            _bgWorker.DoWork += new DoWorkEventHandler(_bgWorker_DoWork);
            _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
            _ChangeListener.StatusChanged += new EventHandler<ChangeEventArgs>(_ChangeListener_StatusChanged);
        }
    public bool AddChangeListener(ChangeCallback callback, object userData)
    {
        ChangeListener item = new ChangeListener();

        item.SetCallback(callback);
        item.SetUserData(userData);
        if (this.m_changeListeners.Contains(item))
        {
            return(false);
        }
        this.m_changeListeners.Add(item);
        return(true);
    }
Exemple #27
0
        public static void Load()
        {
            try
            {
                string content = File.ReadAllText(configPath);
                Instance = JsonConvert.DeserializeObject <Models.ConfigData>(content);
            }
            catch { }

            var listener = ChangeListener.Create(Instance);

            listener.PropertyChanged   += (_, e) => Save();
            listener.CollectionChanged += (_, e) => Save();
        }
        public EmergencyDetailContent()
        {
            InitializeComponent();
            this.Group = "緊急聯絡人";
            _bgWorker  = new BackgroundWorker();

            _bgWorker.DoWork             += _bgWorker_DoWork;
            _bgWorker.RunWorkerCompleted += _bgWorker_RunWorkerCompleted;
            _ChangeListener = new ChangeListener();
            _errorP         = new ErrorProvider();
            _ChangeListener.StatusChanged += _ChangeListener_StatusChanged;
            _ChangeListener.Add(new TextBoxSource(txtName));
            _ChangeListener.Add(new TextBoxSource(txtPhone));
        }
        public ParentInfoItem()
        {
            _BGWork = new BackgroundWorker();
            _BGWork.DoWork += _BGWork_DoWork;
            _BGWork.RunWorkerCompleted += _BGWork_RunWorkerCompleted;
            InitializeComponent();
            Group = "家长信息";

            _DataListener = new ChangeListener();
            _DataListener.Add(new TextBoxSource(txtAddress));
            _DataListener.Add(new TextBoxSource(txtFatherName));
            _DataListener.Add(new TextBoxSource(txtFatherPhone));
            _DataListener.Add(new TextBoxSource(txtMotherName));
            _DataListener.Add(new TextBoxSource(txtMotherPhone));
            _DataListener.StatusChanged += _DataListener_StatusChanged;
        }
        public void TestListener()
        {
            ValidatingSupplier supplier = new ValidatingSupplier();

            InitPreference(supplier, null);

            ChangeListener l = new ChangeListener();

            supplier.RootFolder.AddChangeListener(l);

            IPreferenceFolder f = supplier.RootFolder.Clone();

            supplier.RootFolder.Import(f);
            Assert.AreEqual(1, l._count);
            //もうちょっと確認したい
        }
Exemple #31
0
        public StudentResultItem()
        {
            InitializeComponent();

            Group = "社團成績";

            UserPermission = UserAcl.Current[FISCA.Permission.FeatureCodeAttribute.GetCode(GetType())];
            this.Enabled   = UserPermission.Editable;

            BGW.DoWork             += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            DataListener = new ChangeListener();
            DataListener.Add(new DataGridViewSource(dataGridViewX1));
            DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(DataListener_StatusChanged);
        }
        public StudentResultItem()
        {
            InitializeComponent();

            Group = "拓展性课程成绩";

            UserPermission = UserAcl.Current[FISCA.Permission.FeatureCodeAttribute.GetCode(GetType())];
            this.Enabled = UserPermission.Editable;

            BGW.DoWork += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            DataListener = new ChangeListener();
            DataListener.Add(new DataGridViewSource(dataGridViewX1));
            DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(DataListener_StatusChanged);
        }
        public async Task ValueChangeTest()
        {
            //arrange
            var dbConnection = new UnitTestDbConnection();

            Database.SetInitializer(new CreateFreshDbInitializer());

            var logEntries = new List <LogEntry>();
            var log        = new StubIFeedback <LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntries.Add(e);
                    return(Task.FromResult(0));
                }
            };
            var cts = new CancellationTokenSource();
            var tm  = new ChangeListener(log, dbConnection);

            //Act
            await tm.StartAsync(cts.Token);

            var device = UnitTesting.CreateFakeDevice();

            device.Values.Add(new DeviceValue
            {
                UniqueIdentifier = "DeviceTestValue1",
                Value            = "0"
            });

            using (var context = new ZvsContext(dbConnection))
            {
                context.Devices.Add(device);
                await context.SaveChangesAsync(CancellationToken.None);

                device.Values.First().Value = "1";
                await context.SaveChangesAsync(CancellationToken.None);
            }
            await Task.Delay(100, CancellationToken.None);

            await tm.StopAsync(cts.Token);

            //Assert
            Assert.IsTrue(logEntries.Count == 3, "Unexpected number of log entries.");
            Assert.IsTrue(logEntries[1].Message.Contains("changed"), "Log message didn't contain changed.");
        }
Exemple #34
0
 public void AddListener(int variableId, ChangeListener listener)
 {
     lock (this)
     {
         HashSet <ChangeListener> set;
         if (false == map.TryGetValue(variableId, out set))
         {
             set = new HashSet <ChangeListener>();
             map.Add(variableId, set);
         }
         if (false == set.Add(listener))
         {
             throw new ArgumentException();
         }
         MapCopyDeep();
     }
 }
Exemple #35
0
        [Test] public void OneEventTest()
        {
            IResourceList  list     = Core.ResourceStore.GetAllResourcesLive("Setting");
            ChangeListener listener = new ChangeListener();

            list.ResourceChanged += new ResourcePropIndexEventHandler(listener.list_ResourceChanged);
            IResource setting = Core.ResourceStore.BeginNewResource("Setting");

            setting.EndUpdate();
            setting.BeginUpdate();
            IntResourceSetting setting1 = new IntResourceSetting(setting, _SIZE, 30);
            IntResourceSetting setting2 = new IntResourceSetting(setting, _NUM, 5);

            setting1.Save(12);
            setting2.Save(13);
            setting.EndUpdate();
            Assert.AreEqual(1, listener.Count);
        }
 //建构子
 public ClassBaseInfoItem()
 {
     InitializeComponent();
     Group = "班级基本数据";
     _DataListener = new ChangeListener();
     _DataListener.Add(new TextBoxSource(txtClassName));
     _DataListener.Add(new TextBoxSource(txtSortOrder));
     _DataListener.Add(new ComboBoxSource(cboGradeYear, ComboBoxSource.ListenAttribute.Text));
     _DataListener.Add(new ComboBoxSource(cboTeacher, ComboBoxSource.ListenAttribute.Text));
     _DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(_DataListener_StatusChanged);
     _TeacherNameDic = new Dictionary<string, string>();
     prlp = new PermRecLogProcess();
     K12.Data.Class.AfterChange += new EventHandler<K12.Data.DataChangedEventArgs>(Class_AfterChange);
     _BGWorker = new BackgroundWorker();
     _BGWorker.DoWork += new DoWorkEventHandler(_BGWorker_DoWork);
     _BGWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWorker_RunWorkerCompleted);
     Disposed += new EventHandler(ClassBaseInfoItem_Disposed);
 }
Exemple #37
0
 public void RemoveListener(int variableId, ChangeListener listener)
 {
     lock (this)
     {
         if (map.TryGetValue(variableId, out var set))
         {
             bool changed = set.Remove(listener);
             if (set.Count == 0)
             {
                 map.Remove(variableId);
             }
             if (changed)
             {
                 MapCopyDeep();
             }
         }
     }
 }
Exemple #38
0
 //建構子
 public ClassBaseInfoItem()
 {
     InitializeComponent();
     Group         = "班級基本資料";
     _DataListener = new ChangeListener();
     _DataListener.Add(new TextBoxSource(txtClassName));
     _DataListener.Add(new TextBoxSource(txtSortOrder));
     _DataListener.Add(new ComboBoxSource(cboGradeYear, ComboBoxSource.ListenAttribute.Text));
     _DataListener.Add(new ComboBoxSource(cboTeacher, ComboBoxSource.ListenAttribute.Text));
     _DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(_DataListener_StatusChanged);
     _TeacherNameDic              = new Dictionary <string, string>();
     prlp = new PermRecLogProcess();
     JHClass.AfterChange          += new EventHandler <K12.Data.DataChangedEventArgs>(JHClass_AfterChange);
     _BGWorker                     = new BackgroundWorker();
     _BGWorker.DoWork             += new DoWorkEventHandler(_BGWorker_DoWork);
     _BGWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BGWorker_RunWorkerCompleted);
     Disposed += new EventHandler(ClassBaseInfoItem_Disposed);
 }
Exemple #39
0
        public PhoneItem()
        {
            InitializeComponent();
            Group         = "聯絡電話";
            _DataListener = new ChangeListener();
            _DataListener.Add(new TextBoxSource(txtHomePhone));
            _DataListener.Add(new TextBoxSource(txtFatherPhone));
            _DataListener.Add(new TextBoxSource(txtMotherPhone));
            _DataListener.Add(new TextBoxSource(txtGuardianPhone));
            _DataListener.StatusChanged += _DataListener_StatusChanged;
            _BGWorker                     = new BackgroundWorker();
            _BGWorker.DoWork             += _BGWorker_DoWork;
            _BGWorker.RunWorkerCompleted += _BGWorker_RunWorkerCompleted;
            prlp = new K12StudentPhoto.PermRecLogProcess();

            JHStudent.AfterChange += JHStudent_AfterChange;
            JHStudent.AfterDelete += new EventHandler <K12.Data.DataChangedEventArgs>(JHStudent_AfterDelete);
            Disposed += new EventHandler(PhonePalmerwormItem_Disposed);
        }
Exemple #40
0
        private void AddressEditForm_Load(object sender, EventArgs e)
        {
            #region Load
            BGW.DoWork             += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            K12.Presentation.NLDPanels.Student.TempSourceChanged += new EventHandler(Student_TempSourceChanged);

            DataListener = new ChangeListener();
            DataListener.Add(new DataGridViewSource(dataGridViewX1));
            DataListener.StatusChanged += new EventHandler <ChangeEventArgs>(DataListener_StatusChanged);

            this.Text    = "資料載入中,請稍後...";
            this.Enabled = false;

            BGW.RunWorkerAsync();

            labelX2.Text = "學生待處理:" + K12.Presentation.NLDPanels.Student.TempSource.Count() + "人";
            #endregion
        }
Exemple #41
0
 private void Monitor()
 {
     if (listener != null)
     {
         listener.DeepCollectionChanged -= CollectionListener_DeepCollectionChanged;
         listener.Dispose();
         this.Children.Clear();
         listener = null;
     }
     if (this.BindingContext != null && string.IsNullOrEmpty(this.ItemsSourceSelector) == false)
     {
         listener = ChangeListener.Create(this.BindingContext, this.ItemsSourceSelector, this.propsToIgnoreList);
         listener.DeepCollectionChanged += CollectionListener_DeepCollectionChanged;
         if (this.BindingContext is INotifyPropertyChanged)
         {
             CollectionListener_DeepCollectionChanged(null, new DeepCollectionChangedEventArg(this.ItemsSourceSelector, this.BindingContext, null));
         }
         listener.Subscribe();
     }
 }
        public ClubRestrictItem()
        {
            InitializeComponent();

            Group = "限制";

            UserPermission = UserAcl.Current[FISCA.Permission.FeatureCodeAttribute.GetCode(GetType())];
            this.Enabled = UserPermission.Editable;

            BGW.DoWork += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            Save_BGW.DoWork += new DoWorkEventHandler(Save_BGW_DoWork);
            Save_BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Save_BGW_RunWorkerCompleted);

            ClubEvents.ClubChanged += new EventHandler(ClubEvents_ClubChanged);

            DataListener = new ChangeListener();

            DataListener.Add(new TextBoxSource(tbLimit1));
            DataListener.Add(new TextBoxSource(tbLimit2));
            DataListener.Add(new TextBoxSource(tbLimit3));
            DataListener.Add(new TextBoxSource(tbLimit4));
            DataListener.Add(new TextBoxSource(tbLimit5));

            DataListener.Add(new TextBoxSource(tbBoyLimit1));
            DataListener.Add(new TextBoxSource(tbBoyLimit2));
            DataListener.Add(new TextBoxSource(tbBoyLimit3));
            DataListener.Add(new TextBoxSource(tbBoyLimit4));
            DataListener.Add(new TextBoxSource(tbBoyLimit5));

            DataListener.Add(new TextBoxSource(tbGirlLimit1));
            DataListener.Add(new TextBoxSource(tbGirlLimit2));
            DataListener.Add(new TextBoxSource(tbGirlLimit3));
            DataListener.Add(new TextBoxSource(tbGirlLimit4));
            DataListener.Add(new TextBoxSource(tbGirlLimit5));

            DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(DataListener_StatusChanged);
        }
        public async Task StartPath2()
        {
            //Arrange 
            LogEntry logEntry = null;
            var log = new StubIFeedback<LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntry = e;
                    return Task.FromResult(0);
                }
            };
            var cts = new CancellationTokenSource();
            var tm = new ChangeListener(log, new UnitTestDbConnection());

            //Act
            await tm.StartAsync(cts.Token);
            await tm.StartAsync(cts.Token);
            //Assert
            Assert.IsTrue(logEntry.Level == LogEntryLevel.Warn);
        }
        public async Task StartPath1()
        {
            //Arrange 
            LogEntry logEntry = null;
            var log = new StubIFeedback<LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntry = e;
                    return Task.FromResult(0);
                }
            };
            var cts = new CancellationTokenSource();
            var tm = new ChangeListener(log, new ZvsEntityContextConnection());

            //Act
            await tm.StartAsync(cts.Token);

            //Assert
            Assert.IsTrue(logEntry.Level == LogEntryLevel.Info);
            Assert.IsTrue(logEntry.Message.Contains("started"), "Manger not started or word started not in the log.");
        }
        public ClubDetailItem()
        {
            InitializeComponent();

            Group = "基本资料";
            UserPermission = UserAcl.Current[FISCA.Permission.FeatureCodeAttribute.GetCode(GetType())];
            this.Enabled = UserPermission.Editable;

            DataListener = new ChangeListener();
            DataListener.Add(new TextBoxSource(txtClubName));
            DataListener.Add(new TextBoxSource(txtAbout));
            DataListener.Add(new TextBoxSource(txtDomain));
            DataListener.Add(new TextBoxSource(txtFormal));
            DataListener.Add(new TextBoxSource(txtType));
            //DataListener.Add(new TextBoxSource(tbCategory));
            DataListener.Add(new TextBoxSource(tbCLUBNumber));
            DataListener.Add(new TextBoxSource(tbTotalNumberHours)); //總課時數
            DataListener.Add(new ComboBoxSource(cbTeacher1, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cbTeacher2, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cbTeacher3, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cbCategory, ComboBoxSource.ListenAttribute.Text));
            //DataListener.Add(new ComboBoxSource(cbPresident, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cbLocation, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cbFullPhase, ComboBoxSource.ListenAttribute.SelectedIndex));
            //DataListener.Add(new ComboBoxSource(cbVicePresident, ComboBoxSource.ListenAttribute.Text));
            DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(DataListener_StatusChanged);

            ClubEvents.ClubChanged += new EventHandler(ClubEvents_ClubChanged);

            BGW.DoWork += new DoWorkEventHandler(BGW_DoWork);
            BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGW_RunWorkerCompleted);

            Save_BGW.DoWork += new DoWorkEventHandler(Save_BGW_DoWork);
            Save_BGW.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Save_BGW_RunWorkerCompleted);

        }
Exemple #46
0
        public void TestListener()
        {
            ValidatingSupplier supplier = new ValidatingSupplier();
            InitPreference(supplier, null);

            ChangeListener l = new ChangeListener();
            supplier.RootFolder.AddChangeListener(l);

            IPreferenceFolder f = supplier.RootFolder.Clone();
            supplier.RootFolder.Import(f);
            Assert.AreEqual(1, l._count);
            //もうちょっと確認したい
        }
        private void ClassItem_Load(object sender, EventArgs e)
        {
            Errors = new EnhancedErrorProvider();
            _ClassNameIDDic = new Dictionary<string, string>();
            _ClassSeatNoList = new List<int>();

            K12.Data.Student.AfterChange += new EventHandler<K12.Data.DataChangedEventArgs>(JHStudent_AfterChange);

            objStudent = K12.Data.Student.SelectByID(PrimaryKey);
            _AllClassRecs = K12.Data.Class.SelectAll();
            _AllStudRecList = new List<K12.Data.StudentRecord>();
            _studRecList = new List<K12.Data.StudentRecord>();
            BGWork = new BackgroundWorker();
            BGWork.DoWork += new DoWorkEventHandler(BGWork_DoWork);
            BGWork.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BGWork_RunWorkerCompleted);

            DataListener = new ChangeListener();
            DataListener.Add(new TextBoxSource(txtStudentNumber));
            DataListener.Add(new ComboBoxSource(cboClass, ComboBoxSource.ListenAttribute.Text));
            DataListener.Add(new ComboBoxSource(cboSeatNo, ComboBoxSource.ListenAttribute.Text));
            DataListener.StatusChanged += new EventHandler<ChangeEventArgs>(ValueManager_StatusChanged);
            prlp = new PermRecLogProcess();

            if (!string.IsNullOrEmpty(PrimaryKey))
                BGWork.RunWorkerAsync();

            Disposed += new EventHandler(ClassItem_Disposed);
        }
        public async Task ValueChangeTest()
        {
            //arrange 
            var dbConnection = new StubIEntityContextConnection { NameOrConnectionStringGet = () => "changelistener-ValueChangeTest" };
            Database.SetInitializer(new CreateFreshDbInitializer());

            var logEntries = new List<LogEntry>();
            var log = new StubIFeedback<LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntries.Add(e);
                    return Task.FromResult(0);
                }
            };
            var cts = new CancellationTokenSource();
            var tm = new ChangeListener(log, dbConnection);

            //Act
            await tm.StartAsync(cts.Token);
            var device = UnitTesting.CreateFakeDevice();
            device.Values.Add(new DeviceValue
            {
                UniqueIdentifier = "DeviceTestValue1",
                Value = "0"
            });

            using (var context = new ZvsContext(dbConnection))
            {
                context.Devices.Add(device);
                await context.SaveChangesAsync(CancellationToken.None);
                device.Values.First().Value = "1";
                await context.SaveChangesAsync(CancellationToken.None);
            }
            await Task.Delay(100, CancellationToken.None);
            await tm.StopAsync(cts.Token);

            //Assert
            Assert.IsTrue(logEntries.Count == 3, "Unexpected number of log entries.");
            Assert.IsTrue(logEntries[1].Message.Contains("changed"), "Log message didn't contain changed.");
        }
        public StudABCard01Content()
        {
            InitializeComponent();

            _StudenIDList = new List<string>();
            _udtMrFlp01Dict = new Dictionary<string, UDTMultipleRecordDef>();
            _udtMrFlp02Dict = new Dictionary<string, UDTMultipleRecordDef>();

            _QDMang = new ABCardQuestionDataManager();
            _QuestionDict = _QDMang.GetQuestionDataByGroupName(GroupName);
            this.Group = "綜合表現紀錄表-本人概況";
            _bgWorker = new BackgroundWorker();

            List<string> grYear = Utility.GetClassGradeYear();

            if (grYear.Count > 3)
                SetDgColumn4_6Visable(true);
            else
                SetDgColumn4_6Visable(false);

            _ChangeManager = new ChangeListener();
            _ChangeManager.StatusChanged += new EventHandler<ChangeEventArgs>(_ChangeManager_StatusChanged);
            LoadQuestionToUI();
            _bgWorker.DoWork += new DoWorkEventHandler(_bgWorker_DoWork);
            _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
            EventHub.CounselChanged += new EventHandler(EventHub_CounselChanged);
        }
		/// <summary>
		/// Removes a <code>ChangeListener</code> from the list that's notified each
		/// time the views size, position, or the viewports extent size
		/// has changed.
		/// </summary>
		public void removeChangeListener(ChangeListener @l)
		{
		}
		/// <summary>
		/// Adds a <code>ChangeListener</code> to the list that is
		/// notified each time the view's
		/// size, position, or the viewport's extent size has changed.
		/// </summary>
		public void addChangeListener(ChangeListener @l)
		{
		}
        // This is the internal method called to set up the listeners on both
        //  the original and the clone.
        internal static void ListenToChangesOnFreezable(
            DependencyObject target,
            Freezable clone,
            DependencyProperty dp,
            Freezable original)
        {
            ChangeListener listener = new ChangeListener( target, clone, dp, original );

            listener.Setup();
        }