Skip to content

Commit

Permalink
Update library.
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxTes committed Mar 27, 2021
1 parent 90e58b4 commit baaaa89
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<Grid Margin="16,16,16,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280" />
<ColumnDefinition Width="320" />
<ColumnDefinition Width="24" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>SmartThermo.Modules.Analytics</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ModernWpfUI" Version="0.9.3" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Prism.Wpf" Version="8.0.0.1909" />
<PackageReference Include="ScottPlot.WPF" Version="4.1.10-beta" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,56 +220,75 @@ private void SelectSessionExecute()

DialogService.ShowNotification("SessionDialog", async r =>
{
if (r.Result == ButtonResult.Cancel)
Notifications.ShowInformation("Операция прервана пользователем.");
else if (r.Result == ButtonResult.OK)
switch (r.Result)
{
var isLoadCurrentSession = r.Parameters.GetValue<bool>("CheckCurrentSession");
_currentSessionId = r.Parameters.GetValue<int>("SessionItemSelected");

if (isLoadCurrentSession)
case ButtonResult.Cancel:
Notifications.ShowInformation("Операция прервана пользователем.");
break;
case ButtonResult.OK:
{
if (_isLoadCurrentSession)
return;

await GetIdGroupsSensorAsync();
await GetSensorDataAsync();
var isLoadCurrentSession = r.Parameters.GetValue<bool>("CheckCurrentSession");
_currentSessionId = r.Parameters.GetValue<int>("SessionItemSelected");

Notifications.ShowSuccess($"Загружена текущая сессия.");
_isLoadCurrentSession = true;
}
else
{
var dataCreateTask = Task.Run(() =>
if (isLoadCurrentSession)
{
using var context = new Context();
return context.Sessions
.Where(x => x.Id == _currentSessionId)
.Select(x => x.DateCreate)
.FirstOrDefault();
});
await Task.WhenAll(dataCreateTask);
DateCreateSession = dataCreateTask.Result
.Round(TimeSpan.FromSeconds(1))
.ToString(CultureInfo.InvariantCulture);

var groupIdTask = Task.Run(() =>
if (_isLoadCurrentSession)
return;

await GetIdGroupsSensorAsync();
await GetSensorDataAsync();

Notifications.ShowSuccess($"Загружена текущая сессия.");
_isLoadCurrentSession = true;
}
else
{
using var context = new Context();
return context.GroupSensors
.Where(x => x.SessionId == _currentSessionId)
.Select(x => x.Id)
.ToList();
});
await Task.WhenAll(groupIdTask);

_groupSensorId.Clear();
_groupSensorId.AddRange(groupIdTask.Result);

await GetSensorDataAsync();
Notifications.ShowSuccess($"Загружена сессия от {DateCreateSession}.");
_isLoadCurrentSession = false;
var dataCreateTask = Task.Run(() =>
{
using var context = new Context();
return context.Sessions
.Where(x => x.Id == _currentSessionId)
.Select(x => x.DateCreate)
.FirstOrDefault();
});
await Task.WhenAll(dataCreateTask);
DateCreateSession = dataCreateTask.Result
.Round(TimeSpan.FromSeconds(1))
.ToString(CultureInfo.InvariantCulture);

var groupIdTask = Task.Run(() =>
{
using var context = new Context();
return context.GroupSensors
.Where(x => x.SessionId == _currentSessionId)
.Select(x => x.Id)
.ToList();
});
await Task.WhenAll(groupIdTask);

_groupSensorId.Clear();
_groupSensorId.AddRange(groupIdTask.Result);

await GetSensorDataAsync();
Notifications.ShowSuccess($"Загружена сессия от {DateCreateSession}.");
_isLoadCurrentSession = false;
}
break;
}
case ButtonResult.Abort:
break;
case ButtonResult.Ignore:
break;
case ButtonResult.No:
break;
case ButtonResult.None:
break;
case ButtonResult.Retry:
break;
case ButtonResult.Yes:
break;
default:
throw new ArgumentOutOfRangeException();
}
}, parameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LiveCharts.Wpf.Core" Version="0.9.8" />
<PackageReference Include="ModernWpfUI" Version="0.9.3" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Prism.Wpf" Version="8.0.0.1909" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Windows;
using System.Windows.Data;
using System.Windows.Threading;
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;

namespace SmartThermo.Modules.DataViewer.ViewModels.Represent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>SmartThermo.Modules.Dialog.SettingsDevice</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ModernWpfUI" Version="0.9.3" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Prism.Wpf" Version="8.0.0.1909" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>SmartThermo.Modules.Dialog.SettingsPort</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ModernWpfUI" Version="0.9.3" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Prism.Wpf" Version="8.0.0.1909" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public class DeviceConnectorTest : IDeviceConnector
#region Event

public event EventHandler<StatusConnect> StatusConnectChanged;

public event EventHandler<List<SensorInfoEventArgs>> RegistersRequested;

public event EventHandler<SettingDeviceEventArgs> SettingDeviceChanged;

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<ItemGroup>
<PackageReference Include="NModbus" Version="3.0.62" />
<PackageReference Include="NModbus.Serial" Version="3.0.62" />
<PackageReference Include="System.IO.Ports" Version="5.0.0" />
<PackageReference Include="System.IO.Ports" Version="5.0.1" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ namespace SmartThermo.Services.Notifications
public interface INotifications
{
void OnUnloaded();

void ShowInformation(string message);

void ShowInformation(string message, MessageOptions opts);

void ShowSuccess(string message);

void ShowSuccess(string message, MessageOptions opts);

void ClearMessages(string msg);

void ShowWarning(string message, MessageOptions opts);

void ShowError(string message);

void ShowError(string message, MessageOptions opts);

void ClearAll();
}
}

This file was deleted.

3 changes: 2 additions & 1 deletion src/SmartThermo.Core/Extensions/DialogServiceExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace SmartThermo.Core.Extensions
{
public static class DialogServiceExtension
{
public static void ShowNotification(this IDialogService dialogService, string name, Action<IDialogResult> callBack, DialogParameters dialogParameters = null)
public static void ShowNotification(this IDialogService dialogService, string name,
Action<IDialogResult> callBack, DialogParameters dialogParameters = null)
{
dialogService.ShowDialog(name, dialogParameters, callBack);
}
Expand Down
5 changes: 4 additions & 1 deletion src/SmartThermo/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
moduleCatalog.AddModule<AnalyticsModule>();
}

// -Analytics и диалогового окна.
// -Tooltip и легенда для аналитики.
// -Margin для всех.
// -Перевод графика во дата.
// -Запись null значений.
// -Выбор сессию (нет значений, если count ==0).
// -About изменить.
// -Refactoring имен для всех модулей.
}
}
2 changes: 1 addition & 1 deletion src/SmartThermo/SmartThermo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ModernWpfUI" Version="0.9.3" />
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="NModbus" Version="3.0.62" />
<PackageReference Include="NModbus.Serial" Version="3.0.62" />
<PackageReference Include="Prism.Core" Version="8.0.0.1909" />
Expand Down

0 comments on commit baaaa89

Please sign in to comment.