Skip to content

Commit 2e5380e

Browse files
committed
Adjust DiskInfoViewer for dynamic disk changes.
1 parent 2eec024 commit 2e5380e

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

DiskInfoViewer/ModelAbstraction/StorageVM.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public StorageVM(Storage storage)
3737
SerialNumber = Storage.SerialNumber ;
3838

3939
Smart = new(storage.Smart);
40+
41+
IsDynamicDisk = Storage.IsDynamicDisk;
42+
TotalFreeSize = Storage.TotalFreeSize;
4043
}
4144

4245
#endregion
@@ -70,6 +73,12 @@ public StorageVM(Storage storage)
7073
[ObservableProperty]
7174
SmartInfoVM _smart;
7275

76+
[ObservableProperty]
77+
bool _isDynamicDisk;
78+
79+
[ObservableProperty]
80+
ulong _totalFreeSize;
81+
7382
[ObservableProperty]
7483
ObservableCollection<PartitionVM> _partitions = new();
7584

@@ -125,6 +134,9 @@ public void Update()
125134
{
126135
Partitions.Remove(remove);
127136
}
137+
138+
IsDynamicDisk = Storage.IsDynamicDisk;
139+
TotalFreeSize = Storage.TotalFreeSize;
128140
}
129141

130142
#endregion

DiskInfoViewer/Views/StorageView.axaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
IsVisible="{Binding Storage.Smart.Life, Converter={x:Static ObjectConverters.IsNotNull}}"/>
3737
<TextBlock Text="Temperature"/>
3838
<TextBlock Text="{Binding Storage.Smart.Temperature, StringFormat='{}{0}°C'}"/>
39+
<TextBlock Text="Disk Status"/>
40+
<TextBlock Text="{Binding Storage.Smart.DiskStatus}"/>
3941
</StackPanel>
4042

4143
<StackPanel Grid.Row="1" Grid.Column="1">
@@ -51,6 +53,7 @@
5153
<RowDefinition/>
5254
<RowDefinition/>
5355
<RowDefinition/>
56+
<RowDefinition/>
5457
</Grid.RowDefinitions>
5558
<Grid.ColumnDefinitions>
5659
<ColumnDefinition/>
@@ -75,11 +78,16 @@
7578
<CheckBox Grid.Row="2" Grid.Column="2" IsChecked="{Binding Storage.ShowSerialNumber}"
7679
ToolTip.Tip="Show serial number"/>
7780

78-
<TextBlock Grid.Row="3" Grid.Column="0" Text="Total size in bytes"/>
79-
<TextBox Grid.Row="3" Grid.Column="1" IsReadOnly="True" Text="{Binding Storage.TotalSize, Mode=OneWay, StringFormat='{}{0:N0}'}"/>
81+
<TextBlock Grid.Row="3" Grid.Column="0" Text="Storage bus type"/>
82+
<TextBox Grid.Row="3" Grid.Column="1" IsReadOnly="True" Text="{Binding Storage.BusType}"/>
83+
84+
<TextBlock Grid.Row="4" Grid.Column="0" Text="Total free size in bytes"
85+
IsVisible="{Binding !Storage.IsDynamicDisk}"/>
86+
<TextBox Grid.Row="4" Grid.Column="1" IsReadOnly="True" Text="{Binding Storage.TotalFreeSize, Mode=OneWay, StringFormat='{}{0:N0}'}"
87+
IsVisible="{Binding !Storage.IsDynamicDisk}"/>
8088

81-
<TextBlock Grid.Row="4" Grid.Column="0" Text="Storage bus type"/>
82-
<TextBox Grid.Row="4" Grid.Column="1" IsReadOnly="True" Text="{Binding Storage.BusType}"/>
89+
<TextBlock Grid.Row="5" Grid.Column="0" Text="Total size in bytes"/>
90+
<TextBox Grid.Row="5" Grid.Column="1" IsReadOnly="True" Text="{Binding Storage.TotalSize, Mode=OneWay, StringFormat='{}{0:N0}'}"/>
8391

8492
<TextBlock Grid.Row="0" Grid.Column="3" Text="VendorID"
8593
IsVisible="{Binding Storage.VendorID, Converter={x:Static ObjectConverters.IsNotNull}}"/>
@@ -104,7 +112,8 @@
104112
</ctrl:GridEx>
105113
</StackPanel>
106114

107-
<ctrl:GridEx Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
115+
<ctrl:GridEx Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
116+
IsVisible="{Binding !Storage.IsDynamicDisk}">
108117
<Grid.RowDefinitions>
109118
<RowDefinition Height="Auto"/>
110119
<RowDefinition/>

0 commit comments

Comments
 (0)