Hi Guys,
as already discussed here B202804 - i aslo face a performance problems with CA. I am facing this several months now, but never really had time to track it down. Actually i have a detailview, with an collection of lineitems. These are shown via an TreeListEditor in MasterDetail mode. Now when i create a new lineitem, the user assign can assighn a product. in the product setter there are heavy calculations happening, a lot of property changes occour(setting up prices, descriptions, special prices, calculate total price, and so on…). Currently, assigning an product can take up to 2.5 - 3 seconds. today i made a small test and did the following:
- a custom treelist editor where i disable appearance refresh:
[ListEditor(typeof(ITreeNode), false)]
public class VDTreeListEditor : TreeListEditor
{
public VDTreeListEditor(DevExpress.ExpressApp.Model.IModelListView model)
: base(model) {
}
protected override void OnCustomizeAppearance(CustomizeAppearanceEventArgs args)
{
////base.OnCustomizeAppearance(args);
}
} - a controller which disables RefreshAppearanceController
public class DisableAppearanceController : ObjectViewController
{
protected override void OnActivated()
{
base.OnActivated();
this.Frame.GetController<RefreshAppearanceController>().Active.SetItemValue("Kill appearance", false);
}
}
With these 2 changes, assigning an product will happen immediatly, now slow down. The problem, as far as i see, is that RefreshAppearanceController and TreeListEditor handle the both objectSpace.ObjectChanged event, which results in hundreds(or even more then thousand) of appearance refreshs during assigning an product.
Of course - i need actually the CA since there are some appearance rules for the listview and detailview(2 rules for the listview, 2 rules for the detailview)
Any help would be much appreciated!
Hi Noxe,
I am afraid we cannot research this issue based on the information you provided. Could you please provide us with a small sample project, demonstrating this issue? We will research it and do our best to find a solution.
Thanks,
Michael.
Mi Michael,
attached is a sample and a video where i have build a master / detail - similar which i have in my application. please note that this is just a really simple example to show the behaviour. you see that without CA the properties are assigned immediatly, but when adding the CA module it takes up to 5 seconds… Please take also note how long it takes when you click on the "Detail" tab, this is not cause of CA - but i notice the same in my application for master/detail views.
Hi Noxe,
We have researched this issue and found that it is caused by the fact that every property change raises an event and the CA module updates the view on every property change notification. We cannot ignore these notifications.
To overcome this issue, you should suppress intermediate notifications and raise only a single notification when the batch modification is finished.
[NonPersistent] public class UpdatableBaseObject : BaseObject, ISupportUpdate { public UpdatableBaseObject(Session s) : base(s) { } private int guard = 0; protected override void TriggerObjectChanged(ObjectChangeEventArgs args) { if (guard > 0) return; base.TriggerObjectChanged(args); } public void BeginUpdate() { guard++; } public void EndUpdate() { if (--guard == 0) { TriggerObjectChanged(new ObjectChangeEventArgs(Session, this, ObjectChangeReason.Reset)); } } }
private string _PropertyNameString; public string PropertyNameString { get { return this._PropertyNameString; } set { SetPropertyValue(Fields.PropertyNameString.PropertyName, ref this._PropertyNameString, value); if (!this.IsLoading) { Random rnd = new Random(); var watch = new System.Diagnostics.Stopwatch(); watch.Start(); BeginUpdate(); this.Master.BeginUpdate(); for (int i = 0; i < 10; i++) { this.SetMemberValue("DetailProperty" + i, rnd.Next(10000)); this.Master.SetMemberValue("MasterProperty" + i, rnd.Next(10000)); this._PropertyNameInt++; } this.Master.EndUpdate(); EndUpdate(); //OnChanged("PropertyNameInt"); watch.Stop(); this.InfoString = "Time: " + watch.Elapsed.ToString(); } } }
Thanks,
Michael.