aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-08-26 10:55:44 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-08-26 10:55:44 +0300
commit6e2fbaffeec9d6e3518ea9706eea107a4f1b348c (patch)
treef50b3d8962dd37188061f8f52c1a7aeff1642232 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging
parentdb3dc558ec5fe5f3584081795865cd22f912da7d (diff)
parente6704dce7a2b7f6d5f9bbf1b8374cc7f00ea061e (diff)
downloadTango-6e2fbaffeec9d6e3518ea9706eea107a4f1b348c.tar.gz
Tango-6e2fbaffeec9d6e3518ea9706eea107a4f1b348c.zip
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs74
4 files changed, 45 insertions, 37 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config
index 2031d1be1..2031d386f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/App.config
@@ -56,6 +56,10 @@
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs
index 8f69fb919..f0713376c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Properties/AssemblyInfo.cs
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("Tango - Machine Studio Logging Module")]
-[assembly: AssemblyVersion("2.0.15.1633")]
+[assembly: AssemblyVersion("2.0.17.1159")]
[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
index f3318f275..f14bfade4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Tango.MachineStudio.Logging.csproj
@@ -8,7 +8,7 @@
<OutputType>library</OutputType>
<RootNamespace>Tango.MachineStudio.Logging</RootNamespace>
<AssemblyName>Tango.MachineStudio.Logging</AssemblyName>
- <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs
index 50caced63..68094d91f 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs
@@ -14,6 +14,7 @@ using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Logging.Navigation;
using Tango.MachineStudio.Logging.Views;
using Tango.SharedUI;
+using System.Data.Entity;
namespace Tango.MachineStudio.Logging.ViewModels
{
@@ -23,15 +24,22 @@ namespace Tango.MachineStudio.Logging.ViewModels
private IStudioApplicationManager _application;
private IEventLogger _eventLogger;
private ObservableCollection<MachinesEvent> _realTimeEvents;
- private Machine _connectedMachine;
private LoggingNavigationManager _navigation;
private bool _dialog_shown;
+ private ObservablesContext _db;
+ private List<MachinesEvent> _history_events;
private Machine _selectedMachine;
public Machine SelectedMachine
{
get { return _selectedMachine; }
- set { _selectedMachine = value; RaisePropertyChangedAuto(); OnSelectedMachineChanged(); }
+ set
+ {
+ if (_selectedMachine != value)
+ {
+ _selectedMachine = value; RaisePropertyChangedAuto(); OnSelectedMachineChanged();
+ }
+ }
}
private ObservableCollection<MachinesEvent> _events;
@@ -76,7 +84,6 @@ namespace Tango.MachineStudio.Logging.ViewModels
set { _maxDate = value; RaisePropertyChangedAuto(); }
}
-
private bool _isRealTime;
public bool IsRealTime
{
@@ -109,25 +116,11 @@ namespace Tango.MachineStudio.Logging.ViewModels
_realTimeEvents = new ObservableCollection<MachinesEvent>();
_eventLogger.NewLog += _eventLogger_NewLog;
- RegisterMessage<MachineConnectionChangedMessage>(OnMachineConnectionChanged);
DisplayTimelineCommand = new RelayCommand<MachinesEvent>(DisplayTimeline);
NavigateToEventsCommand = new RelayCommand(() => _navigation.NavigateTo(LoggingNavigationView.EventsView));
NavigateToHomeCommand = new RelayCommand(() => _navigation.NavigateTo(LoggingNavigationView.HomeView));
}
- private void OnMachineConnectionChanged(MachineConnectionChangedMessage msg)
- {
- if (msg.Machine != null)
- {
- _connectedMachine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == msg.Machine.SerialNumber);
- SelectedMachine = _connectedMachine;
- }
- else
- {
- _connectedMachine = null;
- }
- }
-
private void _eventLogger_NewLog(object sender, MachinesEvent machineEvent)
{
InvokeUI(() =>
@@ -136,29 +129,40 @@ namespace Tango.MachineStudio.Logging.ViewModels
});
}
- private void OnSelectedMachineChanged()
+ private async void OnSelectedMachineChanged()
{
if (SelectedMachine != null)
{
- Dates = new ObservableCollection<DateTime>();
-
- if (SelectedMachine == _connectedMachine)
+ using (_notification.PushTaskItem("Loading machine events..."))
{
- IsRealTime = true;
- }
+ await Task.Factory.StartNew(() =>
+ {
+ _db = ObservablesContext.CreateDefault();
- foreach (var day in SelectedMachine.MachinesEvents.GroupBy(x => x.DateTime.DayOfYear).Select(x => x.First().DateTime).OrderByDescending(x => x))
- {
- Dates.Add(day);
- }
+ _db.EventTypes.Load();
+ _db.EventTypesCategories.Load();
+ _db.EventTypesGroups.Load();
- if (Dates.Count > 0)
- {
- MinDate = Dates.Min();
- MaxDate = Dates.Max();
- }
+ DateTime now = DateTime.UtcNow.AddMonths(-1);
- SelectedDate = Dates.FirstOrDefault();
+ _history_events = _db.MachinesEvents.Where(x => x.MachineGuid == SelectedMachine.Guid && x.DateTime > now).ToList();
+
+ Dates = new ObservableCollection<DateTime>();
+
+ foreach (var day in _history_events.GroupBy(x => x.DateTime.DayOfYear).Select(x => x.First().DateTime).OrderByDescending(x => x))
+ {
+ Dates.Add(day);
+ }
+
+ if (Dates.Count > 0)
+ {
+ MinDate = Dates.Min();
+ MaxDate = Dates.Max();
+ }
+
+ SelectedDate = Dates.FirstOrDefault();
+ });
+ }
}
}
@@ -170,9 +174,9 @@ namespace Tango.MachineStudio.Logging.ViewModels
{
Events = _realTimeEvents;
}
- else
+ else if (_history_events != null)
{
- Events = SelectedMachine.MachinesEvents.Where(x => x.DateTime.DayOfYear == SelectedDate.Date.DayOfYear).OrderByDescending(x => x.DateTime).ToObservableCollection();
+ Events = _history_events.Where(x => x.DateTime.DayOfYear == SelectedDate.Date.DayOfYear).OrderByDescending(x => x.DateTime).ToObservableCollection();
}
}
}