From e571f20e27c4fca6bb6efe03d6427a1f332f9830 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 27 May 2018 19:33:15 +0300 Subject: Working on panel pc. --- .../Application/IPPCApplicationManager.cs | 54 ++++ .../DefaultAuthenticationProvider.cs | 32 ++ .../Authentication/IAuthenticationProvider.cs | 38 +++ .../Tango.PPC.Common/Controls/MultiPieChart.xaml | 8 + .../Controls/MultiPieChart.xaml.cs | 263 ++++++++++++++++ .../Controls/MultiPieChartBrushCollection.cs | 9 + .../Converters/SegmentsToPieConverter.cs | 52 ++++ .../PPC/Tango.PPC.Common/CustomControl1.cs | 25 ++ .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 97 ++++++ .../Diagnostics/IDiagnosticsFrameProvider.cs | 32 ++ .../EventLogging/DefaultEventLogger.cs | 331 +++++++++++++++++++++ .../Tango.PPC.Common/EventLogging/IEventLogger.cs | 64 ++++ .../Navigation/INavigationManager.cs | 20 ++ .../Tango.PPC.Common/Navigation/NavigationView.cs | 18 ++ .../Tango.PPC.Common/Notification/DialogViewVM.cs | 74 +++++ .../Notification/INotificationProvider.cs | 129 ++++++++ .../PPC/Tango.PPC.Common/Notification/TaskItem.cs | 62 ++++ .../PPC/Tango.PPC.Common/PPCSettings.cs | 19 ++ .../PPC/Tango.PPC.Common/PPCViewModel.cs | 39 +++ .../Tango.PPC.Common/Properties/AssemblyInfo.cs | 55 ++++ .../Properties/Resources.Designer.cs | 62 ++++ .../PPC/Tango.PPC.Common/Properties/Resources.resx | 117 ++++++++ .../Properties/Settings.Designer.cs | 30 ++ .../Tango.PPC.Common/Properties/Settings.settings | 7 + .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 188 ++++++++++++ .../PPC/Tango.PPC.Common/Themes/Generic.xaml | 18 ++ .../Visual_Studio/PPC/Tango.PPC.Common/app.config | 61 ++++ .../PPC/Tango.PPC.Common/packages.config | 5 + 28 files changed, 1909 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChartBrushCollection.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/CustomControl1.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/IDiagnosticsFrameProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/DialogViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/INotificationProvider.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/TaskItem.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Themes/Generic.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/app.config create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs new file mode 100644 index 000000000..3a516c072 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.Integration.Services; + +namespace Tango.PPC.Common.Application +{ + /// + /// Represents the Machine Studio application manager. + /// + public interface IPPCApplicationManager + { + /// + /// Gets or sets the DAL machine. + /// + Machine Machine { get; } + + /// + /// Sets the machine. + /// + /// The machine. + void SetMachine(Machine machine); + + /// + /// Occurs when the connected machine property has changed. + /// + event EventHandler ConnectedMachineChanged; + + /// + /// Gets a value indicating whether Machine Studio is shutting down. + /// + bool IsShuttingDown { get; } + + /// + /// Shutdown the application. + /// + void ShutDown(); + + /// + /// Gets or sets the currently connected machine if any. + /// + IMachineOperator ConnectedMachine { get; set; } + + /// + /// Gets the machine studio application version. + /// + String Version { get; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs new file mode 100644 index 000000000..c8e89ac2f --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Common.Authentication +{ + public class DefaultAuthenticationProvider : IAuthenticationProvider + { + public User CurrentUser + { + get + { + throw new NotImplementedException(); + } + } + + public event EventHandler CurrentUserChanged; + + public User Login(string email, string password) + { + throw new NotImplementedException(); + } + + public void Logout() + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs new file mode 100644 index 000000000..0892932a8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Common.Authentication +{ + /// + /// Represents the Machine Studio user authentication provider responsible for the current logged-in user. + /// + public interface IAuthenticationProvider + { + /// + /// Occurs when the current logged-in user has changed. + /// + event EventHandler CurrentUserChanged; + + /// + /// Gets the current logged-in user. + /// + User CurrentUser { get; } + + /// + /// Performs a user login by the specified email and password. + /// + /// The email. + /// The password. + /// + User Login(String email, String password); + + /// + /// Logs-out the current logged-in user. + /// + void Logout(); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml new file mode 100644 index 000000000..0c6ae7630 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml.cs new file mode 100644 index 000000000..2415573fe --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChart.xaml.cs @@ -0,0 +1,263 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace Tango.PPC.Common.Controls +{ + /// + /// Interaction logic for MultiPieChart.xaml + /// + public partial class MultiPieChart : UserControl + { + private const string DefaultDataBrush = "#939496"; + + #region dependency properties + + public static readonly DependencyProperty SizeProperty = + DependencyProperty.Register( "Size", typeof( double ), typeof( MultiPieChart ), new PropertyMetadata( 100.0, OnPiePropertyChanged ) ); + + public static readonly DependencyProperty InnerPieSliceFillProperty = + DependencyProperty.Register( "InnerPieSliceFill", typeof( Brush ), typeof( MultiPieChart ), new PropertyMetadata( CreateBrush( "#939496" ), OnPiePropertyChanged ) ); + + public static readonly DependencyProperty OuterPieSliceFillProperty = + DependencyProperty.Register( "OuterPieSliceFill", typeof( Brush ), typeof( MultiPieChart ), new PropertyMetadata( CreateBrush( "#D0D1D3" ), OnPiePropertyChanged ) ); + + public static readonly DependencyProperty DataListProperty = + DependencyProperty.Register( "DataList", typeof( IList ), typeof( MultiPieChart ), new PropertyMetadata( null, OnDataListPropertyChanged ) ); + + public static readonly DependencyProperty DataBrushesProperty = + DependencyProperty.Register( "DataBrushes", typeof( MultiPieChartBrushCollection ), typeof( MultiPieChart ), new PropertyMetadata( new MultiPieChartBrushCollection(), OnPiePropertyChanged ) ); + + public double Size + { + get { return (double)GetValue( SizeProperty ); } + set { SetValue( SizeProperty, value ); } + } + + public Brush InnerPieSliceFill + { + get { return (Brush)GetValue( InnerPieSliceFillProperty ); } + set { SetValue( InnerPieSliceFillProperty, value ); } + } + + public Brush OuterPieSliceFill + { + get { return (Brush)GetValue( OuterPieSliceFillProperty ); } + set { SetValue( OuterPieSliceFillProperty, value ); } + } + + public IList DataList + { + get { return (IList)GetValue( DataListProperty ); } + set { SetValue( DataListProperty, value ); } + } + + public MultiPieChartBrushCollection DataBrushes + { + get { return (MultiPieChartBrushCollection)GetValue( DataBrushesProperty ); } + set { SetValue( DataBrushesProperty, value ); } + } + + #endregion + + #region constructor + + public MultiPieChart() + { + InitializeComponent(); + this.Loaded += (_, __) => { CreatePieChart(); }; + } + + #endregion + + #region overrides + + #endregion + + #region events + + private static void OnPiePropertyChanged( DependencyObject dep, DependencyPropertyChangedEventArgs ev ) + { + //var chart = (MultiPieChart)dep; + + //if ( chart.IsInitialized ) + //{ + // chart.CreatePieChart(); + //} + } + + private static void OnDataListPropertyChanged( DependencyObject dep, DependencyPropertyChangedEventArgs ev ) + { + var chart = (MultiPieChart)dep; + + var collection = ev.OldValue as INotifyCollectionChanged; + if ( collection != null ) + { + collection.CollectionChanged -= chart.DataListCollectionChanged; + } + + collection = ev.NewValue as INotifyCollectionChanged; + if ( collection != null ) + { + collection.CollectionChanged += chart.DataListCollectionChanged; + } + } + + + private void DataListCollectionChanged( object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs ) + { + //CreatePieChart(); + } + + #endregion + + #region private methods + + private void CreatePieChart() + { + Size = ActualWidth; + + if ( _pieChartImage != null ) + { + if ( !double.IsNaN( Size ) && DataList != null && DataList.Any() ) + { + _pieChartImage.Width = _pieChartImage.Height = Width = Height = Size; + + var di = new DrawingImage(); + _pieChartImage.Source = di; + + var dg = new DrawingGroup(); + di.Drawing = dg; + + if ( DataList.Count > 1 ) + { + var total = DataList.Sum(); + var startPoint = new Point( Width / 2, 0 ); + double radians = 0; + + for ( int i = 0; i < DataList.Count; i++ ) + { + var data = DataList[i]; + var dataBrush = GetBrushFromList( i ); + var percentage = data / total; + + Point endPoint; + var angle = 360 * percentage; + + if ( i + 1 == DataList.Count ) + { + endPoint = new Point( Width / 2, 0 ); + } + else + { + radians += ( Math.PI / 180 ) * angle; + var endPointX = Math.Sin( radians ) * Height / 2 + Height / 2; + var endPointY = Width / 2 - Math.Cos( radians ) * Width / 2; + endPoint = new Point( endPointX, endPointY ); + } + + dg.Children.Add( CreatePathGeometry( dataBrush, startPoint, endPoint, angle > 180 ) ); + + startPoint = endPoint; + } + } + else + { + dg.Children.Add( CreateEllipseGeometry( GetBrushFromList( 0 ) ) ); + } + } + else + { + _pieChartImage.Source = null; + } + } + } + + private GeometryDrawing CreatePathGeometry( Brush brush, Point startPoint, Point arcPoint, bool isLargeArc ) + { + /* + * + + + + + + + + + + + + + * */ + + var midPoint = new Point( Width / 2, Height / 2 ); + + var drawing = new GeometryDrawing { Brush = brush }; + var pathGeometry = new PathGeometry(); + var pathFigure = new PathFigure { StartPoint = midPoint }; + + var ls1 = new LineSegment( startPoint, false ); + var arc = new ArcSegment + { + SweepDirection = SweepDirection.Clockwise, + Size = new Size( Width / 2, Height / 2 ), + Point = arcPoint, + IsLargeArc = isLargeArc + }; + var ls2 = new LineSegment( midPoint, false ); + + drawing.Geometry = pathGeometry; + pathGeometry.Figures.Add( pathFigure ); + + pathFigure.Segments.Add( ls1 ); + pathFigure.Segments.Add( arc ); + pathFigure.Segments.Add( ls2 ); + + return drawing; + } + + private GeometryDrawing CreateEllipseGeometry( Brush brush ) + { + var midPoint = new Point( Width / 2, Height / 2 ); + + var drawing = new GeometryDrawing { Brush = brush }; + var ellipse = new EllipseGeometry( midPoint, Size / 2, Size / 2 ); + + drawing.Geometry = ellipse; + + return drawing; + } + + private static SolidColorBrush CreateBrush( string brush ) + { + var color = ColorConverter.ConvertFromString( brush ); + if ( color != null ) + { + return new SolidColorBrush( (Color)color ); + } + + return null; + } + + private Brush GetBrushFromList( int index ) + { + if ( DataBrushes == null || !DataBrushes.Any() ) + { + return CreateBrush( DefaultDataBrush ); + } + else + { + var modIndex = index % DataBrushes.Count; + return DataBrushes[modIndex]; + } + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChartBrushCollection.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChartBrushCollection.cs new file mode 100644 index 000000000..0d8c754f7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/MultiPieChartBrushCollection.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; +using System.Windows.Media; + +namespace Tango.PPC.Common.Controls +{ + public class MultiPieChartBrushCollection : List + { + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs new file mode 100644 index 000000000..77eab71b8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Converters/SegmentsToPieConverter.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.BL.Entities; +using Tango.PPC.Common.Controls; + +namespace Tango.PPC.Common.Converters +{ + public class SegmentsToPieConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ObservableCollection segments = value as ObservableCollection; + + if (segments != null) + { + MultiPieChart pie = new MultiPieChart(); + + pie.DataList = new List(); + + if (segments.Count > 0) + { + foreach (var segment in segments) + { + pie.DataList.Add(10); + pie.DataBrushes.Add(segment.GetSegmentBrush()); + } + } + else + { + pie.DataList.Add(10); + pie.DataBrushes.Add(new SolidColorBrush(Colors.Gainsboro)); + } + + return pie; + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/CustomControl1.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/CustomControl1.cs new file mode 100644 index 000000000..82fcc6431 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/CustomControl1.cs @@ -0,0 +1,25 @@ +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.Common +{ + public class CustomControl1 : Control + { + static CustomControl1() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1))); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs new file mode 100644 index 000000000..c4e0563ab --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Integration.Operation; +using Tango.Integration.Services; +using Tango.PMR.Diagnostics; +using Tango.PPC.Common.Application; + +namespace Tango.PPC.Common.Diagnostics +{ + /// + /// Represents the default diagnostics frame provider. + /// + /// + public class DefaultDiagnosticsFrameProvider : ExtendedObject, IDiagnosticsFrameProvider + { + private IPPCApplicationManager _application; + + private bool _disable; + /// + /// Disables the frame delivery from the current connected machine and enables the manual push frame method. + /// + public bool Disable + { + get { return _disable; } + set + { + _disable = value; + } + } + + /// + /// Occurs when a new data frame is available. + /// + public event EventHandler FrameReceived; + + /// + /// Initializes a new instance of the class. + /// + /// The application manager. + public DefaultDiagnosticsFrameProvider(IPPCApplicationManager applicationManager) + { + _application = applicationManager; + applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + } + + /// + /// Applications the manager connected machine changed. + /// + /// The sender. + /// The machine. + private void ApplicationManager_ConnectedMachineChanged(object sender, IMachineOperator machine) + { + if (machine != null) + { + machine.DiagnosticsDataAvailable += DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable; + } + } + + /// + /// Defaults the diagnostics frame provider diagnostics data available. + /// + /// The sender. + /// The frame. + private void DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable(object sender, StartDiagnosticsResponse frame) + { + if (!Disable) + { + OnFrameReceived(frame); + } + } + + /// + /// Push frames manual. (Only when Disable = true) + /// + /// The frame. + public void PushFrame(StartDiagnosticsResponse frame) + { + if (Disable) + { + OnFrameReceived(frame); + } + } + + /// + /// Raises the event. + /// + /// The frame. + protected virtual void OnFrameReceived(StartDiagnosticsResponse frame) + { + FrameReceived?.Invoke(this, frame); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/IDiagnosticsFrameProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/IDiagnosticsFrameProvider.cs new file mode 100644 index 000000000..169870042 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/IDiagnosticsFrameProvider.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operation; +using Tango.PMR.Diagnostics; + +namespace Tango.PPC.Common.Diagnostics +{ + /// + /// Represents a tango machine diagnostics frame provider. + /// + public interface IDiagnosticsFrameProvider + { + /// + /// Occurs when a new data frame is available. + /// + event EventHandler FrameReceived; + + /// + /// Disables the frame delivery from the current connected machine and enables the manual push frame method. + /// + bool Disable { get; set; } + + /// + /// Push frames manual. (Only when Disable = true) + /// + /// The frame. + void PushFrame(StartDiagnosticsResponse frame); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs new file mode 100644 index 000000000..2675fa1fa --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -0,0 +1,331 @@ +using Google.Protobuf; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core; +using Tango.Integration.Services; +using Tango.PMR.Diagnostics; +using Tango.Integration.Operation; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Authentication; + +namespace Tango.PPC.Common.EventLogging +{ + /// + /// Represents the default database events logger. + /// + /// + public class DefaultEventLogger : ExtendedObject, IEventLogger + { + private ObservablesContext _db; + private Thread _logThread; + private ConcurrentQueue _events; + private IPPCApplicationManager _application; + private IAuthenticationProvider _authentication; + private Dictionary _eventTypesGuids; + private String _hostName; + private bool _isInitialized; + private List _pendingEvents; + + #region Events + + /// + /// Occurs when a new machine event has been logged. + /// + public event EventHandler NewLog; + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The application manager. + /// The authentication provider. + public DefaultEventLogger(IPPCApplicationManager applicationManager, IAuthenticationProvider authenticationProvider) + { + _hostName = Environment.MachineName; + + _events = new ConcurrentQueue(); + _pendingEvents = new List(); + + _eventTypesGuids = new Dictionary(); + + _application = applicationManager; + _authentication = authenticationProvider; + _logThread = new Thread(LogThreadMethod); + _logThread.IsBackground = true; + _logThread.Start(); + + _application.ConnectedMachineChanged += _application_ConnectedMachineChanged; + } + + #endregion + + #region Private Methods + + private void Init() + { + if (!_isInitialized) + { + try + { + _db = ObservablesContext.CreateDefault(); + _db.Configuration.LazyLoadingEnabled = false; + + _db.ActionTypes.ToList(); + _db.EventTypesActions.ToList(); + _db.EventTypesCategories.ToList(); + _db.EventTypesGroups.ToList(); + _db.EventTypes.ToList(); + + foreach (var type in _db.EventTypes) + { + _eventTypesGuids.Add((EventTypes)type.Code, type); + } + + _isInitialized = true; + } + catch + { + _isInitialized = false; + } + } + } + + #endregion + + #region Event Handlers + + /// + /// Handle the application manager connected machine changed event. + /// + /// The sender. + /// The machine. + private void _application_ConnectedMachineChanged(object sender, IMachineOperator machine) + { + if (machine != null) + { + if (machine.MachineEventsStateProvider != null) + { + machine.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; + machine.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; + machine.MachineEventsStateProvider.EventsResolved -= MachineEventsStateProvider_EventsResolved; + machine.MachineEventsStateProvider.EventsResolved += MachineEventsStateProvider_EventsResolved; + } + + machine.RequestSent -= Machine_RequestSent; + machine.RequestFailed -= Machine_RequestFailed; + machine.ResponseReceived -= Machine_ResponseReceived; + + machine.RequestSent += Machine_RequestSent; + machine.RequestFailed += Machine_RequestFailed; + machine.ResponseReceived += Machine_ResponseReceived; + } + } + + /// + /// Handles the RequestSent event of the connected machine. + /// + /// The sender. + /// The message. + private void Machine_RequestSent(object sender, IMessage message) + { + Log(EventTypes.RequestSent, String.Format("Sending request '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); + } + + /// + /// Handles the RequestFailed event of the connected machine. + /// + /// The source of the event. + /// The instance containing the event data. + private void Machine_RequestFailed(object sender, RequestFailedEventArgs e) + { + Log(EventTypes.RequestFailed, String.Format("Request failed '{0}'...{1}{2}{1}{3}", e.Message.GetType().Name, Environment.NewLine, e.Message.ToJsonString(), e.Exception.ToString())); + } + + /// + /// Handles the ResponseReceived event of the connected machine. + /// + /// The sender. + /// The message. + private void Machine_ResponseReceived(object sender, IMessage message) + { + Log(EventTypes.ResponseReceived, String.Format("Response received '{0}'...{1}{2}", message.GetType().Name, Environment.NewLine, message.ToJsonString())); + } + + /// + /// Handles the connected machine events state provider NewEvents event. + /// + /// The sender. + /// The events. + private void MachineEventsStateProvider_NewEvents(object sender, IEnumerable events) + { + foreach (var ev in events) + { + Log(ev); + } + } + + /// + /// Handles the connected machine events state provider EventsResolved event. + /// + /// The sender. + /// The events. + private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable events) + { + foreach (var ev in events) + { + Log(String.Format("Event '{0}' resolved.", ev.EventType.Name)); + } + } + + #endregion + + #region Logging + + /// + /// Logs the specified machine event. + /// + /// The machine event. + public void Log(MachinesEvent machineEvent) + { + machineEvent.HostName = _hostName; + machineEvent.EventType = _eventTypesGuids[machineEvent.Type]; + + if (_application.ConnectedMachine == null || _authentication.CurrentUser == null) + { + _pendingEvents.Add(machineEvent); + } + else + { + if (_pendingEvents.Count > 0) + { + var pending = _pendingEvents.ToList(); + _pendingEvents.Clear(); + + foreach (var ev in pending) + { + Log(ev); + } + } + + LogManager.Log("Logging event " + machineEvent.EventType.Name + " - " + machineEvent.Description); + machineEvent.MachineGuid = _application.ConnectedMachine.Machine.Guid; + machineEvent.UserGuid = _authentication.CurrentUser.Guid; + machineEvent.User = _authentication.CurrentUser; + _events.Enqueue(machineEvent); + NewLog?.Invoke(this, machineEvent); + } + } + + /// + /// Logs the specified event type. + /// + /// Type of the event. + /// The message. + public void Log(EventTypes eventType, string message) + { + Init(); + + MachinesEvent machineEvent = new MachinesEvent(); + machineEvent.DateTime = DateTime.UtcNow; + machineEvent.Description = message; + machineEvent.EventType = _eventTypesGuids[eventType]; + machineEvent.EventTypeGuid = machineEvent.EventType.Guid; + + Log(machineEvent); + } + + /// + /// Logs the specified hardware event. + /// + /// The hardware event. + public void Log(Event hardwareEvent) + { + Log((EventTypes)hardwareEvent.Type, hardwareEvent.Message); + } + + /// + /// Logs the specified exception using the . + /// + /// The exception. + public void Log(Exception exception) + { + Log(EventTypes.ApplicationException, exception.ToString()); + } + + /// + /// Logs the specified exception using the . + /// + /// The exception. + /// + public void Log(Exception exception, string description) + { + Log(EventTypes.ApplicationException, description + Environment.NewLine + exception.ToString()); + } + + /// + /// Logs the specified message using the . + /// + /// The message. + public void Log(String message) + { + Log(EventTypes.ApplicationInformation, message); + } + + /// + /// Logging thread loop. + /// + private void LogThreadMethod() + { + while (true) + { + FlushAll(); + Thread.Sleep(5000); + } + } + + /// + /// Immediately saves all pending events to database. + /// + public void FlushAll() + { + bool _saveChanges = false; + + while (_events.Count > 0) + { + MachinesEvent ev = null; + + if (_events.TryDequeue(out ev)) + { + ev.User = null; + _db.MachinesEvents.Add(ev); + _saveChanges = true; + } + } + + if (_saveChanges) + { + try + { + _db.SaveChanges(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving machine event to database."); + } + } + } + + #endregion + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs new file mode 100644 index 000000000..f7eadac1e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.PMR.Diagnostics; + +namespace Tango.PPC.Common.EventLogging +{ + /// + /// Represents a database events logger. + /// + public interface IEventLogger + { + /// + /// Occurs when a new machine event has been logged. + /// + event EventHandler NewLog; + + /// + /// Logs the specified machine event. + /// + /// The machine event. + void Log(MachinesEvent machineEvent); + + /// + /// Logs the specified event type. + /// + /// Type of the event. + /// The message. + void Log(EventTypes eventType, String message); + + /// + /// Logs the specified hardware event. + /// + /// The hardware event. + void Log(Event hardwareEvent); + + /// + /// Logs the specified exception using the . + /// + /// The exception. + void Log(Exception exception); + + /// + /// Logs the specified exception using the . + /// + /// The exception. + void Log(Exception exception, String description); + + /// + /// Logs the specified message using the . + /// + /// The message. + void Log(String message); + + /// + /// Immediately saves all pending events to database. + /// + void FlushAll(); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs new file mode 100644 index 000000000..f29476631 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.Navigation +{ + /// + /// Represents the Machine Studio views navigation manager. + /// + public interface INavigationManager + { + /// + /// Navigates to the specified view. + /// + /// The view. + void NavigateTo(NavigationView view); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs new file mode 100644 index 000000000..d860bce76 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.Navigation +{ + /// + /// Represents the available views to navigate to using the . + /// + public enum NavigationView + { + LoadingView, + LayoutView, + JobsView, + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/DialogViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/DialogViewVM.cs new file mode 100644 index 000000000..b7a48f259 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/DialogViewVM.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.PPC.Common.Notifications +{ + /// + /// Represents a dialog view model base class. + /// + /// + public abstract class DialogViewVM : ViewModel + { + public event Action Accepted; + public event Action Canceled; + + /// + /// Initializes a new instance of the class. + /// + public DialogViewVM() + { + CanClose = true; + CloseCommand = new RelayCommand(Cancel, (x) => CanClose); + OKCommand = new RelayCommand(Accept, (x) => CanClose); + } + + private bool _canClose; + /// + /// Gets or sets a value indicating whether this dialog can be closed. + /// + public bool CanClose + { + get { return _canClose; } + set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + /// + /// Gets or sets the close command. + /// + public RelayCommand CloseCommand { get; set; } + + /// + /// Gets or sets the ok command. + /// + public RelayCommand OKCommand { get; set; } + + /// + /// Called when the dialog has been shown. + /// + public virtual void OnShow() + { + + } + + /// + /// Invokes the event. + /// + protected virtual void Accept() + { + Accepted?.Invoke(); + } + + /// + /// Invokes the event. + /// + protected virtual void Cancel() + { + Canceled?.Invoke(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/INotificationProvider.cs new file mode 100644 index 000000000..edad5c1e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/INotificationProvider.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; + +namespace Tango.PPC.Common.Notifications +{ + /// + /// Represents the Machine Studio user notification provider responsible for displaying information, alerts and dialogs to the user. + /// + public interface INotificationProvider + { + /// + /// Gets the collection of active task items. + /// + ObservableCollection TaskItems { get; } + + /// + /// Gets the current displayed task item. + /// + TaskItem CurrentTaskItem { get; } + + /// + /// Gets a value indicating whether there are any queued task items. + /// + bool HasTaskItems { get; } + + /// + /// Pushes the specified task item to the queue. + /// + /// The task item. + void PushTaskItem(TaskItem taskItem); + + /// + /// Create and push a new task item from the specified message. + /// + /// The message. + /// + TaskItem PushTaskItem(String message); + + /// + /// Removed the specified task item from the queue. + /// + /// The task item. + void PopTaskItem(TaskItem taskItem); + + /// + /// Creates a new instance of the specified View type and displays it as a modal dialog. + /// + /// The type of the view. + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. + void ShowModalDialog(Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. + /// Cancel button callback. + void ShowModalDialog(Action onAccept, Action onCancel) where VM : DialogViewVM; + + /// + /// Shows the specified view with the specified view model as it's data context. + /// + /// The type of the mm. + /// The type of the view. + /// The view model. + /// The accept action. + /// The cancel action. + void ShowModalDialog(VM vm, Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// + /// Shows the specified view with the specified view model as it's data context. + /// + /// The type of the mm. + /// The type of the view. + /// The view model. + /// The view. + /// The accept action. + /// The cancel action. + void ShowModalDialog(VM vm, View view, Action onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// + /// Creates a new view by a naming convention of the specified view model type. + /// + /// The type of the view model. + /// Accept button callback. + void ShowModalDialog(Action onAccept) where VM : DialogViewVM; + + /// + /// Shows an information message box. + /// + /// The message. + void ShowInfo(String message); + + /// + /// Shows warning message box. + /// + /// The message. + void ShowWarning(String message); + + /// + /// Shows an error message box. + /// + /// The message. + void ShowError(String message); + + /// + /// Shows a question message box. + /// + /// The message. + bool ShowQuestion(String message); + + /// + /// Shows a dialog with a text input field and returns the response. + /// + /// The message. + /// Text field hint. + /// Optional default response. + /// + String ShowTextInput(String message, String hint, String defaultResponse = null); + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/TaskItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/TaskItem.cs new file mode 100644 index 000000000..b9ffa4a72 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notification/TaskItem.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.PPC.Common.Notifications +{ + /// + /// Represents a Machine Studio "work-bar" item. + /// + /// + /// + public class TaskItem : ExtendedObject, IDisposable + { + private INotificationProvider _notificationProvider; + + /// + /// Initializes a new instance of the class. + /// + /// The notification provider. + public TaskItem(INotificationProvider notificationProvider) + { + _notificationProvider = notificationProvider; + } + + private String _message; + /// + /// Gets or sets the message. + /// + public String Message + { + get { return _message; } + set { _message = value; RaisePropertyChangedAuto(); } + } + + /// + /// Removed this item from the queue. + /// + public void Pop() + { + _notificationProvider.PopTaskItem(this); + } + + /// + /// Pushes this item to the queue. + /// + public void Push() + { + _notificationProvider.PushTaskItem(this); + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + Pop(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs new file mode 100644 index 000000000..db04c04ee --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.PPC.Common +{ + public class PPCSettings : SettingsBase + { + public String MachineSerialNumber { get; set; } + + public PPCSettings() + { + MachineSerialNumber = "1111"; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs new file mode 100644 index 000000000..e5f13e394 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.Notifications; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.PPC.Common +{ + public abstract class PPCViewModel : ViewModel + { + public IPPCApplicationManager ApplicationManager { get; private set; } + + public IAuthenticationProvider AuthenticationProvider { get; private set; } + + public INavigationManager NavigationManager { get; private set; } + + public INotificationProvider NotificationProvider { get; private set; } + + public PPCSettings Settings { get; private set; } + + public PPCViewModel(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification) + { + ApplicationManager = application; + AuthenticationProvider = authentication; + NavigationManager = navigation; + NotificationProvider = notification; + + Settings = SettingsManager.Default.GetOrCreate(); + } + + public abstract void OnApplicationStarted(); + } +} \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..3394347d0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +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.Common")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.PanelPC.Common")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[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) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.Designer.cs new file mode 100644 index 000000000..243da50ac --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/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.Common.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.PanelPC.Common.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/Tango.PPC.Common/Properties/Resources.resx b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/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/Tango.PPC.Common/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Settings.Designer.cs new file mode 100644 index 000000000..8537a6bb1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/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.Common.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/Tango.PPC.Common/Properties/Settings.settings b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj new file mode 100644 index 000000000..3a3090c6a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -0,0 +1,188 @@ + + + + + Debug + AnyCPU + {0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0} + library + Tango.PanelPC.Common + Tango.PanelPC.Common + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + ..\..\Build\Debug\PPC\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + + MultiPieChart.xaml + + + + + Code + + + + + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {4206ac58-3b57-4699-8835-90bf6db01a61} + Tango.Integration + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + + + DB\Tango.mdf + Always + + + DB\Tango_log.ldf + Always + + + + + False + Microsoft .NET Framework 4.6 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Themes/Generic.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Themes/Generic.xaml new file mode 100644 index 000000000..af7652bf7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Themes/Generic.xaml @@ -0,0 +1,18 @@ + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/app.config b/Software/Visual_Studio/PPC/Tango.PPC.Common/app.config new file mode 100644 index 000000000..dcbe9e918 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/app.config @@ -0,0 +1,61 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config b/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config new file mode 100644 index 000000000..033360b54 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file -- cgit v1.3.1