Skip to content

Commit 40b84fc

Browse files
[FIX] Refresh / Repaint performance (#1385)
* [REFACTOR] ThingStatus [FIX] timer issues [REFACTOR] ThingStatus changes, no new ThingStatus objects * [REFACTOR] PossibleRules and SelectedRul to prevent unnecessary refreshes in RelationshipMatrix [REFACTOR] RebuildMatrix to be performed only once per session update * [FIX] Crash if server is not reachable while Auto Refresh is active * Rebase and fix
1 parent ac7b3c2 commit 40b84fc

File tree

59 files changed

+315
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+315
-147
lines changed

BasicRdl/BasicRdl.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<ProjectGuid>{BEDCC5C5-83B2-41ED-AC9F-895757553BF2}</ProjectGuid>
4-
<MinIMEVersion>10.0.3</MinIMEVersion>
4+
<MinIMEVersion>10.1.0</MinIMEVersion>
55
<AssemblyName>CDP4BasicRdl</AssemblyName>
66
<TargetFramework>net48</TargetFramework>
77
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
@@ -10,8 +10,8 @@
1010
<Product>BasicRdl</Product>
1111
<Description>CDP4-COMET Basic Reference Data Library Plugin</Description>
1212
<Copyright>Copyright © Starion Group S.A.</Copyright>
13-
<AssemblyVersion>10.1.0.0</AssemblyVersion>
14-
<FileVersion>10.1.0.0</FileVersion>
13+
<AssemblyVersion>10.1.0.1</AssemblyVersion>
14+
<FileVersion>10.1.0.1</FileVersion>
1515
<UseWPF>true</UseWPF>
1616
<UseWindowsForms>true</UseWindowsForms>
1717
</PropertyGroup>

BasicRdl/ViewModels/ParameterTypeRowViewModel.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,8 @@ public void SetFavoriteStatus(bool status)
167167
/// </summary>
168168
protected override void UpdateThingStatus()
169169
{
170-
this.ThingStatus = new ThingStatus(this.Thing)
171-
{
172-
IsFavorite = this.IsFavorite
173-
};
170+
ThingStatus.SetOrUpdateThingStatus(this, this.Thing);
171+
this.ThingStatus.IsFavorite = this.IsFavorite;
174172
}
175173

176174
/// <summary>

BasicRdl/Views/ParameterTypesBrowser.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
<MultiBinding Converter="{StaticResource ThingToIconUriConverter}" Mode="OneWay">
8989
<Binding Path="DataContext.Row.ThingStatus"
9090
RelativeSource="{RelativeSource AncestorType={x:Type dxg:RowControl}}" />
91+
<Binding Path="DataContext.Row.ThingStatus.IsFavorite" RelativeSource="{RelativeSource AncestorType={x:Type dxg:RowControl}}" />
9192
</MultiBinding>
9293
</Image.Source>
9394
</Image>

CDP4Addin/CDP4Addin.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<Product>CDP4AddinCE</Product>
1111
<Description>CDP4-COMET-CE Office Plugin</Description>
1212
<Copyright>Copyright © Starion Group S.A.</Copyright>
13-
<AssemblyVersion>10.1.0.0</AssemblyVersion>
14-
<FileVersion>10.1.0.0</FileVersion>
13+
<AssemblyVersion>10.1.0.1</AssemblyVersion>
14+
<FileVersion>10.1.0.1</FileVersion>
1515
<RegisterForComInterop>true</RegisterForComInterop>
1616
<PlatformTarget>anycpu</PlatformTarget>
1717
</PropertyGroup>

CDP4BudgetViewer/CDP4Budget.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<ProjectGuid>{7D862014-4CE6-41AC-940C-49D7DE4C485D}</ProjectGuid>
4-
<MinIMEVersion>10.0.3</MinIMEVersion>
4+
<MinIMEVersion>10.1.0</MinIMEVersion>
55
<TargetFramework>net48</TargetFramework>
66
<AssemblyTitle>CDP4BudgetViewer</AssemblyTitle>
77
<Company>Starion Group S.A.</Company>
88
<Product>CDP4BudgetViewer</Product>
99
<Description>CDP4-COMET Budget Computation and Viewer Plugin</Description>
1010
<Copyright>Copyright © Starion Group S.A.</Copyright>
11-
<AssemblyVersion>10.1.0.0</AssemblyVersion>
12-
<FileVersion>10.1.0.0</FileVersion>
11+
<AssemblyVersion>10.1.0.1</AssemblyVersion>
12+
<FileVersion>10.1.0.1</FileVersion>
1313
<UseWPF>true</UseWPF>
1414
<UseWindowsForms>true</UseWindowsForms>
1515
</PropertyGroup>

CDP4BuiltInRules/CDP4BuiltInRules.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
<PropertyGroup>
33
<ProjectGuid>{1CACEEA5-D398-419D-B88B-D4CC4EA67EED}</ProjectGuid>
44
<ProjectGuid>{1CACEEA5-D398-419D-B88B-D4CC4EA67EED}</ProjectGuid>
5-
<MinIMEVersion>10.0.3</MinIMEVersion>
5+
<MinIMEVersion>10.1.0</MinIMEVersion>
66
<TargetFramework>net48</TargetFramework>
77
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
88
<AssemblyTitle>CDP4BuiltInRules</AssemblyTitle>
99
<Company>Starion Group S.A.</Company>
1010
<Product>CDP4BuiltInRules</Product>
1111
<Description>CDP4-COMET Built-In rules Plugin</Description>
1212
<Copyright>Copyright © Starion Group S.A.</Copyright>
13-
<AssemblyVersion>10.1.0.0</AssemblyVersion>
14-
<FileVersion>10.1.0.0</FileVersion>
13+
<AssemblyVersion>10.1.0.1</AssemblyVersion>
14+
<FileVersion>10.1.0.1</FileVersion>
1515
<UseWPF>true</UseWPF>
1616
<UseWindowsForms>true</UseWindowsForms>
1717
</PropertyGroup>

CDP4Composition/CDP4Composition.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<Product>CDP4Composition</Product>
88
<Description>CDP4-COMET Composition and Infrastructure library</Description>
99
<Copyright>Copyright © Starion Group S.A.</Copyright>
10-
<AssemblyVersion>10.1.0.0</AssemblyVersion>
11-
<FileVersion>10.1.0.0</FileVersion>
10+
<AssemblyVersion>10.1.0.1</AssemblyVersion>
11+
<FileVersion>10.1.0.1</FileVersion>
1212
<OutputPath>bin\$(Configuration)\</OutputPath>
1313
<LangVersion>latest</LangVersion>
1414
<UseWPF>true</UseWPF>

CDP4Composition/Mvvm/IHaveThingStatus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public interface IHaveThingStatus
3333
/// <summary>
3434
/// Gets the Thing Status of this row.
3535
/// </summary>
36-
ThingStatus ThingStatus { get; }
36+
ThingStatus ThingStatus { get; set; }
3737
}
3838
}

