Skip to content

Commit 0030b88

Browse files
author
Georgy Levchenko
committed
Added default tooltip.
1 parent ebbe843 commit 0030b88

File tree

9 files changed

+36
-88
lines changed

9 files changed

+36
-88
lines changed

src/Modules/SmartThermo.Modules.Analytics/SmartThermo.Modules.Analytics.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<PackageReference Include="ScottPlot.WPF" Version="4.1.10-beta" />
1111
</ItemGroup>
1212
<ItemGroup>
13+
<ProjectReference Include="..\..\DataAccess\SmartThermo.DataAccess.Sqlite\SmartThermo.DataAccess.Sqlite.csproj" />
1314
<ProjectReference Include="..\..\SmartThermo.Core\SmartThermo.Core.csproj" />
1415
</ItemGroup>
1516
</Project>
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Prism.Commands;
22
using Prism.Regions;
33
using Prism.Services.Dialogs;
4-
using SmartThermo.Core.Extensions;
54
using SmartThermo.Core.Mvvm;
65
using SmartThermo.Services.DeviceConnector;
76
using SmartThermo.Services.Notifications;
@@ -15,16 +14,7 @@ public class AnalyticsWindowViewModel : RegionViewModelBase
1514
public AnalyticsWindowViewModel(IRegionManager regionManager, IDeviceConnector deviceConnector, INotifications notifications, IDialogService dialogService)
1615
: base(regionManager, deviceConnector, notifications, dialogService)
1716
{
18-
SetSessionCommand = new DelegateCommand(SetSessionExecute);
19-
}
2017

21-
private void SetSessionExecute()
22-
{
23-
DialogService.ShowNotification("SessionDialog", r =>
24-
{
25-
if (r.Result == ButtonResult.None)
26-
Notifications.ShowInformation("Операция прервана пользователем.");
27-
});
2818
}
2919
}
3020
}

src/Modules/SmartThermo.Modules.Analytics/Views/AnalyticsWindow.xaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
Background="{DynamicResource SystemControlPageBackgroundChromeLowBrush}"
1414
mc:Ignorable="d">
1515
<Grid>
16-
<Grid.RowDefinitions>
17-
<RowDefinition Height="Auto" />
18-
<RowDefinition />
19-
</Grid.RowDefinitions>
20-
21-
<StackPanel Margin="0,12,0,8" Orientation="Horizontal">
22-
<Button Content="Выбрать сессию" Command="{Binding SetSessionCommand}" />
23-
<Separator Margin="8" />
24-
<TextBlock
25-
Margin="8"
26-
HorizontalAlignment="Center"
27-
VerticalAlignment="Center"
28-
Text="Текущая сессия: 1212" />
29-
</StackPanel>
30-
3116
<WpfPlot Grid.Row="1" Margin="0,8,0,0" />
3217
</Grid>
3318
</UserControl>

