public void ClearContent() { user = null; if (currentTask != null) { currentTask.Cancel(); currentTask = null; } showProgress(false); //foreach (NaviBand band in naviBar1.Bands) //{ // if (band.ClientArea.Controls.Count > 0) // { // IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl; // if (ctrl != null) // { // ctrl.Fill(null, naviBar1.ActiveBand == band); // } // } //} foreach (AccordionItem band in accordionCtrl.Items) { //if (band.Controls.Count > 0) { IUserDetailControl ctrl = band.Content as IUserDetailControl; if (ctrl != null) { ctrl.Fill(null, accordionCtrl.SelectedItem == band); } } } updateButtons(false); }
private void naviBar1_ActiveBandChanged(object sender, EventArgs e) { if (naviBar1.ActiveBand != null) { IUserDetailControl ctrl = (IUserDetailControl)naviBar1.ActiveBand.Tag; ctrl.Fill(user, true); } }
public void Fill(UserDTO user) { if (currentTask != null) { currentTask.Cancel(); currentTask = null; updateButtons(false); } this.ClearContent(); showProgress(true); currentTask = ParentWindow.TasksManager.RunAsynchronousOperation(delegate(OperationContext ctx) { GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = user.Id; ProfileInformationDTO usr; if (user.IsMe()) { usr = UserContext.ProfileInformation; } else { usr = ServiceManager.GetProfileInformation(criteria); } if (ctx.CancellatioToken.IsCancellationRequested) { return; } this.user = usr; ParentWindow.SynchronizationContext.Send(delegate { foreach (NaviBand band in naviBar1.Bands) { if (ctx.CancellatioToken.IsCancellationRequested) { return; } if (band.ClientArea.Controls.Count > 0) { IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl; if (ctrl != null) { ctrl.Fill(this.user, naviBar1.ActiveBand == band); band.Text = ctrl.Caption; } } } //updateButtons(); //without these caption of navi bar was not refreshed in some cases naviBar1.Refresh(); naviBar1.Update(); showProgress(false); }, null); }, asyncOperationStateChange, null, false); }
public void Fill(UserDTO user) { if (currentTask != null) { currentTask.Cancel(); currentTask = null; updateButtons(false); } this.ClearContent(); if (accordionCtrl.SelectedItem == null) { ShowUserInfo(); } showProgress(true); currentTask = ParentWindow.RunAsynchronousOperation(delegate(OperationContext ctx) { GetProfileInformationCriteria criteria = new GetProfileInformationCriteria(); criteria.UserId = user.GlobalId; ProfileInformationDTO usr; if (user.IsMe()) { usr = UserContext.Current.ProfileInformation; } else { usr = ServiceManager.GetProfileInformation(criteria); } if (ctx.CancellatioToken.IsCancellationRequested) { return; } this.user = usr; UIHelper.BeginInvoke(new Action(delegate { foreach (AccordionItem band in accordionCtrl.Items) { if (ctx.CancellatioToken.IsCancellationRequested) { return; } if (band.Content != null) { IUserDetailControl ctrl = band.Content as IUserDetailControl; if (ctrl != null) { ctrl.Fill(this.user, accordionCtrl.SelectedItem == band); } } } updateButtons(false); showProgress(false); }), Dispatcher); }, asyncOperationStateChange, null); }
public void ClearContent() { user = null; if (currentTask != null) { currentTask.Cancel(); currentTask = null; } showProgress(false); foreach (NaviBand band in naviBar1.Bands) { if (band.ClientArea.Controls.Count > 0) { IUserDetailControl ctrl = band.ClientArea.Controls[0] as IUserDetailControl; if (ctrl != null) { ctrl.Fill(null, naviBar1.ActiveBand == band); } } } updateButtons(false); }