CDP4Composition/Mvvm/RowViewModelBase.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public RowStatusKind RowStatus
170170
public ThingStatus ThingStatus
171171
{
172172
get { return this.thingStatus; }
173-
protected set { this.RaiseAndSetIfChanged(ref this.thingStatus, value); }
173+
set { this.RaiseAndSetIfChanged(ref this.thingStatus, value); }
174174
}
175175

176176
/// <summary>
@@ -428,18 +428,18 @@ protected virtual void InitializeSubscriptions()
428428
highlightByCategoryObserver,
429429
new MessageBusEventHandlerSubscription<HighlightByCategoryEvent>(
430430
e => thingAsCategorizableThing.IsMemberOfCategory(e.Category),
431-
highlightByCategoryEventAction
432-
)));
431+
highlightByCategoryEventAction)));
433432
}
434433

435434
var relationshipObserver = this.Session.CDPMessageBus.Listen<ObjectChangedEvent>(typeof(Relationship));
436435

437436
this.Disposables.Add(this.MessageBusHandler.GetHandler<ObjectChangedEvent>().RegisterEventHandler(
438-
relationshipObserver,
437+
relationshipObserver,
439438
new ObjectChangedMessageBusEventHandlerSubscription(
440-
typeof(Relationship),
441-
objectChange => true,
442-
objectChange => this.UpdateThingStatus())));
439+
typeof(Relationship),
440+
objectChange => true,
441+
objectChange =>
442+
this.UpdateThingStatus())));
443443
}
444444

445445
this.PropertyChanged += (sender, args) =>

CDP4Composition/Mvvm/ThingStatus.cs

