diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-27 19:33:15 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-27 19:33:15 +0300 |
| commit | e571f20e27c4fca6bb6efe03d6427a1f332f9830 (patch) | |
| tree | b16041b76ea3b4e8368039c9396f9bbf9624dcc2 /Software/Visual_Studio/PPC | |
| parent | 157e0685abb2e7b22b6584cdc7d6f5838ed0a808 (diff) | |
| download | Tango-e571f20e27c4fca6bb6efe03d6427a1f332f9830.tar.gz Tango-e571f20e27c4fca6bb6efe03d6427a1f332f9830.zip | |
Working on panel pc.
Diffstat (limited to 'Software/Visual_Studio/PPC')
64 files changed, 3778 insertions, 0 deletions
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 +{ + /// <summary> + /// Represents the Machine Studio application manager. + /// </summary> + public interface IPPCApplicationManager + { + /// <summary> + /// Gets or sets the DAL machine. + /// </summary> + Machine Machine { get; } + + /// <summary> + /// Sets the machine. + /// </summary> + /// <param name="machine">The machine.</param> + void SetMachine(Machine machine); + + /// <summary> + /// Occurs when the connected machine property has changed. + /// </summary> + event EventHandler<IMachineOperator> ConnectedMachineChanged; + + /// <summary> + /// Gets a value indicating whether Machine Studio is shutting down. + /// </summary> + bool IsShuttingDown { get; } + + /// <summary> + /// Shutdown the application. + /// </summary> + void ShutDown(); + + /// <summary> + /// Gets or sets the currently connected machine if any. + /// </summary> + IMachineOperator ConnectedMachine { get; set; } + + /// <summary> + /// Gets the machine studio application version. + /// </summary> + 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<User> 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 +{ + /// <summary> + /// Represents the Machine Studio user authentication provider responsible for the current logged-in user. + /// </summary> + public interface IAuthenticationProvider + { + /// <summary> + /// Occurs when the current logged-in user has changed. + /// </summary> + event EventHandler<User> CurrentUserChanged; + + /// <summary> + /// Gets the current logged-in user. + /// </summary> + User CurrentUser { get; } + + /// <summary> + /// Performs a user login by the specified email and password. + /// </summary> + /// <param name="email">The email.</param> + /// <param name="password">The password.</param> + /// <returns></returns> + User Login(String email, String password); + + /// <summary> + /// Logs-out the current logged-in user. + /// </summary> + 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 @@ +<UserControl x:Class="Tango.PPC.Common.Controls.MultiPieChart" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:pieCharts="clr-namespace:Tango.PPC.Common.Controls"> + + <Image x:Name="_pieChartImage" RenderOptions.BitmapScalingMode="NearestNeighbor"/> + +</UserControl> 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 +{ + /// <summary> + /// Interaction logic for MultiPieChart.xaml + /// </summary> + 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<double> ), 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<double> DataList + { + get { return (IList<double>)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 ) + { + /* + * <GeometryDrawing Brush="@Brush"> + <GeometryDrawing.Geometry> + <PathGeometry> + <PathFigure StartPoint="@Size/2"> + <PathFigure.Segments> + <LineSegment Point="@startPoint"/> + <ArcSegment Point="@arcPoint" SweepDirection="Clockwise" Size="@Size/2"/> + <LineSegment Point="@Size/2"/> + </PathFigure.Segments> + </PathFigure> + </PathGeometry> + </GeometryDrawing.Geometry> + </GeometryDrawing> + * */ + + 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<Brush> + { + } +} 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<Segment> segments = value as ObservableCollection<Segment>; + + if (segments != null) + { + MultiPieChart pie = new MultiPieChart(); + + pie.DataList = new List<Double>(); + + 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 +{ + /// <summary> + /// Represents the default diagnostics frame provider. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.Diagnostics.IDiagnosticsFrameProvider" /> + public class DefaultDiagnosticsFrameProvider : ExtendedObject, IDiagnosticsFrameProvider + { + private IPPCApplicationManager _application; + + private bool _disable; + /// <summary> + /// Disables the frame delivery from the current connected machine and enables the manual push frame method. + /// </summary> + public bool Disable + { + get { return _disable; } + set + { + _disable = value; + } + } + + /// <summary> + /// Occurs when a new data frame is available. + /// </summary> + public event EventHandler<StartDiagnosticsResponse> FrameReceived; + + /// <summary> + /// Initializes a new instance of the <see cref="DefaultDiagnosticsFrameProvider"/> class. + /// </summary> + /// <param name="applicationManager">The application manager.</param> + public DefaultDiagnosticsFrameProvider(IPPCApplicationManager applicationManager) + { + _application = applicationManager; + applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + } + + /// <summary> + /// Applications the manager connected machine changed. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="machine">The machine.</param> + private void ApplicationManager_ConnectedMachineChanged(object sender, IMachineOperator machine) + { + if (machine != null) + { + machine.DiagnosticsDataAvailable += DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable; + } + } + + /// <summary> + /// Defaults the diagnostics frame provider diagnostics data available. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="frame">The frame.</param> + private void DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable(object sender, StartDiagnosticsResponse frame) + { + if (!Disable) + { + OnFrameReceived(frame); + } + } + + /// <summary> + /// Push frames manual. (Only when Disable = true) + /// </summary> + /// <param name="frame">The frame.</param> + public void PushFrame(StartDiagnosticsResponse frame) + { + if (Disable) + { + OnFrameReceived(frame); + } + } + + /// <summary> + /// Raises the <see cref="FrameReceived"/> event. + /// </summary> + /// <param name="frame">The frame.</param> + 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 +{ + /// <summary> + /// Represents a tango machine diagnostics frame provider. + /// </summary> + public interface IDiagnosticsFrameProvider + { + /// <summary> + /// Occurs when a new data frame is available. + /// </summary> + event EventHandler<StartDiagnosticsResponse> FrameReceived; + + /// <summary> + /// Disables the frame delivery from the current connected machine and enables the manual push frame method. + /// </summary> + bool Disable { get; set; } + + /// <summary> + /// Push frames manual. (Only when Disable = true) + /// </summary> + /// <param name="frame">The frame.</param> + 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 +{ + /// <summary> + /// Represents the default database events logger. + /// </summary> + /// <seealso cref="IEventLogger" /> + public class DefaultEventLogger : ExtendedObject, IEventLogger + { + private ObservablesContext _db; + private Thread _logThread; + private ConcurrentQueue<MachinesEvent> _events; + private IPPCApplicationManager _application; + private IAuthenticationProvider _authentication; + private Dictionary<EventTypes, BL.Entities.EventType> _eventTypesGuids; + private String _hostName; + private bool _isInitialized; + private List<MachinesEvent> _pendingEvents; + + #region Events + + /// <summary> + /// Occurs when a new machine event has been logged. + /// </summary> + public event EventHandler<MachinesEvent> NewLog; + + #endregion + + #region Constructors + + /// <summary> + /// Initializes a new instance of the <see cref="DefaultEventLogger"/> class. + /// </summary> + /// <param name="applicationManager">The application manager.</param> + /// <param name="authenticationProvider">The authentication provider.</param> + public DefaultEventLogger(IPPCApplicationManager applicationManager, IAuthenticationProvider authenticationProvider) + { + _hostName = Environment.MachineName; + + _events = new ConcurrentQueue<MachinesEvent>(); + _pendingEvents = new List<MachinesEvent>(); + + _eventTypesGuids = new Dictionary<EventTypes, BL.Entities.EventType>(); + + _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 + + /// <summary> + /// Handle the application manager connected machine changed event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="machine">The machine.</param> + 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; + } + } + + /// <summary> + /// Handles the RequestSent event of the connected machine. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="message">The message.</param> + 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())); + } + + /// <summary> + /// Handles the RequestFailed event of the connected machine. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="RequestFailedEventArgs"/> instance containing the event data.</param> + 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())); + } + + /// <summary> + /// Handles the ResponseReceived event of the connected machine. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="message">The message.</param> + 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())); + } + + /// <summary> + /// Handles the connected machine events state provider NewEvents event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="events">The events.</param> + private void MachineEventsStateProvider_NewEvents(object sender, IEnumerable<MachinesEvent> events) + { + foreach (var ev in events) + { + Log(ev); + } + } + + /// <summary> + /// Handles the connected machine events state provider EventsResolved event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="events">The events.</param> + private void MachineEventsStateProvider_EventsResolved(object sender, IEnumerable<MachinesEvent> events) + { + foreach (var ev in events) + { + Log(String.Format("Event '{0}' resolved.", ev.EventType.Name)); + } + } + + #endregion + + #region Logging + + /// <summary> + /// Logs the specified machine event. + /// </summary> + /// <param name="machineEvent">The machine event.</param> + 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); + } + } + + /// <summary> + /// Logs the specified event type. + /// </summary> + /// <param name="eventType">Type of the event.</param> + /// <param name="message">The message.</param> + 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); + } + + /// <summary> + /// Logs the specified hardware event. + /// </summary> + /// <param name="hardwareEvent">The hardware event.</param> + public void Log(Event hardwareEvent) + { + Log((EventTypes)hardwareEvent.Type, hardwareEvent.Message); + } + + /// <summary> + /// Logs the specified exception using the <see cref="EventTypes.ApplicationException"/>. + /// </summary> + /// <param name="exception">The exception.</param> + public void Log(Exception exception) + { + Log(EventTypes.ApplicationException, exception.ToString()); + } + + /// <summary> + /// Logs the specified exception using the <see cref="EventTypes.ApplicationException" />. + /// </summary> + /// <param name="exception">The exception.</param> + /// <param name="description"></param> + public void Log(Exception exception, string description) + { + Log(EventTypes.ApplicationException, description + Environment.NewLine + exception.ToString()); + } + + /// <summary> + /// Logs the specified message using the <see cref="EventTypes.ApplicationInformation"/>. + /// </summary> + /// <param name="message">The message.</param> + public void Log(String message) + { + Log(EventTypes.ApplicationInformation, message); + } + + /// <summary> + /// Logging thread loop. + /// </summary> + private void LogThreadMethod() + { + while (true) + { + FlushAll(); + Thread.Sleep(5000); + } + } + + /// <summary> + /// Immediately saves all pending events to database. + /// </summary> + 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 +{ + /// <summary> + /// Represents a database events logger. + /// </summary> + public interface IEventLogger + { + /// <summary> + /// Occurs when a new machine event has been logged. + /// </summary> + event EventHandler<MachinesEvent> NewLog; + + /// <summary> + /// Logs the specified machine event. + /// </summary> + /// <param name="machineEvent">The machine event.</param> + void Log(MachinesEvent machineEvent); + + /// <summary> + /// Logs the specified event type. + /// </summary> + /// <param name="eventType">Type of the event.</param> + /// <param name="message">The message.</param> + void Log(EventTypes eventType, String message); + + /// <summary> + /// Logs the specified hardware event. + /// </summary> + /// <param name="hardwareEvent">The hardware event.</param> + void Log(Event hardwareEvent); + + /// <summary> + /// Logs the specified exception using the <see cref="EventTypes.ApplicationException"/>. + /// </summary> + /// <param name="exception">The exception.</param> + void Log(Exception exception); + + /// <summary> + /// Logs the specified exception using the <see cref="EventTypes.ApplicationException"/>. + /// </summary> + /// <param name="exception">The exception.</param> + void Log(Exception exception, String description); + + /// <summary> + /// Logs the specified message using the <see cref="EventTypes.ApplicationInformation"/>. + /// </summary> + /// <param name="message">The message.</param> + void Log(String message); + + /// <summary> + /// Immediately saves all pending events to database. + /// </summary> + 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 +{ + /// <summary> + /// Represents the Machine Studio views navigation manager. + /// </summary> + public interface INavigationManager + { + /// <summary> + /// Navigates to the specified view. + /// </summary> + /// <param name="view">The view.</param> + 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 +{ + /// <summary> + /// Represents the available views to navigate to using the <see cref="INavigationManager"/>. + /// </summary> + 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 +{ + /// <summary> + /// Represents a dialog view model base class. + /// </summary> + /// <seealso cref="Tango.SharedUI.ViewModel" /> + public abstract class DialogViewVM : ViewModel + { + public event Action Accepted; + public event Action Canceled; + + /// <summary> + /// Initializes a new instance of the <see cref="DialogViewVM"/> class. + /// </summary> + public DialogViewVM() + { + CanClose = true; + CloseCommand = new RelayCommand(Cancel, (x) => CanClose); + OKCommand = new RelayCommand(Accept, (x) => CanClose); + } + + private bool _canClose; + /// <summary> + /// Gets or sets a value indicating whether this dialog can be closed. + /// </summary> + public bool CanClose + { + get { return _canClose; } + set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + /// <summary> + /// Gets or sets the close command. + /// </summary> + public RelayCommand CloseCommand { get; set; } + + /// <summary> + /// Gets or sets the ok command. + /// </summary> + public RelayCommand OKCommand { get; set; } + + /// <summary> + /// Called when the dialog has been shown. + /// </summary> + public virtual void OnShow() + { + + } + + /// <summary> + /// Invokes the <see cref="Accepted"/> event. + /// </summary> + protected virtual void Accept() + { + Accepted?.Invoke(); + } + + /// <summary> + /// Invokes the <see cref="Canceled"/> event. + /// </summary> + 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 +{ + /// <summary> + /// Represents the Machine Studio user notification provider responsible for displaying information, alerts and dialogs to the user. + /// </summary> + public interface INotificationProvider + { + /// <summary> + /// Gets the collection of active task items. + /// </summary> + ObservableCollection<TaskItem> TaskItems { get; } + + /// <summary> + /// Gets the current displayed task item. + /// </summary> + TaskItem CurrentTaskItem { get; } + + /// <summary> + /// Gets a value indicating whether there are any queued task items. + /// </summary> + bool HasTaskItems { get; } + + /// <summary> + /// Pushes the specified task item to the queue. + /// </summary> + /// <param name="taskItem">The task item.</param> + void PushTaskItem(TaskItem taskItem); + + /// <summary> + /// Create and push a new task item from the specified message. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> + TaskItem PushTaskItem(String message); + + /// <summary> + /// Removed the specified task item from the queue. + /// </summary> + /// <param name="taskItem">The task item.</param> + void PopTaskItem(TaskItem taskItem); + + /// <summary> + /// Creates a new instance of the specified View type and displays it as a modal dialog. + /// </summary> + /// <typeparam name="View">The type of the view.</typeparam> + /// <typeparam name="VM">The type of the view model.</typeparam> + /// <param name="onAccept">Accept button callback.</param> + /// <param name="onCancel">Cancel button callback.</param> + void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// <summary> + /// Creates a new view by a naming convention of the specified view model type. + /// </summary> + /// <typeparam name="VM">The type of the view model.</typeparam> + /// <param name="onAccept">Accept button callback.</param> + /// <param name="onCancel">Cancel button callback.</param> + void ShowModalDialog<VM>(Action<VM> onAccept, Action onCancel) where VM : DialogViewVM; + + /// <summary> + /// Shows the specified view with the specified view model as it's data context. + /// </summary> + /// <typeparam name="VM">The type of the mm.</typeparam> + /// <typeparam name="View">The type of the view.</typeparam> + /// <param name="vm">The view model.</param> + /// <param name="onAccept">The accept action.</param> + /// <param name="onCancel">The cancel action.</param> + void ShowModalDialog<VM, View>(VM vm, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// <summary> + /// Shows the specified view with the specified view model as it's data context. + /// </summary> + /// <typeparam name="VM">The type of the mm.</typeparam> + /// <typeparam name="View">The type of the view.</typeparam> + /// <param name="vm">The view model.</param> + /// <param name="view">The view.</param> + /// <param name="onAccept">The accept action.</param> + /// <param name="onCancel">The cancel action.</param> + void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; + + /// <summary> + /// Creates a new view by a naming convention of the specified view model type. + /// </summary> + /// <typeparam name="VM">The type of the view model.</typeparam> + /// <param name="onAccept">Accept button callback.</param> + void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM; + + /// <summary> + /// Shows an information message box. + /// </summary> + /// <param name="message">The message.</param> + void ShowInfo(String message); + + /// <summary> + /// Shows warning message box. + /// </summary> + /// <param name="message">The message.</param> + void ShowWarning(String message); + + /// <summary> + /// Shows an error message box. + /// </summary> + /// <param name="message">The message.</param> + void ShowError(String message); + + /// <summary> + /// Shows a question message box. + /// </summary> + /// <param name="message">The message.</param> + bool ShowQuestion(String message); + + /// <summary> + /// Shows a dialog with a text input field and returns the response. + /// </summary> + /// <param name="message">The message.</param> + /// <param name="hint">Text field hint.</param> + /// <param name="defaultResponse">Optional default response.</param> + /// <returns></returns> + 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 +{ + /// <summary> + /// Represents a Machine Studio "work-bar" item. + /// </summary> + /// <seealso cref="Tango.Core.ExtendedObject" /> + /// <seealso cref="System.IDisposable" /> + public class TaskItem : ExtendedObject, IDisposable + { + private INotificationProvider _notificationProvider; + + /// <summary> + /// Initializes a new instance of the <see cref="TaskItem"/> class. + /// </summary> + /// <param name="notificationProvider">The notification provider.</param> + public TaskItem(INotificationProvider notificationProvider) + { + _notificationProvider = notificationProvider; + } + + private String _message; + /// <summary> + /// Gets or sets the message. + /// </summary> + public String Message + { + get { return _message; } + set { _message = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Removed this item from the queue. + /// </summary> + public void Pop() + { + _notificationProvider.PopTaskItem(this); + } + + /// <summary> + /// Pushes this item to the queue. + /// </summary> + public void Push() + { + _notificationProvider.PushTaskItem(this); + } + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + 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<PPCSettings>(); + } + + 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 +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> 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 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Common.Properties { + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [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; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [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 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ 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 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +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 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PanelPC.Common</RootNamespace> + <AssemblyName>Tango.PanelPC.Common</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\Debug\PPC\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="Controls\MultiPieChart.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="Application\IPPCApplicationManager.cs" /> + <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> + <Compile Include="Authentication\IAuthenticationProvider.cs" /> + <Compile Include="Controls\MultiPieChart.xaml.cs"> + <DependentUpon>MultiPieChart.xaml</DependentUpon> + </Compile> + <Compile Include="Controls\MultiPieChartBrushCollection.cs" /> + <Compile Include="Converters\SegmentsToPieConverter.cs" /> + <Compile Include="CustomControl1.cs"> + <SubType>Code</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <Compile Include="Diagnostics\DefaultDiagnosticsFrameProvider.cs" /> + <Compile Include="Diagnostics\IDiagnosticsFrameProvider.cs" /> + <Compile Include="EventLogging\DefaultEventLogger.cs" /> + <Compile Include="EventLogging\IEventLogger.cs" /> + <Compile Include="Navigation\INavigationManager.cs" /> + <Compile Include="Navigation\NavigationView.cs" /> + <Compile Include="Notification\DialogViewVM.cs" /> + <Compile Include="Notification\INotificationProvider.cs" /> + <Compile Include="Notification\TaskItem.cs" /> + <Compile Include="PPCSettings.cs" /> + <Compile Include="PPCViewModel.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="..\..\..\DB\Tango.mdf"> + <Link>DB\Tango.mdf</Link> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="..\..\..\DB\Tango_log.ldf"> + <Link>DB\Tango_log.ldf</Link> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include=".NETFramework,Version=v4.6"> + <Visible>False</Visible> + <ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ 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 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.PPC.Common"> + <Style TargetType="{x:Type local:CustomControl1}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:CustomControl1}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> +</ResourceDictionary> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config new file mode 100644 index 000000000..895afa970 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> + </startup> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml new file mode 100644 index 000000000..ddfb18c60 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml @@ -0,0 +1,164 @@ +<Application x:Class="Tango.PPC.UI.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" + xmlns:local="clr-namespace:Tango.PPC.UI" + StartupUri="MainWindow.xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Resources/Colors.xaml"/> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Resources/Fonts.xaml"/> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchToggleButton.xaml" /> + + <!--Styles--> + <ResourceDictionary> + <Style TargetType="{x:Type ListBoxItem}" x:Key="basicListBoxItem"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderThickness" Value="0"></Setter> + <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Padding" Value="0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ListBoxItem}"> + <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="true"> + <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsSelected" Value="true"> + <Setter Property="Background" TargetName="Bd" Value="Transparent"/> + </Trigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsSelected" Value="true"/> + <Condition Property="Selector.IsSelectionActive" Value="false"/> + </MultiTrigger.Conditions> + <Setter Property="Background" TargetName="Bd" Value="Transparent"/> + </MultiTrigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="emptyToggleButton" TargetType="ToggleButton"> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ToggleButton"> + <Grid Background="{TemplateBinding Background}"> + <ContentPresenter /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="emptyButton" TargetType="Button"> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="{TemplateBinding Background}"> + <ContentPresenter /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!--Drag & Drop--> + <Style x:Key="draggableGrid" TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.Draggable" Value="True"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.DraggingSurface" Value="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"></Setter> + </Style> + + <Style x:Key="droppableGrid" TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.Droppable" Value="True"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.DraggingSurface" Value="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"></Setter> + <Style.Triggers> + <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> + <Setter Property="Opacity" Value="0.5"></Setter> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="0.95" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleX"></DoubleAnimation> + <DoubleAnimation To="0.95" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleY"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleX"></DoubleAnimation> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleY"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + </Style.Triggers> + </Style> + + <Style x:Key="draggableDroppableGrid" TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.Draggable" Value="True"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.Droppable" Value="True"></Setter> + <Setter Property="dragAndDrop:DragAndDropService.DraggingSurface" Value="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"></Setter> + <Style.Triggers> + <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> + <Setter Property="Opacity" Value="0.5"></Setter> + <Trigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="0.95" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleX"></DoubleAnimation> + <DoubleAnimation To="0.95" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleY"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleX"></DoubleAnimation> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="RenderTransform.ScaleY"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </Trigger.ExitActions> + </Trigger> + </Style.Triggers> + </Style> + <!--Drag & Drop--> + + <!--Extensions--> + + </ResourceDictionary> + + <ResourceDictionary Source="Resources/Colors.xaml"></ResourceDictionary> + <ResourceDictionary Source="Resources/MaterialOverride.xaml"></ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs new file mode 100644 index 000000000..357d15171 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using Tango.Settings; + +namespace Tango.PPC.UI +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + var s = SettingsManager.Default.GetOrCreate<Core.CoreSettings>(); + s.SQLServerAddress = "DB\\Tango.mdf"; + s.Save(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/cyan.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/cyan.png Binary files differnew file mode 100644 index 000000000..d53382f28 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Job Issues/cyan.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/account.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/account.png Binary files differnew file mode 100644 index 000000000..46f0d38fc --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/account.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/arrows.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/arrows.png Binary files differnew file mode 100644 index 000000000..ae3482ee5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/arrows.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/liquid.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/liquid.png Binary files differnew file mode 100644 index 000000000..7c5a4bceb --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/liquid.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/warning.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/warning.png Binary files differnew file mode 100644 index 000000000..5c7672421 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/warning.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml new file mode 100644 index 000000000..f716a6e88 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml @@ -0,0 +1,17 @@ +<Window x:Class="Tango.PPC.UI.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.PPC.UI" + xmlns:views="clr-namespace:Tango.PPC.UI.Views" + mc:Ignorable="d" + Title="MainWindow" Height="1000" Width="625" WindowStyle="None" ResizeMode="NoResize"> + <Grid> + <Viewbox Stretch="Fill"> + <Grid Height="1280" Width="800"> + <views:MainView/> + </Grid> + </Viewbox> + </Grid> +</Window> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs new file mode 100644 index 000000000..42ea21123 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -0,0 +1,40 @@ +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.Forms; +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 +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + public static MainWindow Instance { get; private set; } + + public MainWindow() + { + Instance = this; + + InitializeComponent(); + + WindowStartupLocation = WindowStartupLocation.Manual; + var lastMonitor = Screen.AllScreens.LastOrDefault(); + Left = lastMonitor.Bounds.Left; + Top = lastMonitor.Bounds.Top; + Width = lastMonitor.Bounds.Width; + Height = lastMonitor.Bounds.Height; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs new file mode 100644 index 000000000..83cf92f11 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Navigation; +using Tango.PPC.UI.Views; +using Tango.SharedUI.Controls; + +namespace Tango.PPC.UI.Navigation +{ + public class DefaultNavigationManager : INavigationManager + { + public void NavigateTo(NavigationView view) + { + NavigationControl[] controls = new NavigationControl[] + { + MainView.Instance.NavigationControl, + LayoutView.Instance.NavigationControl + }; + + var control = controls.Where(x => x.Elements.ToList().Exists(y => NavigationControl.GetNavigationName(y) == view.ToString())).SingleOrDefault(); + control.NavigateTo(view.ToString()); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs new file mode 100644 index 000000000..7f97f2a49 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -0,0 +1,116 @@ +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; +using FontAwesome.WPF; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.UI.Notifications +{ + public class DefaultNotificationProvider : INotificationProvider + { + public ObservableCollection<TaskItem> TaskItems + { + get + { + throw new NotImplementedException(); + } + } + + public TaskItem CurrentTaskItem + { + get + { + throw new NotImplementedException(); + } + } + + public bool HasTaskItems + { + get + { + throw new NotImplementedException(); + } + } + + public void PopTaskItem(TaskItem taskItem) + { + throw new NotImplementedException(); + } + + public void PushTaskItem(TaskItem taskItem) + { + throw new NotImplementedException(); + } + + public TaskItem PushTaskItem(string message) + { + throw new NotImplementedException(); + } + + public void ShowError(string message) + { + throw new NotImplementedException(); + } + + public void ShowInfo(string message) + { + throw new NotImplementedException(); + } + + public bool? ShowMessageBox(FontAwesomeIcon icon, Brush iconColor, string message, bool hasCancel) + { + throw new NotImplementedException(); + } + + public void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) + where View : FrameworkElement + where VM : DialogViewVM + { + throw new NotImplementedException(); + } + + public void ShowModalDialog<VM>(Action<VM> onAccept, Action onCancel) where VM : DialogViewVM + { + throw new NotImplementedException(); + } + + public void ShowModalDialog<VM, View>(VM vm, Action<VM> onAccept, Action onCancel) + where VM : DialogViewVM + where View : FrameworkElement + { + throw new NotImplementedException(); + } + + public void ShowModalDialog<VM, View>(VM vm, View view, Action<VM> onAccept, Action onCancel) + where VM : DialogViewVM + where View : FrameworkElement + { + throw new NotImplementedException(); + } + + public void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM + { + throw new NotImplementedException(); + } + + public bool ShowQuestion(string message) + { + throw new NotImplementedException(); + } + + public string ShowTextInput(string message, string hint, string defaultResponse = null) + { + throw new NotImplementedException(); + } + + public void ShowWarning(string message) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs new file mode 100644 index 000000000..29b9f7823 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.Settings; +using Tango.PPC.Common.Application; +using Tango.Core.DI; +using Tango.PPC.Common; +using System.Windows; +using Tango.Core; + +namespace Tango.PPC.UI.PPCApplication +{ + public class DefaultPPCApplicationManager : ExtendedObject, IPPCApplicationManager + { + public bool IsShuttingDown + { + get + { + throw new NotImplementedException(); + } + } + + public IMachineOperator ConnectedMachine + { + get + { + throw new NotImplementedException(); + } + + set + { + throw new NotImplementedException(); + } + } + + public string Version + { + get + { + throw new NotImplementedException(); + } + } + + private Machine _machine; + public Machine Machine + { + private set + { + _machine = value; + } + get + { + return _machine; + } + } + + public event EventHandler<IMachineOperator> ConnectedMachineChanged; + + public DefaultPPCApplicationManager() + { + if (!DesignMode) + { + MainWindow.Instance.ContentRendered += (_, __) => + { + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<PPCViewModel>()) + { + vm.OnApplicationStarted(); + } + }; + } + } + + public void ShutDown() + { + throw new NotImplementedException(); + } + + public void SetMachine(Machine machine) + { + Machine = machine; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..acd22cb21 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/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.UI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.PanelPC.UI")] +[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 +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> 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.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Resources.Designer.cs new file mode 100644 index 000000000..3af06554c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.UI.Properties +{ + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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() + { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [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.UI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [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.UI/Properties/Resources.resx b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Settings.Designer.cs new file mode 100644 index 000000000..dab4cb31e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// 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. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.UI.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.UI/Properties/Settings.settings b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml new file mode 100644 index 000000000..431533fcb --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Colors.xaml @@ -0,0 +1,14 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.PPC.UI.Resources"> + + + <Color x:Key="AccentColor">#2F65EE</Color> + <SolidColorBrush x:Key="AccentColorBrush" Color="{StaticResource AccentColor}"></SolidColorBrush> + + <Color x:Key="WhiteColor">#FFFFFF</Color> + <SolidColorBrush x:Key="WhiteColorBrush" Color="{StaticResource WhiteColor}"></SolidColorBrush> + + <Color x:Key="BorderColor">#C8CBD4</Color> + <SolidColorBrush x:Key="BorderColorBrush" Color="{StaticResource BorderColor}"></SolidColorBrush> +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/MaterialOverride.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/MaterialOverride.xaml new file mode 100644 index 000000000..49fb3e837 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/MaterialOverride.xaml @@ -0,0 +1,185 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf" + xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf" + xmlns:local="clr-namespace:Tango.PPC.UI.Resources"> + + + <Style TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}"> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"></Setter> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"></Setter> + <Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly"></Setter> + <Setter Property="VirtualizingStackPanel.ScrollUnit" Value="Pixel"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + </Style> + + <!--ListBoxItem--><!-- + <Style TargetType="{x:Type ListBoxItem}"> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/> + <Setter Property="Padding" Value="8"/> + <Setter Property="SnapsToDevicePixels" Value="True"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ListBoxItem}"> + <Border Background="White" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5" + Margin="2" + ClipToBounds="{TemplateBinding ClipToBounds}"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="8" Color="Silver" /> + </Border.Effect> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup Name="CommonStates"> + <VisualStateGroup.Transitions> + <VisualTransition GeneratedDuration="0:0:0.3" To="Normal"> + <VisualTransition.GeneratedEasingFunction> + <CircleEase EasingMode="EaseOut"/> + </VisualTransition.GeneratedEasingFunction> + </VisualTransition> + </VisualStateGroup.Transitions> + <VisualState Name="Normal"/> + --><!--<VisualState Name="MouseOver"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="Opacity" + To="0.1" Duration="0"/> + </Storyboard> + </VisualState>--><!-- + <VisualState Name="Disabled"/> + </VisualStateGroup> + <VisualStateGroup Name="SelectionStates"> + <VisualStateGroup.Transitions> + <VisualTransition GeneratedDuration="0:0:0.6"/> + </VisualStateGroup.Transitions> + <VisualState Name="Selected"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="SelectedBorder" + Storyboard.TargetProperty="Opacity" + To="0.18" Duration="0"/> + </Storyboard> + </VisualState> + <VisualState Name="Unselected"/> + <VisualState Name="SelectedUnfocused"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="SelectedBorder" + Storyboard.TargetProperty="Opacity" + To="0.03" Duration="0"/> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid> + <Border x:Name="MouseOverBorder" + Opacity="0" CornerRadius="5" + Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"/> + + <Border x:Name="SelectedBorder" + Opacity="0" CornerRadius="5" + Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <ScaleTransform ScaleX="1"/> + </Border.RenderTransform> + </Border> + <wpf:Ripple Feedback="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}" + Focusable="False" + Content="{TemplateBinding Content}" + ContentTemplate="{TemplateBinding ContentTemplate}" + ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" + Padding="{TemplateBinding Padding}"/> + </Grid> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Opacity" Value=".56" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + --><!--ListBoxItem--> + + <!--Colors--> + <SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource Primary200}" /> + <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary200Foreground}" /> + <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource AccentColor}" /> + <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}" /> + <SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource Primary700}" /> + <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary700Foreground}" /> + <!--Colors--> + + <!--RoundedButton--><!-- + <Style x:Key="MaterialDesignRaisedRoundedButton" TargetType="{x:Type ButtonBase}"> + <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> + <Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/> + <Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/> + <Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidForegroundBrush}"/> + <Setter Property="wpf:RippleAssist.Feedback" Value="White" /> + <Setter Property="Cursor" Value="Hand"/> + <Setter Property="wpf:ShadowAssist.ShadowDepth" Value="Depth1" /> + <Setter Property="TextBlock.FontWeight" Value="Medium"/> + <Setter Property="TextBlock.FontSize" Value="14"/> + <Setter Property="BorderThickness" Value="1"/> + <Setter Property="HorizontalContentAlignment" Value="Center"/> + <Setter Property="VerticalContentAlignment" Value="Center"/> + <Setter Property="Padding" Value="16 4 16 4"/> + <Setter Property="Height" Value="32" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ButtonBase}"> + <Grid> + <AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}"> + <Grid> + <Border Background="{TemplateBinding Background}" CornerRadius="20" + BorderThickness="{TemplateBinding BorderThickness}" + BorderBrush="{TemplateBinding BorderBrush}" + x:Name="border" + Effect="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ShadowAssist.ShadowDepth), Converter={x:Static converters:ShadowConverter.Instance}}" /> + <Border HorizontalAlignment="Left" Background="{DynamicResource MaterialDesignBackground}" Opacity=".4"> + <Border.Width> + <MultiBinding Converter="{StaticResource RangeLengthConverter}"> + <Binding Path="(wpf:ButtonProgressAssist.Minimum)" RelativeSource="{RelativeSource TemplatedParent}" /> + <Binding Path="(wpf:ButtonProgressAssist.Maximum)" RelativeSource="{RelativeSource TemplatedParent}" /> + <Binding Path="(wpf:ButtonProgressAssist.Value)" RelativeSource="{RelativeSource TemplatedParent}" /> + <Binding Path="ActualWidth" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type ButtonBase}}" /> + </MultiBinding> + </Border.Width> + </Border> + </Grid> + </AdornerDecorator> + <wpf:Ripple Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False" + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" + Padding="{TemplateBinding Padding}" + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsMouseOver" Value="true"> + <Setter TargetName="border" Property="wpf:ShadowAssist.Darken" Value="True" /> + </Trigger> + <Trigger Property="IsKeyboardFocused" Value="true"> + <Setter TargetName="border" Property="wpf:ShadowAssist.Darken" Value="True" /> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter Property="Opacity" Value="0.23"/> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + --><!--RoundedButton--> + + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Styles.xaml new file mode 100644 index 000000000..110bbfc86 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Styles.xaml @@ -0,0 +1,19 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.PPC.UI.Resources"> + + <Style x:Key="JobsListBoxItem" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Setter Property="BorderBrush" Value="Silver"></Setter> + <Setter Property="BorderThickness" Value="0 0 0 1"></Setter> + <Setter Property="Focusable" Value="False"></Setter> + <Setter Property="Background" Value="White"></Setter> + </Style> + + + + <Style x:Key="JobsListBox" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}"> + <Setter Property="ItemContainerStyle" Value="{StaticResource JobsListBoxItem}"></Setter> + <Setter Property="Background" Value="#f2f5fa"></Setter> + </Style> + +</ResourceDictionary>
\ No newline at end of file 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 new file mode 100644 index 000000000..6a60b6701 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -0,0 +1,236 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{654BEDA3-16FB-44FF-ADE7-B52E50B02E63}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>Tango.PanelPC.UI</RootNamespace> + <AssemblyName>Tango.PanelPC.UI</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\Debug\PPC\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\Build\Release\PanelPC\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath> + </Reference> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> + <HintPath>..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll</HintPath> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Compile Include="Navigation\DefaultNavigationManager.cs" /> + <Compile Include="Notifications\DefaultNotificationProvider.cs" /> + <Compile Include="PPCApplication\DefaultPPCApplicationManager.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\JobsViewVM.cs" /> + <Compile Include="ViewModels\LayoutViewVM.cs" /> + <Compile Include="ViewModels\LoadingViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\JobsView.xaml.cs"> + <DependentUpon>JobsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\LayoutView.xaml.cs"> + <DependentUpon>LayoutView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\LoadingView.xaml.cs"> + <DependentUpon>LoadingView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="MainWindow.xaml.cs"> + <DependentUpon>MainWindow.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Page Include="Resources\Colors.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Resources\MaterialOverride.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Resources\Styles.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\JobsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\LayoutView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\LoadingView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DragAndDrop\Tango.DragAndDrop.csproj"> + <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> + <Name>Tango.DragAndDrop</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Serialization\Tango.Serialization.csproj"> + <Project>{22f87980-e990-4686-be81-be63d562c4d5}</Project> + <Name>Tango.Serialization</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.TFS\Tango.TFS.csproj"> + <Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project> + <Name>Tango.TFS</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\liquid.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\account.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\arrows.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Job Issues\cyan.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\warning.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ 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 new file mode 100644 index 000000000..3a37fe452 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -0,0 +1,93 @@ +using System; +using Tango.Core.DI; +using Tango.Integration.Services; +using Tango.Logging; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.Diagnostics; +using Tango.PPC.Common.EventLogging; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.Notifications; +using Tango.PPC.UI.Navigation; +using Tango.PPC.UI.Notifications; +using Tango.PPC.UI.PPCApplication; +using Tango.PPC.UI.ViewModels; +using Tango.TFS; + +namespace Tango.PPC.UI +{ + /// <summary> + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// </summary> + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Unregister<INotificationProvider>(); + TangoIOC.Default.Unregister<IAuthenticationProvider>(); + TangoIOC.Default.Unregister<INavigationManager>(); + TangoIOC.Default.Unregister<IPPCApplicationManager>(); + TangoIOC.Default.Unregister<ExternalBridgeScanner>(); + TangoIOC.Default.Unregister<IDiagnosticsFrameProvider>(); + TangoIOC.Default.Unregister<IEventLogger>(); + TangoIOC.Default.Unregister<ITeamFoundationServiceClient>(); + + TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); + TangoIOC.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); + TangoIOC.Default.Register<INavigationManager, DefaultNavigationManager>(); + TangoIOC.Default.Register<IPPCApplicationManager, DefaultPPCApplicationManager>(); + TangoIOC.Default.Register<ExternalBridgeScanner, ExternalBridgeScanner>(); + TangoIOC.Default.Register<IDiagnosticsFrameProvider, DefaultDiagnosticsFrameProvider>(); + TangoIOC.Default.Register<IEventLogger, DefaultEventLogger>(); + //TangoIOC.Default.Register<TeamFoundationServiceExtendedClient>(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); + + TangoIOC.Default.Register<LoadingViewVM>(); + TangoIOC.Default.Register<MainViewVM>(); + TangoIOC.Default.Register<LayoutViewVM>(); + TangoIOC.Default.Register<JobsViewVM>(); + //TangoIOC.Default.Register<LoadingViewVM>(); + //TangoIOC.Default.Register<ShutdownViewVM>(); + //TangoIOC.Default.Register<LoginViewVM>(); + //TangoIOC.Default.Register<MachineConnectionViewVM>(); + //TangoIOC.Default.Register<ConnectedMachineViewVM>(); + //TangoIOC.Default.Register<MachineLoginViewVM>(); + //TangoIOC.Default.Register<UpdateViewVM>(); + } + + public static LoadingViewVM LoadingView + { + get + { + return TangoIOC.Default.GetInstance<LoadingViewVM>(); + } + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + + public static LayoutViewVM LayoutViewVM + { + get + { + return TangoIOC.Default.GetInstance<LayoutViewVM>(); + } + } + + public static JobsViewVM JobsViewVM + { + get + { + return TangoIOC.Default.GetInstance<JobsViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs new file mode 100644 index 000000000..0eb59eeeb --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.PPC.Common; +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.UI.ViewModels +{ + public class JobsViewVM : PPCViewModel + { + private ObservablesContext _jobsContext; + + private ObservableCollection<Job> _jobs; + + public ObservableCollection<Job> Jobs + { + get { return _jobs; } + set { _jobs = value; RaisePropertyChangedAuto(); } + } + + public JobsViewVM(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification) : base(application, authentication, navigation, notification) + { + Jobs = new ObservableCollection<Job>(); + } + + public override void OnApplicationStarted() + { + LoadJobs(); + } + + private void LoadJobs() + { + Task.Factory.StartNew(() => + { + if (_jobsContext != null) + { + _jobsContext.Dispose(); + } + + _jobsContext = ObservablesContext.CreateDefault(); + Jobs = _jobsContext.Jobs.Where(x => x.Machine.SerialNumber == Settings.MachineSerialNumber).ToObservableCollection(); + }); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs new file mode 100644 index 000000000..cc64f82f5 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.PPC.UI.ViewModels +{ + public class LayoutViewVM : ViewModel + { + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs new file mode 100644 index 000000000..4cc812a17 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.Notifications; +using Tango.SharedUI; + +namespace Tango.PPC.UI.ViewModels +{ + public class LoadingViewVM : PPCViewModel + { + public LoadingViewVM(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification) : base(application, authentication, navigation, notification) + { + + } + + public async override void OnApplicationStarted() + { + await Task.Delay(2000); + NavigationManager.NavigateTo(NavigationView.LayoutView); + NavigationManager.NavigateTo(NavigationView.JobsView); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..c75e031f1 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Application; +using Tango.SharedUI; + +namespace Tango.PPC.UI.ViewModels +{ + public class MainViewVM : ViewModel + { + public String Test { get; set; } + + public MainViewVM(IPPCApplicationManager application) + { + Test = "This is a binding test"; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/JobsView.xaml new file mode 100644 index 000000000..8062280de --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/JobsView.xaml @@ -0,0 +1,94 @@ +<UserControl x:Class="Tango.PPC.UI.Views.JobsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:keyboard="clr-namespace:Tango.SharedUI.Keyboard;assembly=Tango.SharedUI" + xmlns:converters="clr-namespace:Tango.PPC.Common.Converters;assembly=Tango.PanelPC.Common" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobsViewVM}"> + + <UserControl.Resources> + <converters:SegmentsToPieConverter x:Key="SegmentsToPieConverter" /> + <sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" /> + </UserControl.Resources> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="82"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" Margin="20" FontSize="25" FontWeight="SemiBold">JOBS</TextBlock> + </Border> + + <Grid Grid.Row="1"> + <Grid.RowDefinitions> + <RowDefinition Height="100"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <touch:TouchNavigationLinks VerticalAlignment="Bottom" Margin="20" FontSize="18" FontWeight="SemiBold"> + <sys:String>READY TO DYE</sys:String> + <sys:String>NOT READY</sys:String> + <sys:String>ALL</sys:String> + </touch:TouchNavigationLinks> + + <Grid Grid.Row="1"> + <touch:TouchDataGrid ItemsSource="{Binding Jobs}" Margin="10" EnableDropShadow="True" ShadowColor="#ECECEC" AutoGenerateColumns="False" RowHeight="68" ColumnHeaderHeight="67"> + <touch:TouchDataGrid.Columns> + <DataGridTemplateColumn> + <DataGridTemplateColumn.Header> + <Image Source="/Images/warning.png" Width="24" /> + </DataGridTemplateColumn.Header> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Image Source="/Images/Job Issues/cyan.png" Width="38" /> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Status" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Width="295" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Length (m)" Binding="{Binding Length,StringFormat=0.0}"></DataGridTextColumn> + <DataGridTemplateColumn Header="Colors" SortMemberPath="Segments.Count"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <ContentControl Content="{Binding Segments,Converter={StaticResource SegmentsToPieConverter}}" Width="23" Height="23"></ContentControl> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="Updated" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></DataGridTextColumn> + <DataGridTextColumn Binding="{Binding JobIndex}" Width="70" SortMemberPath="JobIndex"> + <DataGridTextColumn.HeaderStyle> + <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + </Style> + </DataGridTextColumn.HeaderStyle> + <DataGridTextColumn.Header> + <Grid> + <Grid IsHitTestVisible="False"> + <Rectangle HorizontalAlignment="Left" StrokeThickness="2" Stroke="{StaticResource TangoColumnDividerBrush}" /> + <Image Source="/Images/arrows.png" Width="28" /> + </Grid> + </Grid> + </DataGridTextColumn.Header> + </DataGridTextColumn> + </touch:TouchDataGrid.Columns> + </touch:TouchDataGrid> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/JobsView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/JobsView.xaml.cs new file mode 100644 index 000000000..3ccb48c01 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/JobsView.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 +{ + /// <summary> + /// Interaction logic for JobsView.xaml + /// </summary> + public partial class JobsView : UserControl + { + public JobsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml new file mode 100644 index 000000000..2a6d1b52b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -0,0 +1,119 @@ +<UserControl x:Class="Tango.PPC.UI.Views.LayoutView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LayoutViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LayoutViewVM}"> + + <Grid> + <touch:TouchSideMenu x:Name="menu"> + <touch:TouchSideMenu.MenuContent> + <Border x:Name="border" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}"> + <DockPanel LastChildFill="False" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <StackPanel MinWidth="300" DockPanel.Dock="Top"> + <Grid> + <touch:TouchToggleButton Style="{StaticResource TouchToggleButtonHamburger}" + HorizontalAlignment="Right" Margin="16" + IsChecked="{Binding ElementName=menu,Path=IsOpened}" /> + + <StackPanel Margin="5 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center"> + <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image> + <StackPanel Margin="0 5 0 0"> + <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock> + <TextBlock FontSize="12" TextTrimming="CharacterEllipsis" MaxWidth="170" FontStyle="Italic" Margin="10 5 0 0" VerticalAlignment="Center"> + <Run Text="{Binding AuthenticationProvider.CurrentUser.Organization.Name}"></Run> + , + <Run Text="{Binding AuthenticationProvider.CurrentUser.Roles[0].Name}"> + <Run.ToolTip> + <ItemsControl ItemsSource="{Binding AuthenticationProvider.CurrentUser.Roles}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal" Margin="2"> + <fa:ImageAwesome Icon="User" Width="16" Height="16" /> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Run.ToolTip> + </Run> + <Run>...</Run> + </TextBlock> + </StackPanel> + </StackPanel> + </Grid> + <StackPanel Margin="0 16 0 0"> + <ListBoxItem> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding HomeCommand}"></i:InvokeCommandAction> + </i:EventTrigger> + </i:Interaction.Triggers> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome VerticalAlignment="Center" Icon="Home" Width="32" Height="32"></fa:ImageAwesome> + <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Home</TextBlock> + </StackPanel> + </ListBoxItem> + </StackPanel> + </StackPanel> + + <StackPanel DockPanel.Dock="Bottom"> + <Separator Margin="0 10 0 0" Background="Gainsboro" /> + <ListBoxItem> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding SignoutCommand}"></i:InvokeCommandAction> + </i:EventTrigger> + </i:Interaction.Triggers> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome VerticalAlignment="Center" Icon="SignOut" Width="32" Height="32"></fa:ImageAwesome> + <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Sign out</TextBlock> + </StackPanel> + </ListBoxItem> + </StackPanel> + </DockPanel> + </Border> + </touch:TouchSideMenu.MenuContent> + + <DockPanel> + <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" DockPanel.Dock="Top"> + <DockPanel> + <Border Padding="20" BorderThickness="0 0 1 0" BorderBrush="{StaticResource BorderColorBrush}"> + <touch:TouchToggleButton Width="50" Height="50" Foreground="{StaticResource TangoPrimaryAccentBrush}" Style="{StaticResource TouchToggleButtonHamburger}" IsChecked="{Binding ElementName=menu,Path=IsOpened}"> + <ToggleButton.Effect> + <DropShadowEffect ShadowDepth="15" BlurRadius="20" Color="Silver" /> + </ToggleButton.Effect> + </touch:TouchToggleButton> + </Border> + <Grid> + <StackPanel HorizontalAlignment="Right" Margin="30 0" Orientation="Horizontal"> + <touch:TouchButton Height="54" FontSize="20" Padding="0" Width="184" CornerRadius="30" BlurRadius="20"> + DYE + </touch:TouchButton> + </StackPanel> + </Grid> + </DockPanel> + </Border> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid> + <keyboard:KeyboardView> + <controls:NavigationControl x:Name="NavigationControl" x:FieldModifier="public" TransitionAlwaysFades="False" TransitionType="Slide"> + <local:JobsView controls:NavigationControl.NavigationName="JobsView"></local:JobsView> + </controls:NavigationControl> + </keyboard:KeyboardView> + </Grid> + </Grid> + </DockPanel> + </touch:TouchSideMenu> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs new file mode 100644 index 000000000..e6c778a92 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs @@ -0,0 +1,31 @@ +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 +{ + /// <summary> + /// Interaction logic for LayoutView.xaml + /// </summary> + public partial class LayoutView : UserControl + { + public static LayoutView Instance { get; private set; } + + public LayoutView() + { + InitializeComponent(); + Instance = this; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml new file mode 100644 index 000000000..d50c42f7c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml @@ -0,0 +1,18 @@ +<UserControl x:Class="Tango.PPC.UI.Views.LoadingView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="720" Background="White" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}"> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <touch:TouchBusyIndicator IsIndeterminate="True" Value="0" Width="200" Height="200" StrokeThickness="10"></touch:TouchBusyIndicator> + <TextBlock FontSize="20" Margin="20" HorizontalAlignment="Center">Loading...</TextBlock> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml.cs new file mode 100644 index 000000000..a1214a0df --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.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 +{ + /// <summary> + /// Interaction logic for LoadingView.xaml + /// </summary> + public partial class LoadingView : UserControl + { + public LoadingView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml new file mode 100644 index 000000000..9d264afae --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -0,0 +1,18 @@ +<UserControl x:Class="Tango.PPC.UI.Views.MainView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid> + <controls:NavigationControl TransitionAlwaysFades="True" TransitionType="Zoom" x:Name="NavigationControl" x:FieldModifier="public"> + <local:LoadingView controls:NavigationControl.NavigationName="LoadingView"></local:LoadingView> + <local:LayoutView controls:NavigationControl.NavigationName="LayoutView"></local:LayoutView> + </controls:NavigationControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml.cs new file mode 100644 index 000000000..cd7562d04 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml.cs @@ -0,0 +1,31 @@ +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 +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public static MainView Instance { get; private set; } + + public MainView() + { + InitializeComponent(); + Instance = this; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config new file mode 100644 index 000000000..e4617d73a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/packages.config @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="ControlzEx" version="3.0.2.4" targetFramework="net46" /> + <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file |
