From 97ea085d1fac43aedc5258486ef355eb13abc195 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 13 Dec 2018 17:16:43 +0200 Subject: Fixed issues in segment indices !!! Fixed issue with PPC fine tuning. Added support to Twine & Panton in color conversion. --- .../Converters/JobToColumnDefinitionsConverter.cs | 2 +- .../Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs | 8 ++++++-- .../Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.cs index 0aadeca68..2ce5886c6 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/JobToColumnDefinitionsConverter.cs @@ -21,7 +21,7 @@ namespace Tango.MachineStudio.Developer.Converters double totalLength = job.Segments.Sum(x => x.Length); - foreach (var segment in job.Segments) + foreach (var segment in job.OrderedSegments) { columns.Add(new ColumnDefinition() { Width = new GridLength(segment.Length / totalLength, GridUnitType.Star) }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index b75a84a6c..55ef56ce4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1708,7 +1708,7 @@ namespace Tango.MachineStudio.Developer.ViewModels LogManager.Log("Setting selected segment..."); - _selectedSegment = ActiveJob.Segments.FirstOrDefault(); + _selectedSegment = ActiveJob.OrderedSegments.FirstOrDefault(); ActiveJob.LengthChanged -= ActiveJob_LengthChanged; ActiveJob.LengthChanged += ActiveJob_LengthChanged; @@ -2153,10 +2153,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.LogFormat("Duplicating {0} segments...", SelectedSegments.Count); + int start_index = SelectedSegments.Max(x => x.SegmentIndex); + + ActiveJob.Segments.Where(x => x.SegmentIndex > start_index).ToList().ForEach(x => x.SegmentIndex = x.SegmentIndex + SelectedSegments.Count); + foreach (var segment in SelectedSegments.OrderBy(x => x.SegmentIndex)) { var cloned = segment.Clone(); - cloned.SegmentIndex = ActiveJob.Segments.Max(x => x.SegmentIndex) + 1; + cloned.SegmentIndex = start_index++; ActiveJob.Segments.Add(cloned); SelectedSegment = cloned; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs index 8c58690fd..f3af53352 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -65,11 +65,11 @@ namespace Tango.MachineStudio.Developer.Views if (_vm != null && _vm.ActiveJob != null) { List segments = new List(); - foreach (var s in _vm.ActiveJob.Segments.OrderBy(x => x.SegmentIndex)) + foreach (var s in _vm.ActiveJob.OrderedSegments) { segments.Add(s); - if (_vm.ActiveJob.EnableInterSegment && _vm.ActiveJob.Segments.IndexOf(s) != _vm.ActiveJob.Segments.Count - 1) + if (_vm.ActiveJob.EnableInterSegment && _vm.ActiveJob.OrderedSegments.IndexOf(s) != _vm.ActiveJob.OrderedSegments.Count - 1) { segments.Add(new Segment() { -- cgit v1.3.1 From ecf55f4193c0a7ab273c7e8243e446a2f2c32d51 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 16 Dec 2018 08:22:45 +0200 Subject: Working on PPC tech mode & logging module. Working on PPC date picker & calendar. Implemented no-permissions view. --- Software/Graphics/Mobile/logging_module.png | Bin 0 -> 1345 bytes Software/Graphics/Mobile/no-permissions.png | Bin 0 -> 5640 bytes .../Build/Shortcuts/Machine Emulator.lnk | Bin 1471 -> 1530 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1581 bytes .../Build/Shortcuts/Proto Compiler GUI.lnk | Bin 1464 -> 1529 bytes .../Build/Shortcuts/Stubs Execution GUI.lnk | Bin 1462 -> 1547 bytes .../Build/Shortcuts/Transport Router.lnk | Bin 1493 -> 1578 bytes .../Parsing/ApplicationLogFileParser.cs | 75 --- .../Parsing/EmbeddedLogFileParser.cs | 84 --- .../Parsing/ILogFileParser.cs | 15 - .../Tango.MachineStudio.Logging/Parsing/LogFile.cs | 15 - .../Tango.MachineStudio.Logging.csproj | 6 +- .../ViewModels/ApplicationLogsViewVM.cs | 2 - .../ViewModels/EmbeddedLogsViewVM.cs | 2 +- .../PPC/Modules/Tango.PPC.Logging/App.xaml | 11 + .../Tango.PPC.Logging/Images/logging_module.png | Bin 0 -> 1345 bytes .../PPC/Modules/Tango.PPC.Logging/LoggingModule.cs | 47 ++ .../Tango.PPC.Logging/Properties/AssemblyInfo.cs | 20 + .../Properties/Resources.Designer.cs | 62 ++ .../Tango.PPC.Logging/Properties/Resources.resx | 117 ++++ .../Properties/Settings.Designer.cs | 30 + .../Tango.PPC.Logging/Properties/Settings.settings | 7 + .../Tango.PPC.Logging/Tango.PPC.Logging.csproj | 117 ++++ .../Modules/Tango.PPC.Logging/ViewModelLocator.cs | 32 ++ .../Tango.PPC.Logging/ViewModels/MainViewVM.cs | 17 + .../Modules/Tango.PPC.Logging/Views/MainView.xaml | 45 ++ .../Tango.PPC.Logging/Views/MainView.xaml.cs | 28 + .../Application/IPPCApplicationManager.cs | 10 + .../PPC/Tango.PPC.Common/IPPCModule.cs | 15 + .../Tango.PPC.Common/Navigation/NavigationView.cs | 1 + .../PPC/Tango.PPC.Common/PPCModuleBase.cs | 26 + .../PPC/Tango.PPC.UI/Images/no-permissions.png | Bin 0 -> 5640 bytes .../PPC/Tango.PPC.UI/MainWindow.xaml.cs | 35 ++ .../Navigation/DefaultNavigationManager.cs | 16 +- .../PPCApplication/DefaultPPCApplicationManager.cs | 26 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 15 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 9 + .../PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs | 2 + .../PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs | 18 +- .../Tango.PPC.UI/ViewModels/NoPermissionsViewVM.cs | 30 + .../PPC/Tango.PPC.UI/Views/LayoutView.xaml | 16 +- .../PPC/Tango.PPC.UI/Views/MainView.xaml | 1 + .../PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml | 27 + .../Tango.PPC.UI/Views/NoPermissionsView.xaml.cs | 28 + .../Logging/EmbeddedLogFileParser.cs | 84 +++ .../Tango.Integration/Logging/EmbeddedLogItem.cs | 71 +++ .../Tango.Integration/Operation/EmbeddedLogItem.cs | 71 --- .../Tango.Integration/Operation/MachineOperator.cs | 1 + .../Tango.Integration/Tango.Integration.csproj | 5 +- .../Tango.Logging/ApplicationLogFileParser.cs | 75 +++ .../Visual_Studio/Tango.Logging/ILogFileParser.cs | 15 + Software/Visual_Studio/Tango.Logging/LogFile.cs | 15 + .../Tango.Logging/Tango.Logging.csproj | 5 +- .../Tango.Touch/Controls/TouchCalendar.cs | 30 + .../Tango.Touch/Controls/TouchCalendar.xaml | 634 +++++++++++++++++++++ .../Tango.Touch/Controls/TouchComboBox.xaml | 1 - .../Tango.Touch/Controls/TouchDatePicker.cs | 57 ++ .../Tango.Touch/Controls/TouchDatePicker.xaml | 123 ++++ .../Tango.Touch/Controls/TouchPanel.cs | 70 +++ .../Tango.Touch/Controls/TouchPanel.xaml | 43 ++ .../DateTimeToCalendarHeaderConverter.cs | 30 + .../Visual_Studio/Tango.Touch/Tango.Touch.csproj | 13 +- .../Visual_Studio/Tango.Touch/Themes/Generic.xaml | 2 + Software/Visual_Studio/Tango.sln | 55 +- .../Utilities/Tango.UITests/MainWindow.xaml | 14 +- 65 files changed, 2114 insertions(+), 307 deletions(-) create mode 100644 Software/Graphics/Mobile/logging_module.png create mode 100644 Software/Graphics/Mobile/no-permissions.png delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ILogFileParser.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/LogFile.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/no-permissions.png create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/NoPermissionsViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogFileParser.cs create mode 100644 Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogItem.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Operation/EmbeddedLogItem.cs create mode 100644 Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs create mode 100644 Software/Visual_Studio/Tango.Logging/ILogFileParser.cs create mode 100644 Software/Visual_Studio/Tango.Logging/LogFile.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.xaml create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.cs create mode 100644 Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.xaml create mode 100644 Software/Visual_Studio/Tango.Touch/Converters/DateTimeToCalendarHeaderConverter.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Graphics/Mobile/logging_module.png b/Software/Graphics/Mobile/logging_module.png new file mode 100644 index 000000000..3f8318f70 Binary files /dev/null and b/Software/Graphics/Mobile/logging_module.png differ diff --git a/Software/Graphics/Mobile/no-permissions.png b/Software/Graphics/Mobile/no-permissions.png new file mode 100644 index 000000000..405b94a26 Binary files /dev/null and b/Software/Graphics/Mobile/no-permissions.png differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk index 83636b215..391bb5fd2 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index fdcc9c9f3..96a6550d7 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk index bbe8a4be2..98e7572e8 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk index 8da1d6aa3..26bdb7c64 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk and b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk index 51ce1a265..355f4b364 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk and b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs deleted file mode 100644 index d3b33c436..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ApplicationLogFileParser.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Tango.Logging; - -namespace Tango.MachineStudio.Logging.Parsing -{ - public class ApplicationLogFileParser : ILogFileParser - { - public List GetLogFiles() - { - List logFiles = new List(); - - FileLogger logger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; - - String logFile = logger != null ? logger.LogFile : null; - - foreach (var file in Directory.GetFiles(FileLogger.DefaultLogsFolder, "*.log").Where(x => Path.GetFileName(x).StartsWith("Tango.MachineStudio.UI") && x != logger.LogFile)) - { - try - { - String dateString = Path.GetFileNameWithoutExtension(file).Replace("Tango.MachineStudio.UI-", ""); - DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); - logFiles.Add(new LogFile() { DateTime = date, File = file }); - } - catch (Exception ex) - { - LogManager.Default.Log(ex, $"Could not load application log file {Path.GetFileName(file)}"); - } - } - - return logFiles; - } - - public List Parse(LogFile logFile) - { - List logItems = new List(); - - String text = File.ReadAllText(logFile.File); - var logs = Regex.Split(text, @"(\[\d{2}:\d{2}:\d{2}.\d{2}\])"); - - for (int i = 1; i < logs.Length; i += 2) - { - try - { - DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture); - String rest = logs[i + 1]; - - var entries = Regex.Split(rest, @"\[(.*?)\]"); - - MessageLogItem item = new MessageLogItem(); - item.TimeStamp = new DateTime(logFile.DateTime.Year, logFile.DateTime.Month, logFile.DateTime.Day, date.Hour, date.Minute, date.Second, date.Millisecond); - item.Category = (LogCategory)Enum.Parse(typeof(LogCategory), entries[1]); - item.CallerFile = entries[3]; - item.CallerMethodName = entries[5]; - item.CallerLineNumber = int.Parse(entries[7]); - item.Message = new String(entries[8].Skip(2).ToArray()); - - logItems.Add(item); - } - catch (Exception ex) - { - LogManager.Default.Log(ex, "Could not parse log line: " + logs[i]); - } - } - - return logItems; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs deleted file mode 100644 index 50c9d7532..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/EmbeddedLogFileParser.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Tango.Integration.Operation; -using Tango.Logging; -using Tango.Settings; - -namespace Tango.MachineStudio.Logging.Parsing -{ - public class EmbeddedLogFileParser : ILogFileParser - { - public List GetLogFiles() - { - List logFiles = new List(); - - FileLogger logger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; - - String logFile = logger != null ? logger.LogFile : null; - - if (Directory.Exists(MachineOperator.EmbeddedLogsFolder)) - { - foreach (var file in Directory.GetFiles(MachineOperator.EmbeddedLogsFolder, "*.log").Where(x => x != logFile)) - { - try - { - String dateString = Path.GetFileNameWithoutExtension(file).Replace(MachineOperator.EmbeddedLogsTag + "-", ""); - DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); - logFiles.Add(new LogFile() { DateTime = date, File = file }); - } - catch (Exception ex) - { - LogManager.Default.Log(ex, $"Could not load embedded log file {Path.GetFileName(file)}"); - } - } - } - - return logFiles; - } - - public List Parse(LogFile logFile) - { - List logItems = new List(); - - String text = File.ReadAllText(logFile.File); - var logs = Regex.Split(text, @"(\[\d{2}:\d{2}:\d{2}.\d{2}\])"); - - for (int i = 1; i < logs.Length; i += 2) - { - try - { - DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture); - String rest = logs[i + 1]; - - var entries = Regex.Split(rest, @"\[(.*?)\]"); - - EmbeddedLogItem item = new EmbeddedLogItem(new PMR.Debugging.StartDebugLogResponse() - { - Category = (PMR.Debugging.DebugLogCategory)Enum.Parse(typeof(PMR.Debugging.DebugLogCategory), entries[1]), - FileName = entries[3], - LineNumber = uint.Parse(entries[5]), - ModuleId = uint.Parse(entries[7]), - Filter = uint.Parse(entries[9]), - Message = new String(entries[10].Skip(2).ToArray()) - }); - - item.TimeStamp = new DateTime(logFile.DateTime.Year, logFile.DateTime.Month, logFile.DateTime.Day, date.Hour, date.Minute, date.Second, date.Millisecond); - - logItems.Add(item); - } - catch (Exception ex) - { - LogManager.Default.Log(ex, "Could not parse log line: " + logs[i]); - } - } - - return logItems; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ILogFileParser.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ILogFileParser.cs deleted file mode 100644 index 05003c1a2..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/ILogFileParser.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.Logging.Parsing -{ - public interface ILogFileParser - { - List Parse(LogFile logFile); - - List GetLogFiles(); - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/LogFile.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/LogFile.cs deleted file mode 100644 index 4248bdbdc..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Parsing/LogFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.MachineStudio.Logging.Parsing -{ - public class LogFile - { - public DateTime DateTime { get; set; } - - public String File { get; set; } - } -} 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 b81ba731d..b5108b75a 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 @@ -83,10 +83,6 @@ - - - - @@ -254,7 +250,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs index 3e0e3ab84..91cc677e0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/ApplicationLogsViewVM.cs @@ -10,7 +10,6 @@ using Tango.Core.Commands; using Tango.Logging; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Logging.Navigation; -using Tango.MachineStudio.Logging.Parsing; using Tango.MachineStudio.Logging.Views; using Tango.SharedUI; using Tango.SharedUI.Components; @@ -105,7 +104,6 @@ namespace Tango.MachineStudio.Logging.ViewModels set { _maxDate = value; RaisePropertyChangedAuto(); } } - private bool _isRealTime; public bool IsRealTime { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs index 3f6775b75..d8ecca4bb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EmbeddedLogsViewVM.cs @@ -5,12 +5,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Integration.Logging; using Tango.Integration.Operation; using Tango.Logging; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Logging.Navigation; -using Tango.MachineStudio.Logging.Parsing; using Tango.MachineStudio.Logging.Views; using Tango.SharedUI; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml new file mode 100644 index 000000000..66ea48976 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/App.xaml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png new file mode 100644 index 000000000..3f8318f70 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Images/logging_module.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs new file mode 100644 index 000000000..78c597e81 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/LoggingModule.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Logging.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Logging +{ + [PPCModule(5)] + public class LoggingModule : PPCModuleBase + { + public override string Name => "Logging"; + public override string Description => "PPC logging module."; + public override BitmapSource Image => ResourceHelper.GetImageFromResources("Images/logging_module.png"); + public override Type MainViewType => typeof(MainView); + public override Permissions Permission => Permissions.RunPPC; + + public LoggingModule() + { + IsVisibleInMenu = false; + } + + public override void OnTechnicianEntered() + { + base.OnTechnicianEntered(); + + IsVisibleInMenu = true; + } + + public override void OnTechnicianExited() + { + base.OnTechnicianExited(); + + IsVisibleInMenu = false; + } + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..612af80ce --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango PPC Logging Module")] +[assembly: AssemblyVersion("2.0.4.1119")] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.Designer.cs new file mode 100644 index 000000000..6cbf8164a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Logging.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Logging.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.Designer.cs new file mode 100644 index 000000000..ab102e0eb --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Logging.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj new file mode 100644 index 000000000..cc6394c9f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Tango.PPC.Logging.csproj @@ -0,0 +1,117 @@ + + + + + Debug + AnyCPU + {D2EE865B-B006-487A-9487-60A663636AC3} + library + Tango.PPC.Logging + Tango.PPC.Logging + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\PPC\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\PPC\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + GlobalVersionInfo.cs + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {F441FEEE-322A-4943-B566-110E12FD3B72} + Tango.BL + + + {A34EE0F0-649D-41C8-8489-B6F1CC6924EE} + Tango.Core + + + {8491D07B-C1F6-4B62-A412-41B9FD2D6538} + Tango.SharedUI + + + {fd86424c-6e84-491b-8df9-3d0f5c236a2a} + Tango.Touch + + + {0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0} + Tango.PPC.Common + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs new file mode 100644 index 000000000..d86a0d2ab --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Logging.ViewModels; + +namespace Tango.PPC.Logging +{ + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + /// + /// Gets the main view VM. + /// + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..736bff5a2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/ViewModels/MainViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.Logging.ViewModels +{ + public class MainViewVM : PPCViewModel + { + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml new file mode 100644 index 000000000..fb4dd5d04 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + Logs + + + + + + + + Application + Embedded + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml.cs new file mode 100644 index 000000000..eb448c67c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Logging/Views/MainView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.Logging.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 003229e65..5f0b35ce2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -60,6 +60,16 @@ namespace Tango.PPC.Common.Application /// void Restart(); + /// + /// Enteres the application technician mode. + /// + void EnterTechnicianMode(); + + /// + /// Exits the application technician mode. + /// + void ExitTechnicianMode(); + /// /// Gets the application version. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs index 7bee755a2..51f361cfb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/IPPCModule.cs @@ -40,5 +40,20 @@ namespace Tango.PPC.Common /// Gets the permission required to see and load this module. /// Permissions Permission { get; } + + /// + /// Gets a value indicating whether this module should be displayed in the application menu. + /// + bool IsVisibleInMenu { get; } + + /// + /// Called when the application has entered the technician mode. + /// + void OnTechnicianEntered(); + + /// + /// Called when the application has exited the technician mode. + /// + void OnTechnicianExited(); } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs index 3c3a6e19b..2c6e8d4c1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs @@ -13,6 +13,7 @@ namespace Tango.PPC.Common.Navigation { LoadingView, LoadingErrorView, + NoPermissionsView, LayoutView, LoginView, MachineSetupView, diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs index 316236626..5aa003c1e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs @@ -17,6 +17,16 @@ namespace Tango.PPC.Common /// public abstract class PPCModuleBase : ExtendedObject, IPPCModule { + private bool _isVisibleInMenu = true; + /// + /// Gets a value indicating whether this module should be displayed in the application menu. + /// + public bool IsVisibleInMenu + { + get { return _isVisibleInMenu; } + protected set { _isVisibleInMenu = value; RaisePropertyChangedAuto(); } + } + /// /// Gets the module name. /// @@ -46,5 +56,21 @@ namespace Tango.PPC.Common /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// public abstract void Dispose(); + + /// + /// Called when the application has entered the technician mode. + /// + public virtual void OnTechnicianEntered() + { + + } + + /// + /// Called when the application has exited the technician mode. + /// + public virtual void OnTechnicianExited() + { + + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/no-permissions.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/no-permissions.png new file mode 100644 index 000000000..405b94a26 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/no-permissions.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs index 219c25f45..302e401fb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -15,6 +15,8 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.PPC.Common.Application; using Tango.Touch.Helpers; namespace Tango.PPC.UI @@ -24,6 +26,8 @@ namespace Tango.PPC.UI /// public partial class MainWindow : Window { + private String _technician_mode_buffer; + public static MainWindow Instance { get; private set; } public MainWindow() @@ -32,6 +36,8 @@ namespace Tango.PPC.UI InitializeComponent(); + _technician_mode_buffer = String.Empty; + #if !DESKTOP if (TouchHelper.IsTouchEnabled()) { @@ -62,5 +68,34 @@ namespace Tango.PPC.UI { Environment.Exit(0); } + + protected override void OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) + { + base.OnPreviewKeyDown(e); + + try + { + _technician_mode_buffer += Char.Parse(e.Key.ToString()); + } + catch{} + + if (e.Key == Key.Return || e.Key == Key.Tab) + { + if (_technician_mode_buffer.ToLower().Contains("ENTERTECHNICIAN".ToLower())) + { + _technician_mode_buffer = String.Empty; + TangoIOC.Default.GetInstance().EnterTechnicianMode(); + e.Handled = true; + } + else if (_technician_mode_buffer.ToLower().Contains("EXITTECHNICIAN".ToLower())) + { + _technician_mode_buffer = String.Empty; + TangoIOC.Default.GetInstance().ExitTechnicianMode(); + e.Handled = true; + } + + _technician_mode_buffer = String.Empty; + } + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index efe8149f6..fe3cabcc1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -90,15 +90,23 @@ namespace Tango.PPC.UI.Navigation _lastFullPath = null; var firstModule = _moduleLoader.UserModules.FirstOrDefault(); - var moduleAtt = firstModule.GetType().GetCustomAttribute(); - if (moduleAtt != null) + if (firstModule != null) { - return NavigateTo(firstModule.GetType(), pushToHistory, moduleAtt.HomeViewName); + var moduleAtt = firstModule.GetType().GetCustomAttribute(); + + if (moduleAtt != null) + { + return NavigateTo(firstModule.GetType(), pushToHistory, moduleAtt.HomeViewName); + } + else + { + return NavigateTo(firstModule.GetType(), pushToHistory); + } } else { - return NavigateTo(firstModule.GetType(), pushToHistory); + return NavigateTo(NavigationView.NoPermissionsView); } } else diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index f8a0fdc36..f9830940b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -26,6 +26,7 @@ using Tango.PPC.Common.Threading; using System.Diagnostics; using Tango.PPC.Common.EventLogging; using Tango.BL.Enumerations; +using Tango.PPC.Common.Notifications; namespace Tango.PPC.UI.PPCApplication { @@ -41,6 +42,8 @@ namespace Tango.PPC.UI.PPCApplication private Machine _machine; private IDispatcherProvider _dispatcher; private IEventLogger _eventLogger; + private IPPCModuleLoader _moduleLoader; + private INotificationProvider _notificationProvider; /// /// Occurs when the application has started. @@ -102,12 +105,13 @@ namespace Tango.PPC.UI.PPCApplication /// /// Initializes a new instance of the class. /// - public DefaultPPCApplicationManager(IMachineProvider machineProvider, IDispatcherProvider dispatcherProvider, IEventLogger eventLogger) + public DefaultPPCApplicationManager(IMachineProvider machineProvider, IDispatcherProvider dispatcherProvider, IEventLogger eventLogger, IPPCModuleLoader moduleLoader, INotificationProvider notificationProvider) { + _notificationProvider = notificationProvider; _machineProvider = machineProvider; _dispatcher = dispatcherProvider; _eventLogger = eventLogger; - ; + _moduleLoader = moduleLoader; if (!DesignMode) { @@ -320,5 +324,23 @@ namespace Tango.PPC.UI.PPCApplication Process.Start(Application.ResourceAssembly.Location); Environment.Exit(0); } + + /// + /// Enteres the application technician mode. + /// + public void EnterTechnicianMode() + { + _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianEntered()); + _notificationProvider.ShowInfo("Technician mode is now enabled."); + } + + /// + /// Exits the application technician mode. + /// + public void ExitTechnicianMode() + { + _moduleLoader.AllModules.ToList().ForEach(x => x.OnTechnicianExited()); + _notificationProvider.ShowInfo("Technician mode is now disabled."); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 406568f71..836878152 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -143,6 +143,7 @@ + @@ -170,6 +171,9 @@ MachineUpdateView.xaml + + NoPermissionsView.xaml + Designer MSBuild:Compile @@ -234,6 +238,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + @@ -339,6 +347,10 @@ {096f16c8-6d06-4b5f-9496-b9d2df2d94a3} Tango.PPC.Jobs + + {d2ee865b-b006-487a-9487-60a663636ac3} + Tango.PPC.Logging + {91b70e9b-66a7-4873-ae10-400e71cf404f} Tango.PPC.MachineSettings @@ -397,6 +409,7 @@ Tango.ColorLib.dll PreserveNewest + @@ -472,7 +485,7 @@ del "$(TargetDir)firmware_package.tfp" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 645456216..9b4c17831 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -95,6 +95,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.GetInstance().ContentRendered += (_, __) => @@ -176,5 +177,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance(); } } + + public static NoPermissionsViewVM NoPermissionsViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index 281e54958..516349a18 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -20,6 +20,7 @@ using Tango.PPC.Common.Notifications.NotificationItems; using Tango.PPC.Jobs; using Tango.SharedUI; using System.Data.Entity; +using Tango.BL.Enumerations; namespace Tango.PPC.UI.ViewModels { @@ -79,6 +80,7 @@ namespace Tango.PPC.UI.ViewModels if (db.Users.Count() == 1 || machine.AutoLogin) { var user = await db.Users.FirstAsync(); + LogManager.Log($"Application started. Single user/Auto login detected ({user.Email}). Skipping LoginView..."); await AuthenticationProvider.Login(user.Email, user.Password, false); IsLoading = false; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs index 9d17a4a76..aa9689ef3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -11,6 +11,8 @@ using System.ComponentModel.DataAnnotations; using Tango.SharedUI.Helpers; using Tango.PPC.Common.Authentication; using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Logging; namespace Tango.PPC.UI.ViewModels { @@ -89,9 +91,19 @@ namespace Tango.PPC.UI.ViewModels base.OnApplicationReady(); await Task.Delay(500); - LogManager.Log("Application is ready! Navigating to home module..."); - await NavigationManager.NavigateTo(NavigationView.HomeModule); - IsLoading = false; + + if (AuthenticationProvider.CurrentUser != null && AuthenticationProvider.CurrentUser.HasPermission(Permissions.RunPPC)) + { + LogManager.Log("Application is ready! Navigating to home module..."); + await NavigationManager.NavigateTo(NavigationView.HomeModule); + IsLoading = false; + } + else + { + LogManager.Log("Application is ready! The logged in user does not have permission to run the application!", LogCategory.Warning); + await NavigationManager.NavigateTo(NavigationView.NoPermissionsView); + IsLoading = false; + } } #endregion diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/NoPermissionsViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/NoPermissionsViewVM.cs new file mode 100644 index 000000000..cea8a7d63 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/NoPermissionsViewVM.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.PPC.Common; + +namespace Tango.PPC.UI.ViewModels +{ + public class NoPermissionsViewVM : PPCViewModel + { + public RelayCommand RestartCommand { get; set; } + + public NoPermissionsViewVM() + { + RestartCommand = new RelayCommand(Restart); + } + + private void Restart() + { + ApplicationManager.Restart(); + } + + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 98451dacb..b89b2c9de 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -49,13 +49,15 @@ - - - - - - - + + + + + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index e684f4969..9df92bbcc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -83,6 +83,7 @@ + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml new file mode 100644 index 000000000..95839453a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml @@ -0,0 +1,27 @@ + + + + + + No Application Modules Loaded + The current user does not seems to have a permission to load any of the application modules. Please contact your administrator. + + + + + RESTART + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml.cs new file mode 100644 index 000000000..0bbaee554 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/NoPermissionsView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Views +{ + /// + /// Interaction logic for NoPermissionsView.xaml + /// + public partial class NoPermissionsView : UserControl + { + public NoPermissionsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogFileParser.cs b/Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogFileParser.cs new file mode 100644 index 000000000..98a3ac543 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogFileParser.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.Logging; +using Tango.Settings; + +namespace Tango.Integration.Logging +{ + public class EmbeddedLogFileParser : ILogFileParser + { + public List GetLogFiles() + { + List logFiles = new List(); + + FileLogger logger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; + + String logFile = logger != null ? logger.LogFile : null; + + if (Directory.Exists(MachineOperator.EmbeddedLogsFolder)) + { + foreach (var file in Directory.GetFiles(MachineOperator.EmbeddedLogsFolder, "*.log").Where(x => x != logFile)) + { + try + { + String dateString = Path.GetFileNameWithoutExtension(file).Replace(MachineOperator.EmbeddedLogsTag + "-", ""); + DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); + logFiles.Add(new LogFile() { DateTime = date, File = file }); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, $"Could not load embedded log file {Path.GetFileName(file)}"); + } + } + } + + return logFiles; + } + + public List Parse(LogFile logFile) + { + List logItems = new List(); + + String text = File.ReadAllText(logFile.File); + var logs = Regex.Split(text, @"(\[\d{2}:\d{2}:\d{2}.\d{2}\])"); + + for (int i = 1; i < logs.Length; i += 2) + { + try + { + DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture); + String rest = logs[i + 1]; + + var entries = Regex.Split(rest, @"\[(.*?)\]"); + + EmbeddedLogItem item = new EmbeddedLogItem(new PMR.Debugging.StartDebugLogResponse() + { + Category = (PMR.Debugging.DebugLogCategory)Enum.Parse(typeof(PMR.Debugging.DebugLogCategory), entries[1]), + FileName = entries[3], + LineNumber = uint.Parse(entries[5]), + ModuleId = uint.Parse(entries[7]), + Filter = uint.Parse(entries[9]), + Message = new String(entries[10].Skip(2).ToArray()) + }); + + item.TimeStamp = new DateTime(logFile.DateTime.Year, logFile.DateTime.Month, logFile.DateTime.Day, date.Hour, date.Minute, date.Second, date.Millisecond); + + logItems.Add(item); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Could not parse log line: " + logs[i]); + } + } + + return logItems; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogItem.cs b/Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogItem.cs new file mode 100644 index 000000000..607472e82 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Logging/EmbeddedLogItem.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; +using Tango.PMR.Debugging; + +namespace Tango.Integration.Logging +{ + public class EmbeddedLogItem : MessageLogItem + { + /// + /// Gets or sets the debug log response. + /// + public StartDebugLogResponse DebugLogResponse { get; set; } + + private int _repeated; + /// + /// Gets or sets the number of times this message has been received continuously. + /// + public int Repeated + { + get { return _repeated; } + set { _repeated = value; RaisePropertyChanged(nameof(Repeated)); RaisePropertyChanged(nameof(MessagePlusRepeated)); } + } + + /// + /// Initializes a new instance of the class. + /// + /// The debug log response. + public EmbeddedLogItem(StartDebugLogResponse debugLogResponse) + { + Repeated = 1; + DebugLogResponse = debugLogResponse; + Category = (LogCategory)debugLogResponse.Category; + Message = debugLogResponse.Message; + CallerFile = debugLogResponse.FileName; + CallerLineNumber = (int)debugLogResponse.LineNumber; + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return String.Format("[{0}] [{1}] [{2}] [{3}] [{4}] [{5}]: {6}", TimeStamp.ToString("HH:mm:ss.ff"), DebugLogResponse.Category, Path.GetFileName(DebugLogResponse.FileName), DebugLogResponse.LineNumber, DebugLogResponse.ModuleId, DebugLogResponse.Filter, DebugLogResponse.Message); + } + + /// + /// Gets the message plus repeated. + /// + public String MessagePlusRepeated + { + get { return Repeated > 1 ? String.Format("{0} ({1})", Message, Repeated) : Message; } + } + + /// + /// Gets the relative caller file path. + /// + /// + protected override string GetRelativeCallerFilePath() + { + return CallerFile; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/EmbeddedLogItem.cs b/Software/Visual_Studio/Tango.Integration/Operation/EmbeddedLogItem.cs deleted file mode 100644 index a644b071d..000000000 --- a/Software/Visual_Studio/Tango.Integration/Operation/EmbeddedLogItem.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Logging; -using Tango.PMR.Debugging; - -namespace Tango.Integration.Operation -{ - public class EmbeddedLogItem : MessageLogItem - { - /// - /// Gets or sets the debug log response. - /// - public StartDebugLogResponse DebugLogResponse { get; set; } - - private int _repeated; - /// - /// Gets or sets the number of times this message has been received continuously. - /// - public int Repeated - { - get { return _repeated; } - set { _repeated = value; RaisePropertyChanged(nameof(Repeated)); RaisePropertyChanged(nameof(MessagePlusRepeated)); } - } - - /// - /// Initializes a new instance of the class. - /// - /// The debug log response. - public EmbeddedLogItem(StartDebugLogResponse debugLogResponse) - { - Repeated = 1; - DebugLogResponse = debugLogResponse; - Category = (LogCategory)debugLogResponse.Category; - Message = debugLogResponse.Message; - CallerFile = debugLogResponse.FileName; - CallerLineNumber = (int)debugLogResponse.LineNumber; - } - - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - return String.Format("[{0}] [{1}] [{2}] [{3}] [{4}] [{5}]: {6}", TimeStamp.ToString("HH:mm:ss.ff"), DebugLogResponse.Category, Path.GetFileName(DebugLogResponse.FileName), DebugLogResponse.LineNumber, DebugLogResponse.ModuleId, DebugLogResponse.Filter, DebugLogResponse.Message); - } - - /// - /// Gets the message plus repeated. - /// - public String MessagePlusRepeated - { - get { return Repeated > 1 ? String.Format("{0} ({1})", Message, Repeated) : Message; } - } - - /// - /// Gets the relative caller file path. - /// - /// - protected override string GetRelativeCallerFilePath() - { - return CallerFile; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 991442510..45b2943c1 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -31,6 +31,7 @@ using Tango.Core.Threading; using Tango.PMR.IO; using Tango.Integration.Upgrade; using Tango.PMR.FirmwareUpgrade; +using Tango.Integration.Logging; namespace Tango.Integration.Operation { diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 865738305..8edb04384 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -87,8 +87,9 @@ + - + @@ -167,7 +168,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs b/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs new file mode 100644 index 000000000..2870ce95d --- /dev/null +++ b/Software/Visual_Studio/Tango.Logging/ApplicationLogFileParser.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Tango.Logging; + +namespace Tango.Logging +{ + public class ApplicationLogFileParser : ILogFileParser + { + public List GetLogFiles() + { + List logFiles = new List(); + + FileLogger logger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; + + String logFile = logger != null ? logger.LogFile : null; + + foreach (var file in Directory.GetFiles(FileLogger.DefaultLogsFolder, "*.log").Where(x => Path.GetFileName(x).StartsWith(logger.Tag) && x != logger.LogFile)) + { + try + { + String dateString = Path.GetFileNameWithoutExtension(file).Replace($"{logger.Tag}-", ""); + DateTime date = DateTime.ParseExact(dateString, "dd-MM-yyyy_HH-mm-ss", CultureInfo.InvariantCulture); + logFiles.Add(new LogFile() { DateTime = date, File = file }); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, $"Could not load application log file {Path.GetFileName(file)}"); + } + } + + return logFiles; + } + + public List Parse(LogFile logFile) + { + List logItems = new List(); + + String text = File.ReadAllText(logFile.File); + var logs = Regex.Split(text, @"(\[\d{2}:\d{2}:\d{2}.\d{2}\])"); + + for (int i = 1; i < logs.Length; i += 2) + { + try + { + DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture); + String rest = logs[i + 1]; + + var entries = Regex.Split(rest, @"\[(.*?)\]"); + + MessageLogItem item = new MessageLogItem(); + item.TimeStamp = new DateTime(logFile.DateTime.Year, logFile.DateTime.Month, logFile.DateTime.Day, date.Hour, date.Minute, date.Second, date.Millisecond); + item.Category = (LogCategory)Enum.Parse(typeof(LogCategory), entries[1]); + item.CallerFile = entries[3]; + item.CallerMethodName = entries[5]; + item.CallerLineNumber = int.Parse(entries[7]); + item.Message = new String(entries[8].Skip(2).ToArray()); + + logItems.Add(item); + } + catch (Exception ex) + { + LogManager.Default.Log(ex, "Could not parse log line: " + logs[i]); + } + } + + return logItems; + } + } +} diff --git a/Software/Visual_Studio/Tango.Logging/ILogFileParser.cs b/Software/Visual_Studio/Tango.Logging/ILogFileParser.cs new file mode 100644 index 000000000..bc43c7cd0 --- /dev/null +++ b/Software/Visual_Studio/Tango.Logging/ILogFileParser.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Logging +{ + public interface ILogFileParser + { + List Parse(LogFile logFile); + + List GetLogFiles(); + } +} diff --git a/Software/Visual_Studio/Tango.Logging/LogFile.cs b/Software/Visual_Studio/Tango.Logging/LogFile.cs new file mode 100644 index 000000000..66988b7ed --- /dev/null +++ b/Software/Visual_Studio/Tango.Logging/LogFile.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Logging +{ + public class LogFile + { + public DateTime DateTime { get; set; } + + public String File { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj b/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj index d67cd8f69..311579625 100644 --- a/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj +++ b/Software/Visual_Studio/Tango.Logging/Tango.Logging.csproj @@ -64,6 +64,9 @@ + + + @@ -78,7 +81,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.cs new file mode 100644 index 000000000..a26cb6710 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.Touch.Controls +{ + public class TouchCalendar : Calendar + { + static TouchCalendar() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchCalendar), new FrameworkPropertyMetadata(typeof(TouchCalendar))); + } + + public TouchCalendar() + { + + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.xaml new file mode 100644 index 000000000..0bac1a801 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchCalendar.xaml @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml index 5ea529c70..8e29231af 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.xaml @@ -23,7 +23,6 @@ - diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.cs new file mode 100644 index 000000000..49c7e6aa2 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Core.EventArguments; + +namespace Tango.Touch.Controls +{ + public class TouchDatePicker : DatePicker + { + static TouchDatePicker() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchDatePicker), new FrameworkPropertyMetadata(typeof(TouchDatePicker))); + } + + public TouchDatePicker() + { + this.RegisterForPreviewMouseOrTouchDown(OnMouseDown); + this.RegisterForPreviewMouseOrTouchUp(OnMouseUp); + } + + private void OnMouseUp(object sender, MouseOrTouchEventArgs e) + { + ShowSelectionOnTouchPanel(); + } + + private void OnMouseDown(object sender, MouseOrTouchEventArgs e) + { + System.Windows.Input.Keyboard.Focus(this); + } + + private void ShowSelectionOnTouchPanel() + { + TouchPanel touchPanel = this.FindAncestor(); + + if (touchPanel != null) + { + touchPanel.CurrentDatePicker = this; + } + } + + internal void SetResultFromTouchPanel(DateTime selectedDate) + { + SelectedDate = selectedDate; + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.xaml new file mode 100644 index 000000000..eb22c441a --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchDatePicker.xaml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs index aa311a986..54906c7a6 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; +using System.Windows.Input; using Tango.Core.Commands; using Tango.Core.EventArguments; using Tango.SharedUI; @@ -18,6 +19,8 @@ namespace Tango.Touch.Controls { private TouchListBox _combobox_list; private Grid _combobox_grid; + private TouchCalendar _calendar; + private Grid _calendar_grid; static TouchPanel() { @@ -32,6 +35,17 @@ namespace Tango.Touch.Controls CurrentComboBox = null; }); + DateSelectedCommand = new RelayCommand(() => + { + CurrentDatePicker.SetResultFromTouchPanel(_calendar.SelectedDate.Value); + CurrentDatePicker = null; + }); + + CancelDateCommand = new RelayCommand(() => + { + CurrentDatePicker = null; + }); + this.RegisterForMouseOrTouchDown(OnMouseDown); } @@ -52,8 +66,28 @@ namespace Tango.Touch.Controls _combobox_list = GetTemplateChild("PART_ComboBoxList") as TouchListBox; _combobox_grid = GetTemplateChild("PART_combobox_grid") as Grid; + _calendar_grid = GetTemplateChild("PART_datepicker_grid") as Grid; + _calendar = GetTemplateChild("PART_calendar") as TouchCalendar; _combobox_grid.RegisterForMouseOrTouchDown(OnComboBoxGridDown); + _calendar_grid.RegisterForMouseOrTouchDown(OnCalendarGridDown); + + _calendar.SelectionMode = CalendarSelectionMode.SingleDate; + _calendar.SelectedDatesChanged += _calendar_SelectedDatesChanged; + } + + private void _calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) + { + Mouse.Capture(null); + ReleaseAllTouchCaptures(); + } + + private void OnCalendarGridDown(object sender, MouseOrTouchEventArgs e) + { + if (e.Source == _calendar_grid) + { + CurrentDatePicker = null; + } } private void OnComboBoxGridDown(object sender, MouseOrTouchEventArgs e) @@ -81,6 +115,16 @@ namespace Tango.Touch.Controls } } + private void OnCurrentDatePickerChanged() + { + if (CurrentDatePicker != null) + { + _calendar.SelectedDate = CurrentDatePicker.SelectedDate; + _calendar.DisplayDateStart = CurrentDatePicker.DisplayDateStart; + _calendar.DisplayDateEnd = CurrentDatePicker.DisplayDateEnd; + } + } + internal RelayCommand ComboBoxPickedCommand { get { return (RelayCommand)GetValue(ComboBoxPickedCommandProperty); } @@ -98,6 +142,32 @@ namespace Tango.Touch.Controls internal static readonly DependencyProperty CurrentComboBoxProperty = DependencyProperty.Register("CurrentComboBox", typeof(TouchComboBox), typeof(TouchPanel), new PropertyMetadata(null,(d,e) => (d as TouchPanel).OnCurrentComboBoxChanged())); + internal TouchDatePicker CurrentDatePicker + { + get { return (TouchDatePicker)GetValue(CurrentDatePickerProperty); } + set { SetValue(CurrentDatePickerProperty, value); } + } + internal static readonly DependencyProperty CurrentDatePickerProperty = + DependencyProperty.Register("CurrentDatePicker", typeof(TouchDatePicker), typeof(TouchPanel), new PropertyMetadata(null, (d, e) => (d as TouchPanel).OnCurrentDatePickerChanged())); + + internal RelayCommand DateSelectedCommand + { + get { return (RelayCommand)GetValue(DateSelectedCommandProperty); } + set { SetValue(DateSelectedCommandProperty, value); } + } + internal static readonly DependencyProperty DateSelectedCommandProperty = + DependencyProperty.Register("DateSelectedCommand", typeof(RelayCommand), typeof(TouchPanel), new PropertyMetadata(null)); + + internal RelayCommand CancelDateCommand + { + get { return (RelayCommand)GetValue(CancelDateCommandProperty); } + set { SetValue(CancelDateCommandProperty, value); } + } + internal static readonly DependencyProperty CancelDateCommandProperty = + DependencyProperty.Register("CancelDateCommand", typeof(RelayCommand), typeof(TouchPanel), new PropertyMetadata(null)); + + + public bool HasMessageBox { get { return (bool)GetValue(HasMessageBoxProperty); } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml index 92e838c1e..77eb794a0 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchPanel.xaml @@ -83,6 +83,49 @@ + + + + + + + + + + + + + + + CANCEL + OK + + + + + + + + diff --git a/Software/Visual_Studio/Tango.Touch/Converters/DateTimeToCalendarHeaderConverter.cs b/Software/Visual_Studio/Tango.Touch/Converters/DateTimeToCalendarHeaderConverter.cs new file mode 100644 index 000000000..0d5909d65 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Converters/DateTimeToCalendarHeaderConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.Touch.Converters +{ + public class DateTimeToCalendarHeaderConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + DateTime? date = value as DateTime?; + + if (date == null) + { + date = DateTime.Now; + } + + return date.Value.ToString("ddd, MMM d"); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 469fbeb3a..9bd7f0b71 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -65,8 +65,10 @@ + + @@ -89,6 +91,7 @@ + @@ -110,6 +113,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -118,6 +125,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -374,7 +385,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index ad85463dd..832a3bf95 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -42,6 +42,8 @@ + + diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index a190fd04a..387a9e1bf 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -244,6 +244,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.FirmwarePackageGenera EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.BootScreen", "PPC\Tango.PPC.BootScreen\Tango.PPC.BootScreen.csproj", "{7E5E4BED-538C-4566-A005-DCC070AF8715}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.Logging", "PPC\Modules\Tango.PPC.Logging\Tango.PPC.Logging.csproj", "{D2EE865B-B006-487A-9487-60A663636AC3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AppVeyor|Any CPU = AppVeyor|Any CPU @@ -4367,6 +4369,46 @@ Global {7E5E4BED-538C-4566-A005-DCC070AF8715}.Release|x64.Build.0 = Release|Any CPU {7E5E4BED-538C-4566-A005-DCC070AF8715}.Release|x86.ActiveCfg = Release|Any CPU {7E5E4BED-538C-4566-A005-DCC070AF8715}.Release|x86.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|Any CPU.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|ARM.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|ARM.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|ARM64.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|x64.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|x64.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|x86.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.AppVeyor|x86.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|ARM.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|ARM64.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|x64.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|x64.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|x86.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Debug|x86.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|ARM.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|Any CPU.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|ARM.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|ARM.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|ARM64.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|ARM64.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|x64.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|x64.Build.0 = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|x86.ActiveCfg = Release|Any CPU + {D2EE865B-B006-487A-9487-60A663636AC3}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -4443,14 +4485,15 @@ Global {5991F6B5-EA4E-41E9-A4F6-7D3A50010FD6} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} {43135FB9-41DB-4F87-9771-CF2C762027C0} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {7E5E4BED-538C-4566-A005-DCC070AF8715} = {C81ED1A3-D18C-4D80-A8F5-061994A14A60} + {D2EE865B-B006-487A-9487-60A663636AC3} = {0048447D-1D94-4E60-9DAD-7349C777CB4E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_UpdateFileVersion = False - BuildVersion_StartDate = 2000/1/1 - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs BuildVersion_UseGlobalSettings = False + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_StartDate = 2000/1/1 + BuildVersion_UpdateFileVersion = False + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} EndGlobalSection EndGlobal diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index b8301312d..1ab00e18f 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -14,19 +14,11 @@ xmlns:commonControls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common" xmlns:explorer="clr-namespace:Tango.Explorer;assembly=Tango.Explorer" mc:Ignorable="d" - Title="MainWindow" Height="564.721" Width="504.315" DataContext="{Binding RelativeSource={RelativeSource Self}}"> + Title="MainWindow" Height="1280" Width="800" DataContext="{Binding RelativeSource={RelativeSource Self}}"> - - - - - - - - - - + + -- cgit v1.3.1