Lines changed: 67 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// --------------------------------------------------------------------------------------------------------------------
22
// <copyright file="ThingStatus.cs" company="Starion Group S.A.">
3-
// Copyright (c) 2015-2020 Starion Group S.A.
3+
// Copyright (c) 2015-2025 Starion Group S.A.
44
//
55
// Author: Sam Gerené, Alex Vorobiev, Merlin Bieze, Naron Phou, Patxi Ozkoidi, Alexander van Delft, Mihail Militaru
66
// Nathanael Smiechowski, Kamil Wojnowski
@@ -27,52 +27,110 @@
2727
namespace CDP4Composition.Mvvm
2828
{
2929
using System.Linq;
30+
3031
using CDP4Common.CommonData;
3132

33+
using ReactiveUI;
34+
3235
/// <summary>
3336
/// A class that gives information on the status of a <see cref="Thing"/>
3437
/// </summary>
35-
public class ThingStatus
38+
public class ThingStatus : ReactiveObject
3639
{
40+
/// <summary>
41+
/// Backing field for <see cref="IsLocked"/>
42+
/// </summary>
43+
private bool isLocked = false;
44+
45+
/// <summary>
46+
/// Backing field for <see cref="IsHidden"/>
47+
/// </summary>
48+
private bool isHidden = false;
49+
50+
/// <summary>
51+
/// Backing field for <see cref="IsFavorite"/>
52+
/// </summary>
53+
private bool isFavorite = false;
54+
3755
/// <summary>
3856
/// Initializes a new instace of the <see cref="ThingStatus"/> class
3957
/// </summary>
4058
/// <param name="thing">The <see cref="Thing"/></param>
41-
public ThingStatus(Thing thing)
59+
private ThingStatus(Thing thing)
4260
{
4361
this.Thing = thing;
4462
this.HasError = thing.ValidationErrors.Any();
4563
this.HasRelationship = thing.HasRelationship;
4664
}
4765

66+
/// <summary>
67+
/// Updates the status of the <see cref="ThingStatus"/>
68+
/// </summary>
69+
/// <param name="thing">The <see cref="Thing"/></param>
70+
public static ThingStatus CreateNewThingStatus(Thing thing)
71+
{
72+
return new ThingStatus(thing);
73+
}
74+
75+
/// <summary>
76+
/// Updates the status of the <see cref="ThingStatus"/>
77+
/// </summary>
78+
/// <param name="viewModel">The viewmodel where the ThingStatus should be present on</param>
79+
/// <param name="thing">The <see cref="Thing"/></param>
80+
public static void SetOrUpdateThingStatus(IHaveThingStatus viewModel, Thing thing)
81+
{
82+
if (viewModel.ThingStatus == null)
83+
{
84+
viewModel.ThingStatus = CreateNewThingStatus(thing);
85+
}
86+
else
87+
{
88+
viewModel.ThingStatus.Thing = thing;
89+
viewModel.ThingStatus.HasError = thing.ValidationErrors.Any();
90+
viewModel.ThingStatus.HasRelationship = thing.HasRelationship;
91+
}
92+
}
93+
4894
/// <summary>
4995
/// Gets the <see cref="Thing"/>
5096
/// </summary>
51-
public Thing Thing { get; }
97+
public Thing Thing { get; private set; }
5298

5399
/// <summary>
54100
/// Asserts whether the <see cref="Thing"/> has errors
55101
/// </summary>
56-
public bool HasError { get; }
102+
public bool HasError { get; private set; }
57103

58104
/// <summary>
59105
/// Gets a value indicating whether the thing has associated relationships
60106
/// </summary>
61-
public bool HasRelationship { get; }
107+
public bool HasRelationship { get; private set; }
62108

63109
/// <summary>
64110
/// Gets or sets a value indicating whether the thing is marked as a user's favorite
65111
/// </summary>
66-
public bool IsFavorite { get; set; } = false;
112+
public bool IsFavorite
113+
{
114+
get => this.isFavorite;
115+
set => this.RaiseAndSetIfChanged(ref this.isFavorite, value);
116+
}
67117

68118
/// <summary>
69119
/// Gets or sets a value indicating whether the thing is marked as locked
70120
/// </summary>
71-
public bool IsLocked { get; set; } = false;
121+
public bool IsLocked
122+
{
123+
get => this.isLocked;
124+
set => this.RaiseAndSetIfChanged(ref this.isLocked, value);
125+
}
72126

73127
/// <summary>
74128
/// Gets or sets a value indicating whether the thing is marked as hidden
75129
/// </summary>
76-
public bool IsHidden { get; set; } = false;
130+
public bool IsHidden
131+
{
132+
get => this.isHidden;
133+
set => this.RaiseAndSetIfChanged(ref this.isHidden, value);
134+
}
77135
}
78136
}

0 commit comments

Comments
 (0)