src/Modules/SmartThermo.Modules.DataViewer/Views/Represent/LoadDataViewerWindow.xaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:SmartThermo.Modules.DataViewer.Views.Represent"
67
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
78
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
89
xmlns:prism="http://prismlibrary.com/"
@@ -36,7 +37,6 @@
3637
<Grid Margin="0,8,8,8" Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
3738
<lvc:CartesianChart
3839
Margin="8"
39-
DataTooltip="{x:Null}"
4040
DisableAnimations="True"
4141
FontSize="12"
4242
Hoverable="False"
@@ -150,6 +150,9 @@
150150
</Setter>
151151
</Style>
152152
</lvc:CartesianChart.Style>
153+
<lvc:CartesianChart.DataTooltip>
154+
<lvc:DefaultTooltip Background="{DynamicResource SystemControlPageBackgroundChromeMediumLowBrush}" />
155+
</lvc:CartesianChart.DataTooltip>
153156
</lvc:CartesianChart>
154157
</Grid>
155158
<Grid
@@ -159,7 +162,6 @@
159162
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
160163
<lvc:CartesianChart
161164
Margin="8"
162-
DataTooltip="{x:Null}"
163165
DisableAnimations="True"
164166
FontSize="12"
165167
Hoverable="False"
@@ -273,6 +275,9 @@
273275
</Setter>
274276
</Style>
275277
</lvc:CartesianChart.Style>
278+
<lvc:CartesianChart.DataTooltip>
279+
<lvc:DefaultTooltip Background="{DynamicResource SystemControlPageBackgroundChromeMediumLowBrush}" />
280+
</lvc:CartesianChart.DataTooltip>
276281
</lvc:CartesianChart>
277282
</Grid>
278283
<Grid
@@ -282,7 +287,6 @@
282287
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
283288
<lvc:CartesianChart
284289
Margin="8"
285-
DataTooltip="{x:Null}"
286290
DisableAnimations="True"
287291
FontSize="12"
288292
Hoverable="False"
@@ -396,16 +400,18 @@
396400
</Setter>
397401
</Style>
398402
</lvc:CartesianChart.Style>
403+
<lvc:CartesianChart.DataTooltip>
404+
<lvc:DefaultTooltip Background="{DynamicResource SystemControlPageBackgroundChromeMediumLowBrush}" />
405+
</lvc:CartesianChart.DataTooltip>
399406
</lvc:CartesianChart>
400407
</Grid>
401408
<Grid
402409
Grid.Row="1"
403410
Grid.Column="0"
404-
Margin="8"
411+
Margin="0,8,8,0"
405412
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
406413
<lvc:CartesianChart
407414
Margin="8"
408-
DataTooltip="{x:Null}"
409415
DisableAnimations="True"
410416
FontSize="12"
411417
Hoverable="False"
@@ -519,16 +525,18 @@
519525
</Setter>
520526
</Style>
521527
</lvc:CartesianChart.Style>
528+
<lvc:CartesianChart.DataTooltip>
529+
<lvc:DefaultTooltip Background="{DynamicResource SystemControlPageBackgroundChromeMediumLowBrush}" />
530+
</lvc:CartesianChart.DataTooltip>
522531
</lvc:CartesianChart>
523532
</Grid>
524533
<Grid
525534
Grid.Row="1"
526535
Grid.Column="1"
527-
Margin="8"
536+
Margin="8,8,8,0"
528537
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
529538
<lvc:CartesianChart
530539
Margin="8"
531-
DataTooltip="{x:Null}"
532540
DisableAnimations="True"
533541
FontSize="12"
534542
Hoverable="False"
@@ -642,16 +650,18 @@
642650
</Setter>
643651
</Style>
644652
</lvc:CartesianChart.Style>
653+
<lvc:CartesianChart.DataTooltip>
654+
<lvc:DefaultTooltip Background="{DynamicResource SystemControlPageBackgroundChromeMediumLowBrush}" />
655+
</lvc:CartesianChart.DataTooltip>
645656
</lvc:CartesianChart>
646657
</Grid>
647658
<Grid
648659
Grid.Row="1"
649660
Grid.Column="2"
650-
Margin="8"
661+
Margin="8,8,8,0"
651662
Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}">
652663
<lvc:CartesianChart
653664
Margin="8"
654-
DataTooltip="{x:Null}"
655665
DisableAnimations="True"
656666
FontSize="12"
657667
Hoverable="False"
@@ -765,6 +775,9 @@
765775
</Setter>
766776
</Style>
767777
</lvc:CartesianChart.Style>
778+
<lvc:CartesianChart.DataTooltip>
779+
<lvc:DefaultTooltip Background="{DynamicResource SystemControlPageBackgroundChromeMediumLowBrush}" />
780+
</lvc:CartesianChart.DataTooltip>
768781
</lvc:CartesianChart>
769782
</Grid>
770783
</Grid>
@@ -773,7 +786,6 @@
773786
Grid.Column="1"
774787
Margin="0,8,0,0"
775788
Background="{DynamicResource SystemControlBackgroundBaseMediumLowBrush}" />
776-
777789
<DataGrid
778790
Grid.Column="2"
779791
Padding="8,8,0,0"

src/Modules/SmartThermo.Modules.Dialog.SettingsDevice/ViewModels/SettingsDeviceDialogViewModel.cs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Prism.Commands;
2-
using Prism.Mvvm;
32
using Prism.Services.Dialogs;
43
using SmartThermo.Core.Extensions;
4+
using SmartThermo.Core.Mvvm;
55
using SmartThermo.Modules.Dialog.SettingsDevice.Enums;
66
using SmartThermo.Modules.Dialog.SettingsDevice.Models;
77
using SmartThermo.Modules.Dialog.SettingsPort.Enums;
@@ -17,14 +17,8 @@
1717

1818
namespace SmartThermo.Modules.Dialog.SettingsDevice.ViewModels
1919
{
20-
public class SettingsDeviceDialogViewModel : BindableBase, IDialogAware
20+
public class SettingsDeviceDialogViewModel : DialogViewModelBase
2121
{
22-
#region Event
23-
24-
public event Action<IDialogResult> RequestClose;
25-
26-
#endregion
27-
2822
#region Field
2923

3024
private readonly IDeviceConnector _deviceConnector;
@@ -164,8 +158,6 @@ public bool IsEnable
164158
set => SetProperty(ref _isEnable, value);
165159
}
166160

167-
public string Title => string.Empty;
168-
169161
public DelegateCommand WriteCommand { get; }
170162

171163
public DelegateCommand CancelCommand { get; }
@@ -279,12 +271,12 @@ private async void WriteExecute()
279271
}
280272

281273
if (!isSuccessful)
282-
RequestClose?.Invoke(new DialogResult(ButtonResult.None));
274+
RaiseRequestClose(new DialogResult(ButtonResult.None));
283275
}
284276

285277
private void CancelExecute()
286278
{
287-
RequestClose?.Invoke(new DialogResult(_isSettingsSet ? ButtonResult.None : ButtonResult.Cancel));
279+
RaiseRequestClose(new DialogResult(_isSettingsSet ? ButtonResult.None : ButtonResult.Cancel));
288280
}
289281

