public void FindOrganisationList() { DataTable dt = new DataTable(); dt.Columns.Add("Organisation"); dt.Columns.Add("Description"); this.ug_organisationlist.DataSource = dt; this.lbl_recordCount.Text = this.ug_organisationlist.Rows.Count.ToString(); using (AsyncWorker<IOrganisationMaintenance> worker = new AsyncWorker<IOrganisationMaintenance>(_presenter, this.ug_organisationlist, new Control[] { btn_search, btn_reset })) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { eDoWork.Result = _presenter.FindeOrganisationsByConditions(this.txt_organisationName.Text, this.txt_organisationDescription.Text); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { List<OrganisationEntity> orgEntities = eCompleted.Result as List<OrganisationEntity>; if (orgEntities != null) { foreach (OrganisationEntity entity in orgEntities) { dt.Rows.Add(entity.OrganisationName, entity.OrganisationDescription); } } this.ug_organisationlist.DataSource = dt; this.lbl_recordCount.Text = this.ug_organisationlist.Rows.Count.ToString(); }; worker.Run(); } }
public async Task Connect(string remote, WebSocketConnectionOptions options = null) { _connection = new WebSocketConnection(); await _connection.Connect(remote, options); AsyncWorker.Run(EventLoop); await TriggerConnected(); }
public void Update() { if (StartSpin) { StartSpin = false; AsyncWorker.Run(SpinCube).Then(() => { Debug.Log("Spin finished!!"); }, Debug.LogException).Dispatch(); } }
public void SetEventLoop(bool active) { if (_active == active) { return; } _active = active; if (_active) { AsyncWorker.Run(EventLoop); } }
public void FindRoleList() { DataTable dt = new DataTable(); dt.Columns.Add("Role Name"); dt.Columns.Add("Description"); dt.Columns.Add("Status"); this.ug_rolelist.DataSource = dt; this.lbl_rolecount.Text = this.ug_rolelist.Rows.Count.ToString(); this.ug_rolelist.Focus(); var argus = new object[] { this.txt_rolename.Text, this.txt_description.Text }; using (AsyncWorker<IRoleMaintenance> worker = new AsyncWorker<IRoleMaintenance>(_presenter, this.ug_rolelist, new Control[] { btn_search, btn_reset })) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { var tempArgus = eDoWork.Argument as object[]; if (tempArgus == null || tempArgus.Length <= 1) { return; } eDoWork.Result = _presenter.FindRoleListByConditions(tempArgus[0] as string,tempArgus[1] as string); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { RoleEntity[] roleEntitys = eCompleted.Result as RoleEntity[]; if (roleEntitys != null) { if (roleEntitys.Length > 0) { foreach (RoleEntity entity in roleEntitys) { dt.Rows.Add(entity.RoleName, entity.Description, entity.Status); } } this.ug_rolelist.DataSource = dt; this.lbl_rolecount.Text = this.ug_rolelist.Rows.Count.ToString(); } }; worker.Run(argus); } }
private void ultraBtnSearch_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; this.ultraGridDelegation.Focus(); var criteria = GetDelegationSearchCriteria(); using (AsyncWorker<IMaintainDelegation> worker = new AsyncWorker<IMaintainDelegation>(_presenter, this.ultraGridDelegation,true)) { worker.DoWork += delegate(object senderobj, DoWorkEventArgs ev) { var tempCriteria = ev.Argument as DelegationSearchCriteria; if (tempCriteria == null) { return; } ev.Result = _presenter.FindDelegationDetailEntity(tempCriteria); }; worker.RunWorkerCompleted += delegate(object senderobj, RunWorkerCompletedEventArgs ev) { List<DelegationValueEntity> lstResults = ev.Result as List<DelegationValueEntity>; ultraGridDelegation.DataSource = lstResults; ultraGridDelegation.DataBind(); ultraLabTotalNum.Text = string.Format("Total record(s) : {0}", ultraGridDelegation.Rows.Count.ToString()); }; worker.Run(criteria); } } catch (Exception ex) { if (ExceptionManager.Handle(ex)) throw; } finally { this.Cursor = Cursors.Default; } }
protected sealed override Task <bool> Execute() { _taskCompletionSource = new TaskCompletionSource <bool>(); AsyncWorker.Run(ExecuteInternal); return(_taskCompletionSource.Task); }
private void ButtonSearchForUser_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DisableValidationProvider(); this.validationProvider1.Enabled = true; if (this.ValidateChildren()) { DateTimeCompare timeEntity = new DateTimeCompare(DateTimeStartDateForUser.DateTime.Date, DateTimeEndDateForUser.DateTime.Date); var argus = new object[] {timeEntity, TextBoxUserName.Text}; using (AsyncWorker<IUsageLogView> worker = new AsyncWorker<IUsageLogView>(_presenter, this.ultraChart1, new Control[] { ButtonSearchForUser })) { #region worker definition worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { var tempArgus = eDoWork.Argument as object[]; if (tempArgus==null || tempArgus.Length<=1) { return; } eDoWork.Result = _presenter.GetUsageForUserData( tempArgus[0] as DateTimeCompare,tempArgus[1] as string ); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { LoggingUsageDataSet dataset = eCompleted.Result as LoggingUsageDataSet; if (dataset != null && dataset.T_IC_LOGGING_USAGE.Rows.Count > 0) { int rowCount = dataset.T_IC_LOGGING_USAGE.Rows.Count - 1; this.ultraChart1.Height = CHART_BASE_HEIGHT + rowCount * INCREMENT_FEED; this.usageByUserExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT + rowCount * INCREMENT_FEED; SetChartStype(this.ultraChart1, "FREQUENCY", dataset); this.ultraChart1.DataSource = dataset.T_IC_LOGGING_USAGE.Select( data => new { username = data["USER_NAME"].ToString(), logintimes = Convert.ToInt32(data["FREQUENCY"]) } ).ToList(); this.ultraChart1.Visible = true; } else { this.ultraChart1.Visible = false; this.usageByUserExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT - CHART_BASE_HEIGHT; } }; #endregion worker.Run(argus); } } } catch (Exception ex) { if (ExceptionManager.Handle(ex)) throw; } finally { this.Cursor = Cursors.Default; } }
private void ButtonSearchForCount_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DisableValidationProvider(); this.validationProvider7.Enabled = true; if (this.ValidateChildren()) { DateTimeCompare timeEntity = new DateTimeCompare( DateTimeStartDateForCount.DateTime.Date, DateTimeEndDateForCount.DateTime.Date); using (AsyncWorker<IUsageLogView> worker = new AsyncWorker<IUsageLogView>(_presenter, this.ultraChart7, new Control[] { ButtonSearchForCount })) { #region worker defini worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { var tempEntity = eDoWork.Argument as DateTimeCompare; if (tempEntity == null) { return; } eDoWork.Result = _presenter.GetAllCountOfUsers(tempEntity); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { LoggingUsageDataSet dataset = eCompleted.Result as LoggingUsageDataSet; if (dataset != null && dataset.T_IC_LOGGING_USAGE.Rows.Count > 0) { int rowCount = dataset.T_IC_LOGGING_USAGE.Rows.Count - 1; this.ultraChart7.Height = CHART_BASE_HEIGHT + rowCount * INCREMENT_FEED; this.usageByUserCountExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT + rowCount * INCREMENT_FEED; SetChartStype(this.ultraChart7, "USER_COUNT", dataset); this.ultraChart7.DataSource = dataset.T_IC_LOGGING_USAGE.Select( data => new { emptyname = String.Empty, usercount = Convert.ToInt32(data["USER_COUNT"]) } ).ToList(); this.ultraChart7.Visible = true; } else { this.ultraChart7.Visible = false; this.usageByUserCountExpandableGroupBox.Height = EXPANDABLE_GROUP_BOX_BASE_HEIGHT - CHART_BASE_HEIGHT; } }; #endregion worker.Run(timeEntity); } } } catch (Exception ex) { if (ExceptionManager.Handle(ex)) { throw; } } finally { this.Cursor = Cursors.Default; } }
private void LoadOrganisationList() { this.ultraGridOrganisational.Focus(); var argus = txt_Orgenisation.Text ; using (AsyncWorker<IMaintainOrganisationName> worker = new AsyncWorker<IMaintainOrganisationName>(_presenter, this.ultraGridOrganisational, new Control[] { ultraBtnSearch, ultraBtnReset })) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { var lookup = _presenter.GetOrganisationLookup(); var tempArgu = eDoWork.Argument as string; eDoWork.Result = RetriveOrgData(lookup, tempArgu); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { this.ultraGridOrganisational.DataSource = eCompleted.Result; ultraLabTotalNum.Text = HiiP.Framework.Messaging.Messages.General.GEI001.Format(this.ultraGridOrganisational.Rows.Count.ToString()); }; worker.Run(argus); } }
public void ShowUserList() { this.btn_disable.Enabled = false; this.btn_assignroles.Enabled = false; DataTable dt = new DataTable(); dt.Columns.Add("User ID", Type.GetType("System.String")); dt.Columns.Add("Status", Type.GetType("System.String")); dt.Columns.Add("Created On", Type.GetType("System.DateTime")); dt.Columns.Add("User Name", Type.GetType("System.String")); dt.Columns.Add("Gender", Type.GetType("System.String")); dt.Columns.Add("Title", Type.GetType("System.String")); dt.Columns.Add("Email", Type.GetType("System.String")); dt.Columns.Add("Telephone No", Type.GetType("System.String")); //dt.Columns.Add("Organisation", Type.GetType("System.String")); dt.Columns.Add("Master Office", Type.GetType("System.String")); dt.Columns.Add("Office", Type.GetType("System.String")); dt.Columns.Add("AllOffices", Type.GetType("System.String")); dt.Columns.Add("First Name", Type.GetType("System.String")); dt.Columns.Add("Last Name", Type.GetType("System.String")); dt.Columns.Add("Mobile", Type.GetType("System.String")); this.ug_userlist.DataSource = dt; this.ug_userlist.Focus(); this.lbl_recordCount.Text = "0"; var criteria = GetSearchCriteria(); using (AsyncWorker<IUserMaintenance> worker = new AsyncWorker<IUserMaintenance>(_presenter, this.ug_userlist, new Control[] { btn_search })) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { var tempCriteria = eDoWork.Argument as UserInfoSearchCriteria; if (tempCriteria == null) { return; } eDoWork.Result = _presenter.GetUserInfoArrayEntity(tempCriteria); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { UserInfoEntity[] userInfoEntitys = eCompleted.Result as UserInfoEntity[]; if (userInfoEntitys != null && userInfoEntitys.Length > 0) { foreach (UserInfoEntity entity in userInfoEntitys) { dt.Rows.Add( entity.UserName, entity.UserStatus, entity.CreatedOn, entity.Display, entity.Gender, entity.Title, entity.Email, entity.TelephoneNo, //entity.Organisation, entity.IsMaster, entity.Office, entity.AllOffices, entity.FirstName, entity.LastName, entity.MobileNo ); } } this.ug_userlist.DataSource = dt; this.lbl_recordCount.Text = this.ug_userlist.Rows.Count.ToString(); }; worker.Run(criteria); } }
public void ShowSessionList(SessionCriteria sessionCriteria) { this.ug_sessionlist.Focus(); using (AsyncWorker<ISessionManagementView> worker = new AsyncWorker<ISessionManagementView>(_presenter, this.ug_sessionlist, new Control[] { refreshButton })) { worker.DoWork += delegate(object oDoWork, DoWorkEventArgs eDoWork) { eDoWork.Result = _presenter.GetActiveSessions(sessionCriteria); }; worker.RunWorkerCompleted += delegate(object oCompleted, RunWorkerCompletedEventArgs eCompleted) { SessionInfo[] sessions = eCompleted.Result as SessionInfo[]; if (sessions == null) { return; } this._sessionList.Clear(); foreach (SessionInfo sessionInfo in sessions) { this._sessionList.Add(sessionInfo.SessionID, sessionInfo); } this.ug_sessionlist.DataSource = sessions; this.ug_sessionlist.DataBind(); this.lbl_totalsessionnumber.Text = this.ug_sessionlist.Rows.Count.ToString(); }; worker.Run(); } }