diff options
| author | Avi Levkovich <avi@twine-s.com> | 2017-12-19 12:28:20 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2017-12-19 12:28:20 +0200 |
| commit | 76aa983631df4fa5b16b170e2f6dd845c5ac9531 (patch) | |
| tree | 6b2b4d0776c54536ec07aabc6be94857dcee91fc /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common | |
| parent | 6bf71c81050b824398dc82ce4b69cdf71fb4a2f7 (diff) | |
| parent | b421701fd5cf000a16cab9b1fe9eda812ccce8c3 (diff) | |
| download | Tango-76aa983631df4fa5b16b170e2f6dd845c5ac9531.tar.gz Tango-76aa983631df4fa5b16b170e2f6dd845c5ac9531.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
25 files changed, 931 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs new file mode 100644 index 000000000..488a2f6dc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Authentication/IAuthenticationProvider.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.Common.Authentication +{ + public interface IAuthenticationProvider + { + event EventHandler<User> CurrentUserChanged; + + User CurrentUser { get; } + + User Login(String email, String password); + + void Logout(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiChild.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiChild.cs new file mode 100644 index 000000000..469e3fda5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiChild.cs @@ -0,0 +1,58 @@ +using MaterialDesignThemes.Wpf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using Tango.Core.Commands; + +namespace Tango.MachineStudio.Common.Controls +{ + public class MdiChild : DependencyObject + { + public MdiChild() + { + + } + + public MdiChild(String header, FrameworkElement view) : this() + { + Header = header; + View = view; + } + + public PackIconKind Icon + { + get { return (PackIconKind)GetValue(IconProperty); } + set { SetValue(IconProperty, value); } + } + public static readonly DependencyProperty IconProperty = + DependencyProperty.Register("Icon", typeof(PackIconKind), typeof(MdiChild), new PropertyMetadata(PackIconKind.LaptopWindows)); + + public String Header + { + get { return (String)GetValue(HeaderProperty); } + set { SetValue(HeaderProperty, value); } + } + public static readonly DependencyProperty HeaderProperty = + DependencyProperty.Register("Header", typeof(String), typeof(MdiChild), new PropertyMetadata(null)); + + public FrameworkElement View + { + get { return (FrameworkElement)GetValue(ViewProperty); } + set { SetValue(ViewProperty, value); } + } + public static readonly DependencyProperty ViewProperty = + DependencyProperty.Register("View", typeof(FrameworkElement), typeof(MdiChild), new PropertyMetadata(null)); + + public Point Location + { + get { return (Point)GetValue(LocationProperty); } + set { SetValue(LocationProperty, value); } + } + public static readonly DependencyProperty LocationProperty = + DependencyProperty.Register("Location", typeof(Point), typeof(MdiChild), new PropertyMetadata(new Point())); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml new file mode 100644 index 000000000..b248a4aec --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml @@ -0,0 +1,75 @@ +<UserControl x:Class="Tango.MachineStudio.Common.Controls.MdiContainerControl" + 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls" + xmlns:converters="clr-namespace:Tango.MachineStudio.Common.Converters" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + + <UserControl.Resources> + <converters:PointToMarginConverter x:Key="PointToMarginConverter"></converters:PointToMarginConverter> + </UserControl.Resources> + + <Grid> + <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> + <ItemsControl ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=ItemsSource}" x:Name="itemsControl"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <Canvas x:Name="canvas" HorizontalAlignment="Left" VerticalAlignment="Top"></Canvas> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemContainerStyle> + <Style TargetType="FrameworkElement"> + <Setter Property="Canvas.Left" Value="{Binding Location.X}"></Setter> + <Setter Property="Canvas.Top" Value="{Binding Location.Y}"></Setter> + <EventSetter Event="PreviewMouseDown" Handler="OnControlMouseDown"></EventSetter> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="10" /> + </Grid.Effect> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="25"/> + <RowDefinition Height="277*"/> + </Grid.RowDefinitions> + + <Grid Background="{StaticResource AccentColorBrush}"> + <Thumb Opacity="0" DragDelta="OnControlDragging" Tag="{Binding}"></Thumb> + <DockPanel LastChildFill="False"> + <StackPanel IsHitTestVisible="False" DockPanel.Dock="Left" VerticalAlignment="Center" Orientation="Horizontal" Margin="5 0 0 0"> + <materialDesign:PackIcon Kind="{Binding Icon}" Foreground="White"></materialDesign:PackIcon> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Foreground="White" Text="{Binding Header}"></TextBlock> + </StackPanel> + + <StackPanel DockPanel.Dock="Right" VerticalAlignment="Center" Orientation="Horizontal"> + <Button Foreground="White" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Close" Width="24" Height="24" Padding="0" Click="OnControlClosed" Tag="{Binding}"> + <materialDesign:PackIcon Kind="WindowClose" /> + </Button> + </StackPanel> + </DockPanel> + </Grid> + + <Grid Grid.Row="1" MinWidth="100" MinHeight="100"> + <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> + <ContentPresenter Content="{Binding View}"></ContentPresenter> + </ScrollViewer> + + <Thumb HorizontalAlignment="Right" VerticalAlignment="Stretch" Opacity="0" Width="5" Cursor="SizeWE" DragDelta="OnControlSizeRight" Tag="{Binding}"></Thumb> + <Thumb HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Opacity="0" Height="5" Cursor="SizeNS" DragDelta="OnControlSizeBottom" Tag="{Binding}"></Thumb> + <Thumb HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0" Height="10" Width="10" Cursor="SizeNWSE" DragDelta="OnControlResize" Tag="{Binding}"></Thumb> + </Grid> + </Grid> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml.cs new file mode 100644 index 000000000..dbf4ee74b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Common.Controls +{ + /// <summary> + /// Interaction logic for MdiContainerControl.xaml + /// </summary> + public partial class MdiContainerControl : UserControl + { + private const int MIN_SIZE = 200; + + public MdiContainerControl() + { + InitializeComponent(); + } + + public IEnumerable ItemsSource + { + get { return (IEnumerable)GetValue(ItemsSourceProperty); } + set { SetValue(ItemsSourceProperty, value); } + } + public static readonly DependencyProperty ItemsSourceProperty = + DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(MdiContainerControl), new PropertyMetadata(null)); + + private void OnControlDragging(object sender, DragDeltaEventArgs e) + { + var mdiControl = GetSenderTag<MdiChild>(sender); + mdiControl.Location = new Point(mdiControl.Location.X + e.HorizontalChange, mdiControl.Location.Y + e.VerticalChange); + FitCanvas(); + } + + private T GetSenderTag<T>(object sender) where T : class + { + return (T)((sender as FrameworkElement).Tag); + } + + private void FitCanvas() + { + Canvas canvas = GetCanvas(); + canvas.Width = canvas.Children.OfType<FrameworkElement>().Max(x => Canvas.GetLeft(x) + x.ActualWidth); + canvas.Height = canvas.Children.OfType<FrameworkElement>().Max(x => Canvas.GetTop(x) + x.ActualHeight); + } + + private Canvas GetCanvas() + { + return UIHelper.FindChild<Canvas>(itemsControl, "canvas"); + } + + + private void OnControlMouseDown(object sender, MouseButtonEventArgs e) + { + Canvas.SetZIndex(sender as FrameworkElement, GetCanvas().Children.OfType<FrameworkElement>().Max(x => Canvas.GetZIndex(x) + 1)); + } + + private void OnControlSizeRight(object sender, DragDeltaEventArgs e) + { + var mdiControl = GetSenderTag<MdiChild>(sender); + if (double.IsNaN(mdiControl.View.Width)) mdiControl.View.Width = mdiControl.View.ActualWidth; + if (mdiControl.View.Width + e.HorizontalChange > MIN_SIZE) mdiControl.View.Width += e.HorizontalChange; + } + + private void OnControlSizeBottom(object sender, DragDeltaEventArgs e) + { + var mdiControl = GetSenderTag<MdiChild>(sender); + if (double.IsNaN(mdiControl.View.Height)) mdiControl.View.Height = mdiControl.View.ActualHeight; + if (mdiControl.View.Height + e.VerticalChange > MIN_SIZE) mdiControl.View.Height += e.VerticalChange; + } + + private void OnControlResize(object sender, DragDeltaEventArgs e) + { + var mdiControl = GetSenderTag<MdiChild>(sender); + + if (double.IsNaN(mdiControl.View.Height)) mdiControl.View.Height = mdiControl.View.ActualHeight; + if (double.IsNaN(mdiControl.View.Width)) mdiControl.View.Width = mdiControl.View.ActualWidth; + + if (mdiControl.View.Height + e.VerticalChange > MIN_SIZE) mdiControl.View.Height += e.VerticalChange; + if (mdiControl.View.Width + e.HorizontalChange > MIN_SIZE) mdiControl.View.Width += e.HorizontalChange; + } + + private void OnControlClosed(object sender, RoutedEventArgs e) + { + (ItemsSource as IList).Remove(GetSenderTag<MdiChild>(sender)); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PointToMarginConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PointToMarginConverter.cs new file mode 100644 index 000000000..e6587b1ee --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/PointToMarginConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.MachineStudio.Common.Converters +{ + public class PointToMarginConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Point p = (Point)value; + return new Thickness(p.X, p.Y, 0, 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/IStudioMessageExtensions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/IStudioMessageExtensions.cs new file mode 100644 index 000000000..83183f328 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/IStudioMessageExtensions.cs @@ -0,0 +1,15 @@ +using GalaSoft.MvvmLight.Messaging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Messages; + +public static class IStudioMessageExtensions +{ + public static void Send(this IStudioMessage message) + { + Messenger.Default.Send(message); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs new file mode 100644 index 000000000..a6c98319e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; + +public static class UserExtensions +{ + public static bool HasPermission(this User user, Permissions permission) + { + return user.UsersRoles.Select(x => x.Role).ToList().SelectMany(x => x.RolesPermissions).ToList().Exists(x => x.Permission.Code == permission.ToInt32()); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs new file mode 100644 index 000000000..902a45a2f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.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.Media.Imaging; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.Common +{ + public interface IStudioModule : IDisposable + { + String Name { get; } + + String Description { get; } + + BitmapSource Image { get; } + + FrameworkElement MainView { get; } + + Permissions Permission { get; } + + bool IsInitialized { get; } + + void Initialize(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/IStudioMessage.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/IStudioMessage.cs new file mode 100644 index 000000000..7d1232c7b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/IStudioMessage.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Messages +{ + public interface IStudioMessage + { + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Modules/IStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Modules/IStudioModuleLoader.cs new file mode 100644 index 000000000..d67accbc1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Modules/IStudioModuleLoader.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Modules +{ + public interface IStudioModuleLoader + { + ObservableCollection<IStudioModule> AllModules { get; } + + ObservableCollection<IStudioModule> UserModules { get; } + + void LoadModules(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs new file mode 100644 index 000000000..631f9e2eb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Navigation +{ + public interface INavigationManager + { + void NavigateTo(NavigationView view); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/NavigationView.cs new file mode 100644 index 000000000..77dbaf5b4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/NavigationView.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Navigation +{ + public enum NavigationView + { + LoadingView, + MainView, + LoginView, + ShutdownView, + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs new file mode 100644 index 000000000..a45f9a847 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs @@ -0,0 +1,43 @@ +using MaterialDesignThemes.Wpf; +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.MachineStudio.Common.Notifications +{ + public interface INotificationProvider + { + ObservableCollection<TaskItem> TaskItems { get; } + + TaskItem CurrentTaskItem { get; } + + bool HasTaskItems { get; } + + void PushTaskItem(TaskItem taskItem); + + TaskItem PushTaskItem(String message); + + void PopTaskItem(TaskItem taskItem); + + bool? ShowModalWindow(Window window); + + bool ShowModalWindow<T>(PackIconKind icon, String title, object context) where T : FrameworkElement; + + bool ShowModalWindow(PackIconKind icon, String title, FrameworkElement content, object context); + + bool? ShowDialog(PackIconKind icon, Brush iconColor, String message, bool hasCancel); + + void ShowInfo(String message); + + void ShowWarnning(String message); + + void ShowError(String message); + + bool ShowQuestion(String message); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs new file mode 100644 index 000000000..0cf5e2c8e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.MachineStudio.Common.Notifications +{ + public class TaskItem : ExtendedObject, IDisposable + { + private INotificationProvider _notificationProvider; + + public TaskItem(INotificationProvider notificationProvider) + { + _notificationProvider = notificationProvider; + } + + private String _message; + public String Message + { + get { return _message; } + set { _message = value; RaisePropertyChangedAuto(); } + } + + public void Pop() + { + _notificationProvider.PopTaskItem(this); + } + + public void Push() + { + _notificationProvider.PushTaskItem(this); + } + + public void Dispose() + { + Pop(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..33d6edb60 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/AssemblyInfo.cs @@ -0,0 +1,17 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Machine Studio Common Components")] +[assembly: ComVisible(false)] + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/Resources.Designer.cs new file mode 100644 index 000000000..2a87dd02a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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.MachineStudio.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.MachineStudio.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/MachineStudio/Tango.MachineStudio.Common/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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/MachineStudio/Tango.MachineStudio.Common/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/Settings.Designer.cs new file mode 100644 index 000000000..8408dc8c8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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.MachineStudio.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/MachineStudio/Tango.MachineStudio.Common/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs new file mode 100644 index 000000000..a157bd598 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + public interface IShutdownRequestBlocker + { + Task<bool> OnShutdownRequest(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs new file mode 100644 index 000000000..0ee27fbf6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + public interface IStudioApplicationManager + { + void ShutDown(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs new file mode 100644 index 000000000..6b7984faf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Common +{ + public abstract class StudioViewModel : ViewModel + { + public abstract Task<bool> RequestShutdown(); + } + + public abstract class StudioViewModel<T> : ViewModel<T> where T : IView + { + public abstract Task<bool> OnShutdownRequest(); + + public StudioViewModel(T view) : base(view) + { + + } + } +} + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj new file mode 100644 index 000000000..1aa5216b4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -0,0 +1,141 @@ +<?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>{CB0B0AA2-BB24-4BCA-A720-45E397684E12}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.MachineStudio.Common</RootNamespace> + <AssemblyName>Tango.MachineStudio.Common</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\Build\Debug\</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="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + <Private>True</Private> + </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> + <Compile Include="StudioApplication\IStudioApplicationManager.cs" /> + <Compile Include="StudioApplication\IShutdownRequestBlocker.cs" /> + <Compile Include="ExtensionMethods\IStudioMessageExtensions.cs" /> + <Compile Include="Messages\IStudioMessage.cs" /> + <Compile Include="Notifications\TaskItem.cs" /> + <Compile Include="ValidationRules\Required.cs" /> + <Page Include="Controls\MdiContainerControl.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Compile Include="..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Authentication\IAuthenticationProvider.cs" /> + <Compile Include="Controls\MdiChild.cs" /> + <Compile Include="Controls\MdiContainerControl.xaml.cs"> + <DependentUpon>MdiContainerControl.xaml</DependentUpon> + </Compile> + <Compile Include="Converters\PointToMarginConverter.cs" /> + <Compile Include="ExtensionMethods\UserExtensions.cs" /> + <Compile Include="IStudioModule.cs" /> + <Compile Include="Modules\IStudioModuleLoader.cs" /> + <Compile Include="Navigation\INavigationManager.cs" /> + <Compile Include="Navigation\NavigationView.cs" /> + <Compile Include="Notifications\INotificationProvider.cs" /> + </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> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> + <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> + <Name>Tango.DAL.Observables</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.DAL.Remote\Tango.DAL.Remote.csproj"> + <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> + <Name>Tango.DAL.Remote</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs new file mode 100644 index 000000000..84f274965 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace Tango.MachineStudio.Common.ValidationRules +{ + public class Required : ValidationRule + { + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + return new ValidationResult(!String.IsNullOrWhiteSpace(value.ToStringSafe()), "Required"); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config new file mode 100644 index 000000000..f67c854e3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> + <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> + <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> +</packages>
\ No newline at end of file |