290282
private void UpdateGroupCheckItems(int value)
@@ -331,12 +323,7 @@ private void SetGroupCheckItems()
331323
_dataGroupCheckItems[_relayNumberSelected - 1] = data;
332324
}
333325

334-
public void OnDialogClosed()
335-
{
336-
337-
}
338-
339-
public void OnDialogOpened(IDialogParameters parameters)
326+
public override void OnDialogOpened(IDialogParameters parameters)
340327
{
341328
GetDeviceSettingsAsync();
342329
}
@@ -382,8 +369,6 @@ private void GetDeviceSettingsAsync()
382369
};
383370
}
384371

385-
public bool CanCloseDialog() => true;
386-
387372
#endregion
388373
}
389374
}

src/Modules/SmartThermo.Modules.Dialog.SettingsPort/SmartThermo.Modules.Dialog.SettingsPort.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ItemGroup>
1212
<ProjectReference Include="..\..\Services\SmartThermo.Services.DeviceConnector\SmartThermo.Services.DeviceConnector.csproj" />
1313
<ProjectReference Include="..\..\Services\SmartThermo.Services.Notifications\SmartThermo.Services.Notifications.csproj" />
14+
<ProjectReference Include="..\..\SmartThermo.Core\SmartThermo.Core.csproj" />
1415
</ItemGroup>
1516
<ItemGroup>
1617
<Reference Include="ToastNotifications">

src/Modules/SmartThermo.Modules.Dialog.SettingsPort/ViewModels/SettingsPortDialogViewModel.cs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Prism.Commands;
2-
using Prism.Mvvm;
32
using Prism.Services.Dialogs;
3+
using SmartThermo.Core.Mvvm;
44
using SmartThermo.Modules.Dialog.SettingsPort.Enums;
55
using SmartThermo.Services.DeviceConnector;
66
using SmartThermo.Services.DeviceConnector.Models;
@@ -13,14 +13,8 @@
1313

1414
namespace SmartThermo.Modules.Dialog.SettingsPort.ViewModels
1515
{
16-
public class SettingsPortDialogViewModel : BindableBase, IDialogAware
16+
public class SettingsPortDialogViewModel : DialogViewModelBase
1717
{
18-
#region Event
19-
20-
public event Action<IDialogResult> RequestClose;
21-
22-
#endregion
23-
2418
#region Field
2519

2620
private readonly IDeviceConnector _deviceConnector;
@@ -48,8 +42,6 @@ public bool IsEnable
4842
set => SetProperty(ref _isEnable, value);
4943
}
5044

51-
public string Title => string.Empty;
52-
5345
public byte AddressDeviceSelected
5446
{
5547
get => _addressDeviceSelected;
@@ -151,10 +143,10 @@ private async void ConnectExecute()
151143
IsEnable = true;
152144
}
153145

154-
RequestClose?.Invoke(new DialogResult(ButtonResult.None));
146+
RaiseRequestClose(new DialogResult(ButtonResult.None));
155147
}
156148

157-
private void CancelExecute() => RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
149+
private void CancelExecute() => RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
158150

159151
private void UploadingDataSources()
160152
{
@@ -174,18 +166,6 @@ private void SetDefaultSettings()
174166
ParitySelected = Parity.None;
175167
}
176168

177-
public void OnDialogClosed()
178-
{
179-
180-
}
181-
182-
public void OnDialogOpened(IDialogParameters parameters)
183-
{
184-
185-
}
186-
187-
public bool CanCloseDialog() => true;
188-
189169
#endregion
190170
}
191171
}

src/SmartThermo.Core/Mvvm/DialogViewModelBase.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class DialogViewModelBase : BindableBase, IDialogAware
99
public event Action<IDialogResult> RequestClose;
1010

1111
private string _iconSource;
12-
private string _title;
12+
private string _title = string.Empty;
1313

1414
public string IconSource
1515
{
@@ -23,15 +23,12 @@ public string Title
2323
set => SetProperty(ref _title, value);
2424
}
2525

26-
public virtual void RaiseRequestClose(IDialogResult dialogResult)
26+
protected void RaiseRequestClose(IDialogResult dialogResult)
2727
{
2828
RequestClose?.Invoke(dialogResult);
2929
}
3030

31-
public virtual bool CanCloseDialog()
32-
{
33-
return true;
34-
}
31+
public virtual bool CanCloseDialog() => true;
3532

3633
public virtual void OnDialogClosed()
3734
{

src/SmartThermo/App.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,5 @@ protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
6363
// -Вынести стили диалоговых окон.
6464
// -Загрузка данных для Analytics.
6565
// -Переделка дизайна для Analytics и диалогового окна.
66-
// -Сброс масштаба графиков.
67-
// -Tooltip для графиков.
68-
// -Перенос базового класса диалоговых окон.
6966
}
7067
}

0 commit comments

Comments
 (0)