//读卡结果 private void ReadCardResult(StructCard readCard, bool isSuccess) { if (readCard != null && isSuccess) { //激活 RefreshUIHandle active = new RefreshUIHandle(delegate { this.IsActiveCard = false; UserActiveView view = new UserActiveView(readCard); ToolsManage.ShowForm(view, false); }); //开通会员 RefreshUIHandle open = new RefreshUIHandle(delegate { this.IsOpenMember = false; OpenMemberView view = new OpenMemberView(readCard); MainViewManage.ShowView(view); }); IdCardReaderManage.RemoveEvent(ReadCardResult, ConnectReaderResult, AuthenticateCardResult); if (this.InvokeRequired) { if (this.IsOpenMember) { this.Invoke(open); } else if (this.IsActiveCard) { this.Invoke(active); } } else { if (this.IsOpenMember) { open(); } else if (this.IsActiveCard) { active(); } } } else { this.IsOpenMember = this.IsActiveCard = false; IdCardReaderManage.OffCardReader(ReadCardResult, ConnectReaderResult, AuthenticateCardResult); MessageBox.Show("读取身份证信息失败"); } }
/// <summary> /// 添加首页信息个数代理(首页Main使用) /// </summary> /// <param name="msg">提醒消息回调</param> /// <param name="dailyCount">日常数据回调</param> /// <param name="statusUI">计算机状态数量回调</param> public void AddMsgNumDelegate( RefreshUIHandle msg, RefreshUIHandle dailyCount, RefreshUIHandle statusUI) { if (msg != null) { this.UpdateMsgNumEvent += msg; } if (dailyCount != null) { this.UpdateDailyCountEvent += dailyCount; } if (statusUI != null) { this.UpdateStatusNumEvent += statusUI; } }
/// <summary> /// 移除更新电脑数据事件(切换视图方式时使用) /// </summary> /// <param name="update">更新单个电脑数据</param> /// <param name="updateComArea">更新单个电脑区域(列表视图使用)</param> /// <param name="updateArea">更新整个区域(电脑视图使用)</param> /// <param name="filter">过滤后的回调</param> public static void RemoveUpdateDataEvent( UpdateComputerDataHandle update, UpdateComputerDataHandle updateComArea, RefreshUIHandle updateArea, RefreshUIHandle filter) { if (update != null) { Manage().UpdateComputerDataEvent -= update; } if (updateComArea != null) { Manage().UpdateComputerAreaEvent -= updateComArea; } if (updateArea != null) { Manage().UpdateAreaEvent -= updateArea; } if (filter != null) { Manage().FilterComputersEvent -= filter; } }
/// <summary> /// 添加刷新区域下拉菜单的回调(HomePageView 使用) /// </summary> /// <param name="area">回调方法</param> public static void AddRefreshAreaComBox(RefreshUIHandle area) { Manage().RefreshAreaComBox += area; }