diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-13 13:45:13 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-13 13:45:13 +0200 |
| commit | 2c376ac3ae651dd6c6592cc4cbf72768dc97a93d (patch) | |
| tree | b1f4a2210ab94e023ea122330fd97e830ebdb9c7 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 5babd8f257e9e6623ef1b0f1b17bc30619cc62bd (diff) | |
| download | Tango-2c376ac3ae651dd6c6592cc4cbf72768dc97a93d.tar.gz Tango-2c376ac3ae651dd6c6592cc4cbf72768dc97a93d.zip | |
Moved Machine Studio to its own folder.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
55 files changed, 2294 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config new file mode 100644 index 000000000..92aa00bf9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -0,0 +1,16 @@ +<?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> + <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/MachineStudio/Tango.MachineStudio.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml new file mode 100644 index 000000000..f6f2da415 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml @@ -0,0 +1,89 @@ +<Application x:Class="Tango.MachineStudio.UI.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.MachineStudio.UI" + xmlns:converters="clr-namespace:Tango.MachineStudio.UI.Converters" + xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz" + 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> + <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! --> + <!-- Accent and AppTheme setting --> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"> + </ResourceDictionary> + <!--Material Design--> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/materialdesigncolor.lightblue.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/materialdesigncolor.yellow.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.CheckBox.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ListBox.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.RadioButton.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.TextBlock.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Label.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Slider.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.ProgressBar.xaml"/> + + + <!--MahApps Brushes--> + <ResourceDictionary> + <SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource Primary700}" /> + <SolidColorBrush x:Key="AccentColorBrush" Color="{DynamicResource Primary500}" /> + <SolidColorBrush x:Key="AccentColorBrush2" Color="{DynamicResource Primary400}" /> + <SolidColorBrush x:Key="AccentColorBrush3" Color="{DynamicResource Primary300}" /> + <SolidColorBrush x:Key="AccentColorBrush4" Color="{DynamicResource Primary200}" /> + <SolidColorBrush x:Key="WindowTitleColorBrush" Color="{DynamicResource Primary700}" /> + <SolidColorBrush x:Key="AccentSelectedColorBrush" Color="{DynamicResource Primary500Foreground}" /> + <LinearGradientBrush x:Key="ProgressBrush" EndPoint="0.001,0.5" StartPoint="1.002,0.5"> + <GradientStop Color="{DynamicResource Primary700}" Offset="0" /> + <GradientStop Color="{DynamicResource Primary300}" Offset="1" /> + </LinearGradientBrush> + <SolidColorBrush x:Key="CheckmarkFill" Color="{DynamicResource Primary500}" /> + <SolidColorBrush x:Key="RightArrowFill" Color="{DynamicResource Primary500}" /> + <SolidColorBrush x:Key="IdealForegroundColorBrush" Color="{DynamicResource Primary500Foreground}" /> + <SolidColorBrush x:Key="IdealForegroundDisabledBrush" Color="{DynamicResource Primary500}" Opacity="0.4" /> + </ResourceDictionary> + + <!-- Include the Dragablz Material Design style --> + <ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/materialdesign.xaml"/> + + <ResourceDictionary> + <!-- tell Dragablz tab control to use the Material Design theme --> + <Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource MaterialDesignTabablzControlStyle}" /> + </ResourceDictionary> + + <ResourceDictionary> + <local:ViewModelLocator x:Key="Locator" d:IsDataSource="True" /> + </ResourceDictionary> + + <!--Binding Converters--> + <ResourceDictionary> + <converters:UsersRolesToStringConverter x:Key="UsersRolesToStringConverter"></converters:UsersRolesToStringConverter> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs new file mode 100644 index 000000000..b3b92b6ab --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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.DAL.Observables; + +namespace Tango.MachineStudio.UI +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + public static ObservablesEntitiesAdapter DbAdapter { get; set; } + + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + + DbAdapter = ObservablesEntitiesAdapter.Instance; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/DbTableView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/DbTableView.xaml new file mode 100644 index 000000000..be9776721 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/DbTableView.xaml @@ -0,0 +1,41 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Controls.DbTableView" + 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" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280"> + <Grid> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid Background="#E9E9E9"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Foreground="{Binding ElementName=txtSearch, Path=BorderBrush}" Kind="AccountSearch" /> + <TextBox x:Name="txtSearch" Text="{Binding Filter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="Search" Width="200" FontSize="14" /> + </StackPanel> + + <StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal" Margin="0 0 10 0"> + <Button Style="{StaticResource MaterialDesignFloatingActionDarkButton}" ToolTip="Remove" Command="{Binding DeleteCommand}" Width="40" Height="40"> + <materialDesign:PackIcon Width="20" Height="20" Kind="Delete" /> + </Button> + <Button Style="{StaticResource MaterialDesignFloatingActionDarkButton}" ToolTip="Edit" Command="{Binding EditCommand}" Margin="10 0 0 0" Width="40" Height="40"> + <materialDesign:PackIcon Width="20" Height="20" Kind="Pencil" /> + </Button> + <Button Style="{StaticResource MaterialDesignFloatingActionDarkButton}" ToolTip="Add" Command="{Binding AddCommand}" Margin="10 0 0 0" Width="40" Height="40"> + <materialDesign:PackIcon Width="20" Height="20" Kind="Plus" /> + </Button> + </StackPanel> + </Grid> + + <Grid Grid.Row="1"> + <ContentControl Content="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=MainContent}" Margin="0 60 0 0"></ContentControl> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/DbTableView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/DbTableView.xaml.cs new file mode 100644 index 000000000..19bee9e70 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/DbTableView.xaml.cs @@ -0,0 +1,38 @@ +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.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Controls +{ + /// <summary> + /// Interaction logic for DbTableView.xaml + /// </summary> + [ContentProperty(nameof(MainContent))] + public partial class DbTableView : UserControl + { + public FrameworkElement MainContent + { + get { return (FrameworkElement)GetValue(MainContentProperty); } + set { SetValue(MainContentProperty, value); } + } + public static readonly DependencyProperty MainContentProperty = + DependencyProperty.Register("MainContent", typeof(FrameworkElement), typeof(DbTableView), new PropertyMetadata(null)); + + public DbTableView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/TableGrid.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/TableGrid.cs new file mode 100644 index 000000000..9b0d20362 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Controls/TableGrid.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.MachineStudio.UI.Controls +{ + public class TableGrid : Grid + { + public TableGrid() + { + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); + ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); + this.Loaded += TableGrid_Loaded; + } + + private void TableGrid_Loaded(object sender, RoutedEventArgs e) + { + InvalidateGrid(); + } + + protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) + { + base.OnVisualChildrenChanged(visualAdded, visualRemoved); + } + + protected override Size ArrangeOverride(Size arrangeSize) + { + return base.ArrangeOverride(arrangeSize); + } + + private void InvalidateGrid() + { + RowDefinitions.Clear(); + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); + + int currentRow = 0; + + for (int i = 0; i < Children.Count; i++) + { + SetRow(Children[i], currentRow); + + if (i % 2 != 0) + { + SetColumn(Children[i], 1); + (Children[i] as FrameworkElement).Margin = new Thickness(20, 0, 0, 0); + currentRow++; + RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); + } + + (Children[i] as FrameworkElement).VerticalAlignment = VerticalAlignment.Bottom; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Converters/UsersRolesToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Converters/UsersRolesToStringConverter.cs new file mode 100644 index 000000000..734bc7135 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Converters/UsersRolesToStringConverter.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.DAL.Observables; +using Tango.MachineStudio.UI.ViewModels.DBViewModels; + +namespace Tango.MachineStudio.UI.Converters +{ + public class UsersRolesToStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) return ""; + + if (value is IEnumerable<UsersRole>) + { + IEnumerable<UsersRole> userRoles = value as IEnumerable<UsersRole>; + return String.Join(", ", userRoles.Where(x => !x.Deleted).Select(x => x.Role.Name)); + } + else + { + IEnumerable<MultiComboVM<Role>> userRoles = value as IEnumerable<MultiComboVM<Role>>; + return String.Join(", ", userRoles.Where(x => x.IsSelected).Select(x => x.Entity.Name)); + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/CustomAttributes/DBViewAttribute.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/CustomAttributes/DBViewAttribute.cs new file mode 100644 index 000000000..39f34c4e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/CustomAttributes/DBViewAttribute.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.UI.CustomAttributes +{ + public class DBViewAttribute : Attribute + { + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/design.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/design.png Binary files differnew file mode 100644 index 000000000..5b1d473d8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/design.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machine-trans.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machine-trans.png Binary files differnew file mode 100644 index 000000000..a7cf65852 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/machine-trans.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml new file mode 100644 index 000000000..a425345dc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -0,0 +1,18 @@ +<mahapps:MetroWindow x:Class="Tango.MachineStudio.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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.MachineStudio.UI" + xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" + mc:Ignorable="d" + Title="Tango" Height="720" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized"> + <Grid> + <views:MainView></views:MainView> + + <Grid Background="Black" Opacity="0.7" x:Name="shadowGrid" Visibility="Hidden"> + + </Grid> + </Grid> +</mahapps:MetroWindow> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs new file mode 100644 index 000000000..3f7d4cad8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -0,0 +1,33 @@ +using MahApps.Metro.Controls; +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.MachineStudio.UI +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : MetroWindow + { + public static MainWindow Instance { get; set; } + + public MainWindow() + { + InitializeComponent(); + + Instance = this; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/DialogsManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/DialogsManager.cs new file mode 100644 index 000000000..4131f2a56 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/DialogsManager.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.DAL.Observables; +using Tango.MachineStudio.UI.ViewModels.DBViewModels; +using Tango.MachineStudio.UI.Views.DBViews; +using Tango.MachineStudio.UI.Windows; + +namespace Tango.MachineStudio.UI.Managers +{ + public static class DialogsManager + { + public static bool ShowDialog<T>(String title, object context) where T : FrameworkElement + { + DialogWindow dialog = new DialogWindow(Activator.CreateInstance<T>()); + dialog.DataContext = context; + dialog.InnerTitle = title; + dialog.Owner = Application.Current.MainWindow; + return dialog.ShowDialog().Value; + } + + public static bool ShowDialog<T>(DialogOpenMode mode, DbTableViewModel<T> context) where T : IObservableEntity + { + Type viewType = typeof(DialogsManager).Assembly.GetType(typeof(OrganizationView).Namespace + "." + typeof(T).Name + "View"); + DialogWindow dialog = new DialogWindow(Activator.CreateInstance(viewType) as FrameworkElement); + dialog.InnerTitle = (mode == DialogOpenMode.Editing ? "Edit " : "Add New ") + typeof(T).Name; + dialog.DataContext = context; + dialog.Owner = Application.Current.MainWindow; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + bool result = dialog.ShowDialog().Value; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + return result; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/RegisteredView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/RegisteredView.cs new file mode 100644 index 000000000..de66500b9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/RegisteredView.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.Core.Commands; + +namespace Tango.MachineStudio.UI.Managers +{ + public class RegisteredView + { + public String Header { get; set; } + public FrameworkElement View { get; set; } + public RelayCommand AddCommand { get; set; } + + public RegisteredView(String header, FrameworkElement view, Action action) + { + Header = header; + View = view; + + if (action != null) + { + AddCommand = new RelayCommand(action); + } + else + { + AddCommand = new RelayCommand(() => + { + if (!ViewsManager.DisplayedViews.Contains(this)) + { + ViewsManager.DisplayedViews.Add(this); + } + else + { + View.BringIntoView(); + View.Focus(); + } + }); + } + } + + public RegisteredView(String header, FrameworkElement view) : this(header, view, null) + { + Header = header; + View = view; + } + + public override string ToString() + { + return Header; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/ViewsManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/ViewsManager.cs new file mode 100644 index 000000000..caa1cb320 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Managers/ViewsManager.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.Core.Commands; +using Tango.MachineStudio.UI.CustomAttributes; +using Tango.MachineStudio.UI.Views.DBViews; + +namespace Tango.MachineStudio.UI.Managers +{ + public static class ViewsManager + { + public static ObservableCollection<RegisteredView> DisplayedViews { get; set; } + + public static ObservableCollection<RegisteredView> DbViews { get; set; } + + static ViewsManager() + { + DisplayedViews = new ObservableCollection<RegisteredView>(); + DbViews = new ObservableCollection<RegisteredView>(); + + foreach (var type in typeof(ViewsManager).Assembly.GetTypes().Where(x => x.CustomAttributes.Count() > 0 && x.CustomAttributes.First().AttributeType == typeof(DBViewAttribute))) + { + DbViews.Add(new RegisteredView(type.Name.Replace("View", ""), Activator.CreateInstance(type) as FrameworkElement)); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..5cdfd162a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] +[assembly: AssemblyTitle("Tango - Machine Studio")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs new file mode 100644 index 000000000..c035ee88d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <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.UI.Properties { + using System; + + + /// <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 (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.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/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.Designer.cs new file mode 100644 index 000000000..dfd4da16f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <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.UI.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.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.UI/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs new file mode 100644 index 000000000..70b57027e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.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.MachineStudio.UI.SupervisingController +{ + public interface IMainView : IView + { + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj new file mode 100644 index 000000000..67e00db8d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -0,0 +1,283 @@ +<?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>{116DFDB0-7681-46FE-8BAD-FE8AE09BB076}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>Tango.MachineStudio.UI</RootNamespace> + <AssemblyName>Tango.MachineStudio.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\</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>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup> + <ApplicationIcon>design.ico</ApplicationIcon> + </PropertyGroup> + <ItemGroup> + <Reference Include="Dragablz, Version=0.0.3.197, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Dragablz.0.0.3.197\lib\net45\Dragablz.dll</HintPath> + </Reference> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.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.2.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="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="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.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.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\MvvmLightLibs.5.3.0.0\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="Controls\DbTableView.xaml.cs"> + <DependentUpon>DbTableView.xaml</DependentUpon> + </Compile> + <Compile Include="Controls\TableGrid.cs" /> + <Compile Include="Converters\UsersRolesToStringConverter.cs" /> + <Compile Include="CustomAttributes\DBViewAttribute.cs" /> + <Compile Include="ViewModels\DBViewModels\DbTableViewModel.cs" /> + <Compile Include="ViewModels\DBViewModels\DialogOpenMode.cs" /> + <Compile Include="ViewModels\DBViewModels\MultiComboVM.cs" /> + <Compile Include="ViewModels\DBViewModels\UsersViewVM.cs" /> + <Compile Include="ViewModels\EntityViewModel.cs" /> + <Compile Include="Managers\DialogsManager.cs" /> + <Compile Include="Managers\RegisteredView.cs" /> + <Compile Include="Managers\ViewsManager.cs" /> + <Compile Include="SupervisingController\IMainView.cs" /> + <Compile Include="ViewModels\DBViewModels\AddressesViewVM.cs" /> + <Compile Include="ViewModels\DBViewModels\MachinesViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\DBViewModels\OrganizationsViewVM.cs" /> + <Compile Include="Views\DBViews\AddressesView.xaml.cs"> + <DependentUpon>AddressesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\AddressView.xaml.cs"> + <DependentUpon>AddressView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MachinesView.xaml.cs"> + <DependentUpon>MachinesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MachineView.xaml.cs"> + <DependentUpon>MachineView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\OrganizationView.xaml.cs"> + <DependentUpon>OrganizationView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\UsersView.xaml.cs"> + <DependentUpon>UsersView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\UserView.xaml.cs"> + <DependentUpon>UserView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\OrganizationsView.xaml.cs"> + <DependentUpon>OrganizationsView.xaml</DependentUpon> + </Compile> + <Compile Include="Windows\DialogWindow.xaml.cs"> + <DependentUpon>DialogWindow.xaml</DependentUpon> + </Compile> + <Page Include="Controls\DbTableView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <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="Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\AddressesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\AddressView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\DBViews\MachinesView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\DBViews\MachineView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\DBViews\OrganizationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\DBViews\UsersView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\DBViews\UserView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\DBViews\OrganizationsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Windows\DialogWindow.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType> + </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> + <Resource Include="design.ico" /> + </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.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</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> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\design.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine-trans.png" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Dialogs\" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PostBuildEvent>$(TargetDir)linkgen.exe -s "$(TargetPath)" -d "$(TargetDir)Utilities\Machine Studio.lnk"</PostBuildEvent> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Themes/Generic.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Themes/Generic.xaml new file mode 100644 index 000000000..e3efa0c6a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Themes/Generic.xaml @@ -0,0 +1,9 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.MachineStudio.UI" + xmlns:controls="clr-namespace:Tango.MachineStudio.UI.Controls"> + +</ResourceDictionary> + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs new file mode 100644 index 000000000..2d3492ba0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -0,0 +1,91 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using System; +using Tango.Logging; +using Tango.MachineStudio.UI.SupervisingController; +using Tango.MachineStudio.UI.ViewModels; +using Tango.MachineStudio.UI.ViewModels.DBViewModels; +using Tango.MachineStudio.UI.Views; + +namespace Tango.MachineStudio.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 class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + public ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + ////if (ViewModelBase.IsInDesignModeStatic) + ////{ + //// // Create design time view services and models + //// SimpleIoc.Default.Register<IDataService, DesignDataService>(); + ////} + ////else + ////{ + //// // Create run time view services and models + //// SimpleIoc.Default.Register<IDataService, DataService>(); + ////} + + SimpleIoc.Default.Register<MainViewVM>(); + SimpleIoc.Default.Register<MachinesViewVM>(); + SimpleIoc.Default.Register<OrganizationsViewVM>(); + SimpleIoc.Default.Register<AddressesViewVM>(); + SimpleIoc.Default.Register<UsersViewVM>(); + + //Register View (Supervising Controller Pattern). + if (!ViewModelBase.IsInDesignModeStatic) + { + LogManager.Log(String.Format("Registering Supervising Controller {0}...", nameof(IMainView))); + SimpleIoc.Default.Register(() => (IMainView)MainView.Self); + } + } + + public MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MainViewVM>(); + } + } + + public MachinesViewVM MachinesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MachinesViewVM>(); + } + } + + public OrganizationsViewVM OrganizationsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<OrganizationsViewVM>(); + } + } + + public AddressesViewVM AddressesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<AddressesViewVM>(); + } + } + + public UsersViewVM UsersViewVM + { + get + { + return ServiceLocator.Current.GetInstance<UsersViewVM>(); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/AddressesViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/AddressesViewVM.cs new file mode 100644 index 000000000..009de0139 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/AddressesViewVM.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; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public class AddressesViewVM : DbTableViewModel<Address> + { + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/DbTableViewModel.cs new file mode 100644 index 000000000..2e3a6a6e1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/DbTableViewModel.cs @@ -0,0 +1,214 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.DAL.Observables; +using Tango.MachineStudio.UI.Managers; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public abstract class DbTableViewModel<T> : ViewModel where T : IObservableEntity + { + private T _editEntity; + /// <summary> + /// Gets or sets the edit entity. + /// </summary> + public T EditEntity + { + get { return _editEntity; } + set { _editEntity = value; RaisePropertyChangedAuto(); } + } + + private DialogOpenMode _dialogOpenMode; + /// <summary> + /// Gets or sets the dialog open mode. + /// </summary> + public DialogOpenMode DialogOpenMode + { + get { return _dialogOpenMode; } + set { _dialogOpenMode = value; RaisePropertyChangedAuto(); } + } + + private bool _isDialogOpen; + /// <summary> + /// Gets or sets a value indicating whether this instance is dialog open. + /// </summary> + public bool IsDialogOpen + { + get { return _isDialogOpen; } + set { _isDialogOpen = value; RaisePropertyChangedAuto(); } + } + + private ObservablesEntitiesAdapter _adapter; + /// <summary> + /// Gets or sets the DB adapter. + /// </summary> + public ObservablesEntitiesAdapter Adapter + { + get { return _adapter; } + set { _adapter = value; RaisePropertyChangedAuto(); } + } + + private T _selectedEntity; + /// <summary> + /// Gets or sets the selected entity. + /// </summary> + public T SelectedEntity + { + get { return _selectedEntity; } + set { _selectedEntity = value; RaisePropertyChangedAuto(); } + } + + private String _filter; + /// <summary> + /// Gets or sets the search filter. + /// </summary> + public String Filter + { + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(value); } + } + + /// <summary> + /// Gets or sets the dialog OK command. + /// </summary> + public RelayCommand DialogOKCommand { get; set; } + + /// <summary> + /// Gets or sets the dialog cancel command. + /// </summary> + public RelayCommand DialogCancelCommand { get; set; } + + /// <summary> + /// Gets or sets the add command. + /// </summary> + public RelayCommand AddCommand { get; set; } + + /// <summary> + /// Gets or sets the edit command. + /// </summary> + public RelayCommand EditCommand { get; set; } + + /// <summary> + /// Gets or sets the delete command. + /// </summary> + public RelayCommand DeleteCommand { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="DbTableViewModel"/> class. + /// </summary> + public DbTableViewModel() : base() + { + Adapter = App.DbAdapter; + + AddCommand = new RelayCommand(OnAdd); + EditCommand = new RelayCommand(OnEdit); + DeleteCommand = new RelayCommand(OnDelete); + DialogOKCommand = new RelayCommand(() => OnDialogOKPressed(DialogOpenMode, EditEntity)); + DialogCancelCommand = new RelayCommand(() => OnDialogCancelPressed(DialogOpenMode, EditEntity)); + + IsDialogOpen = false; + } + + /// <summary> + /// Called when delete command invoked. + /// </summary> + protected virtual void OnDelete() + { + SelectedEntity.Deleted = true; + SelectedEntity.Save(); + } + + /// <summary> + /// Called when edit command invoked. + /// </summary> + protected virtual void OnEdit() + { + DialogOpenMode = DialogOpenMode.Editing; + EditEntity = GetEditableEntity(DialogOpenMode); + DialogsManager.ShowDialog(DialogOpenMode, this); + IsDialogOpen = true; + } + + /// <summary> + /// Called when add command invoked. + /// </summary> + protected virtual void OnAdd() + { + DialogOpenMode = DialogOpenMode.Adding; + EditEntity = GetEditableEntity(DialogOpenMode); + DialogsManager.ShowDialog(DialogOpenMode, this); + IsDialogOpen = true; + } + + /// <summary> + /// Called when dialog closes with OK button. + /// </summary> + /// <param name="mode">The mode.</param> + protected virtual void OnDialogOKPressed(DialogOpenMode mode, T entity) + { + if (mode == DialogOpenMode.Editing) + { + entity.ShallowCopyTo(SelectedEntity); + entity = SelectedEntity; + } + + OnBeforeEntitySave(mode, entity); + + entity.Save(); + IsDialogOpen = false; + SelectedEntity = EditEntity; + } + + /// <summary> + /// Called when [before entity save]. + /// </summary> + /// <param name="mode">The mode.</param> + /// <param name="entity">The entity.</param> + protected virtual void OnBeforeEntitySave(DialogOpenMode mode,T entity) + { + + } + + /// <summary> + /// Called when dialog closes with cancel button. + /// </summary> + /// <param name="mode">The mode.</param> + protected virtual void OnDialogCancelPressed(DialogOpenMode mode, T entity) + { + IsDialogOpen = false; + } + + /// <summary> + /// Gets the editable entity. + /// </summary> + /// <param name="mode">The mode.</param> + /// <returns></returns> + private T GetEditableEntity(DialogOpenMode mode) + { + if (mode == DialogOpenMode.Adding) + { + var newEntity = Activator.CreateInstance<T>(); + InitializeEntity(newEntity); + return newEntity; + } + else + { + return SelectedEntity.ShallowClone(); + } + } + + protected virtual void OnFilterChanged(String filter) + { + + } + + protected virtual void InitializeEntity(T entity) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/DialogOpenMode.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/DialogOpenMode.cs new file mode 100644 index 000000000..9c6dbe807 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/DialogOpenMode.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public enum DialogOpenMode + { + Editing, + Adding, + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/MachinesViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/MachinesViewVM.cs new file mode 100644 index 000000000..c008f1124 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/MachinesViewVM.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.DAL.Observables; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public class MachinesViewVM : DbTableViewModel<Machine> + { + protected override void InitializeEntity(Machine entity) + { + base.InitializeEntity(entity); + entity.ProductionDate = DateTime.Now; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/MultiComboVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/MultiComboVM.cs new file mode 100644 index 000000000..280eab923 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/MultiComboVM.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public class MultiComboVM<T> : EntityViewModel<T> + { + private Action _onSelectionChanged; + + public event EventHandler SelectionChanged; + + public MultiComboVM(T entity) : base(entity) + { + + } + + public MultiComboVM(T entity, Action onSelectionChanged) : this(entity) + { + _onSelectionChanged = onSelectionChanged; + } + + private bool _isSelected; + + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; RaisePropertyChangedAuto(); OnSelectionChanged(); } + } + + protected virtual void OnSelectionChanged() + { + if (_onSelectionChanged != null) + { + _onSelectionChanged(); + } + + SelectionChanged?.Invoke(this, new EventArgs()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/OrganizationsViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/OrganizationsViewVM.cs new file mode 100644 index 000000000..6a2fd73df --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/OrganizationsViewVM.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public class OrganizationsViewVM : DbTableViewModel<Organization> + { + public OrganizationsViewVM() : base() + { + + } + + protected override void OnFilterChanged(string filter) + { + Adapter.OrganizationsViewSource.Filter = (x) => + { + var org = x as Organization; + return org.Name.Contains(filter); + }; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/UsersViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/UsersViewVM.cs new file mode 100644 index 000000000..2bf34ce7a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/DBViewModels/UsersViewVM.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.UI.ViewModels.DBViewModels +{ + public class UsersViewVM : DbTableViewModel<User> + { + private ObservableCollection<MultiComboVM<Role>> _selectedRoles; + public ObservableCollection<MultiComboVM<Role>> SelectedRoles + { + get { return _selectedRoles; } + set { _selectedRoles = value; RaisePropertyChangedAuto(); } + } + + public UsersViewVM() : base() + { + SelectedRoles = new ObservableCollection<MultiComboVM<Role>>(); + } + + protected override void OnEdit() + { + SelectedRoles = Adapter.Roles.Select(x => new MultiComboVM<Role>(x, () => RaisePropertyChanged(nameof(SelectedRoles)))).ToObservableCollection(); + + foreach (var role in SelectedRoles) + { + if (SelectedEntity.UsersRoles.ToList().Exists(x => x.Role == role.Entity && !x.Deleted)) + { + role.IsSelected = true; + } + } + + base.OnEdit(); + } + + protected override void OnAdd() + { + SelectedRoles = Adapter.Roles.Select(x => new MultiComboVM<Role>(x, () => RaisePropertyChanged(nameof(SelectedRoles)))).ToObservableCollection(); + + base.OnAdd(); + } + + protected override void OnBeforeEntitySave(DialogOpenMode mode, User user) + { + base.OnBeforeEntitySave(mode, user); + + foreach (var role in SelectedRoles) + { + var userRole = user.UsersRoles.SingleOrDefault(x => x.Role == role.Entity); + + if (userRole != null) + { + userRole.Deleted = !role.IsSelected; + } + else + { + if (role.IsSelected) + { + user.UsersRoles.Add(new UsersRole() + { + Role = role.Entity, + User = user, + RoleGuid = role.Entity.Guid, + UserGuid = user.Guid + }); + } + } + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/EntityViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/EntityViewModel.cs new file mode 100644 index 000000000..fff03a1db --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/EntityViewModel.cs @@ -0,0 +1,31 @@ +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.MachineStudio.UI.ViewModels +{ + public class EntityViewModel<T> : ViewModel + { + private T _entity; + + public T Entity + { + get { return _entity; } + set { _entity = value; RaisePropertyChanged(nameof(Entity)); } + } + + public EntityViewModel() : base() + { + + } + + public EntityViewModel(T entity) : this() + { + Entity = entity; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..00571007c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.UI.SupervisingController; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class MainViewVM : ViewModel<IMainView> + { + public String Text { get; set; } + + public MainViewVM(IMainView view) : base(view) + { + Text = "Hi ROy"; + } + + protected override void OnViewAttached() + { + base.OnViewAttached(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressView.xaml new file mode 100644 index 000000000..8e1bde374 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressView.xaml @@ -0,0 +1,34 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.AddressView" + 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.MachineStudio.UI.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Address:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.AddressString,Mode=TwoWay}"></TextBox> + <TextBlock Text="Locality:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Locality,Mode=TwoWay}"></TextBox> + <TextBlock Text="Country:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Country,Mode=TwoWay}"></TextBox> + <TextBlock Text="City:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.City,Mode=TwoWay}"></TextBox> + <TextBlock Text="State:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.State,Mode=TwoWay}"></TextBox> + <TextBlock Text="Country Code:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.CountryCode,Mode=TwoWay}"></TextBox> + <TextBlock Text="Postal Code:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.PostalCode,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressView.xaml.cs new file mode 100644 index 000000000..9c82b9d82 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressView.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.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for AddressView.xaml + /// </summary> + public partial class AddressView : UserControl + { + public AddressView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressesView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressesView.xaml new file mode 100644 index 000000000..d8de4b15b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressesView.xaml @@ -0,0 +1,27 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.AddressesView" + 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.MachineStudio.UI.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{Binding AddressesViewVM, Source={StaticResource Locator}}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Addresses}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Address" Binding="{Binding AddressString}"></DataGridTextColumn> + <DataGridTextColumn Header="Locality" Binding="{Binding Locality}"></DataGridTextColumn> + <DataGridTextColumn Header="Country" Binding="{Binding Country}"></DataGridTextColumn> + <DataGridTextColumn Header="City" Binding="{Binding City}"></DataGridTextColumn> + <DataGridTextColumn Header="State" Binding="{Binding State}"></DataGridTextColumn> + <DataGridTextColumn Header="Country Code" Binding="{Binding CountryCode}"></DataGridTextColumn> + <DataGridTextColumn Header="Postal Code" Binding="{Binding PostalCode}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressesView.xaml.cs new file mode 100644 index 000000000..793b18c82 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/AddressesView.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; +using Tango.MachineStudio.UI.CustomAttributes; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class AddressesView : UserControl + { + public AddressesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachineView.xaml new file mode 100644 index 000000000..042676b3c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachineView.xaml @@ -0,0 +1,28 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.MachineView" + 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.MachineStudio.UI.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Serial Number:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.SerialNumber,Mode=TwoWay}"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Organization:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Organizations}" SelectedItem="{Binding EditEntity.Organization,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.MachineVersions}" SelectedItem="{Binding EditEntity.MachineVersions,Mode=TwoWay}" DisplayMemberPath="Version"></ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachineView.xaml.cs new file mode 100644 index 000000000..422268226 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachineView.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.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MachineView : UserControl + { + public MachineView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachinesView.xaml new file mode 100644 index 000000000..2c69d914f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachinesView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.MachinesView" + 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.MachineStudio.UI.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{Binding MachinesViewVM, Source={StaticResource Locator}}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Machines}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Serial Number" Binding="{Binding SerialNumber}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding MachineVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Organization" Binding="{Binding Organization.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Configuration" Binding="{Binding MachinesConfigurations[0].Configuration.Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachinesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachinesView.xaml.cs new file mode 100644 index 000000000..a6a6f2b47 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/MachinesView.xaml.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.UI.CustomAttributes; +using Tango.MachineStudio.UI.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class MachinesView : UserControl + { + public MachinesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationView.xaml new file mode 100644 index 000000000..31be9356e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationView.xaml @@ -0,0 +1,26 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.OrganizationView" + 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.MachineStudio.UI.Views.DBViews" + xmlns:controls="clr-namespace:Tango.MachineStudio.UI.Controls" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Address:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Addresses}" SelectedItem="{Binding EditEntity.Address}" DisplayMemberPath="AddressString"></ComboBox> + <TextBlock Text="Contact:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Contacts}" SelectedItem="{Binding EditEntity.Contact}" DisplayMemberPath="FullName"></ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationView.xaml.cs new file mode 100644 index 000000000..8c17d51a7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationView.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.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for OrganizationView.xaml + /// </summary> + public partial class OrganizationView : UserControl + { + public OrganizationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationsView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationsView.xaml new file mode 100644 index 000000000..ef446f01c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationsView.xaml @@ -0,0 +1,26 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.OrganizationsView" + 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.MachineStudio.UI.Controls" + xmlns:system="clr-namespace:System;assembly=mscorlib" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{Binding OrganizationsViewVM, Source={StaticResource Locator}}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.OrganizationsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Address" Binding="{Binding Address.AddressString}"></DataGridTextColumn> + <DataGridTextColumn Header="Contact" Binding="{Binding Contact.FullName}"></DataGridTextColumn> + <DataGridTextColumn Header="Machines" Binding="{Binding Machines.Count}"></DataGridTextColumn> + <DataGridTextColumn Header="Users" Binding="{Binding Users.Count}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationsView.xaml.cs new file mode 100644 index 000000000..2e955de0c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/OrganizationsView.xaml.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.UI.CustomAttributes; + +namespace Tango.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for OrganizationsView.xaml + /// </summary> + [DBView] + public partial class OrganizationsView : UserControl + { + public OrganizationsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UserView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UserView.xaml new file mode 100644 index 000000000..62802c5d9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UserView.xaml @@ -0,0 +1,43 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.UserView" + 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:controls="clr-namespace:Tango.MachineStudio.UI.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True" IsEnabled="False"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True" IsEnabled="False"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True" IsEnabled="False"></TextBox> + <TextBlock Text="Email:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Email,Mode=TwoWay}"></TextBox> + <TextBlock Text="Password:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Password,Mode=TwoWay}"></TextBox> + <TextBlock Text="Roles:" FontWeight="Bold"></TextBlock> + <ComboBox x:Name="comboRoles" SelectionChanged="comboRoles_SelectionChanged" ItemsSource="{Binding SelectedRoles}" materialDesign:HintAssist.Hint="{Binding SelectedRoles,Converter={StaticResource UsersRolesToStringConverter},UpdateSourceTrigger=PropertyChanged}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <CheckBox IsChecked="{Binding IsSelected}" Width="20"/> + <TextBlock Text="{Binding Entity.Name}" Width="100" /> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + <TextBlock Text="Organization:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Organizations}" SelectedItem="{Binding EditEntity.Organization,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <TextBlock Text="Address:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Addresses}" SelectedItem="{Binding EditEntity.Address}" DisplayMemberPath="AddressString"></ComboBox> + <TextBlock Text="Contact:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Contacts}" SelectedItem="{Binding EditEntity.Contact}" DisplayMemberPath="FullName"></ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UserView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UserView.xaml.cs new file mode 100644 index 000000000..987c93b75 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UserView.xaml.cs @@ -0,0 +1,34 @@ +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.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for UserView.xaml + /// </summary> + public partial class UserView : UserControl + { + public UserView() + { + InitializeComponent(); + } + + private void comboRoles_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + comboRoles.SelectedItem = null; + comboRoles.Text = "Press to select"; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UsersView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UsersView.xaml new file mode 100644 index 000000000..9225661a0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UsersView.xaml @@ -0,0 +1,27 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.DBViews.UsersView" + 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:controls="clr-namespace:Tango.MachineStudio.UI.Controls" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{Binding UsersViewVM, Source={StaticResource Locator}}"> + + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Users}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Contact.FullName}"></DataGridTextColumn> + <DataGridTextColumn Header="Email" Binding="{Binding Email}"></DataGridTextColumn> + <DataGridTextColumn Header="Password" Binding="{Binding Password}"></DataGridTextColumn> + <DataGridTextColumn Header="Organization" Binding="{Binding Organization.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Roles" Binding="{Binding UsersRoles,Converter={StaticResource UsersRolesToStringConverter}}"></DataGridTextColumn> + <DataGridTextColumn Header="Address" Binding="{Binding Address.AddressString}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UsersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UsersView.xaml.cs new file mode 100644 index 000000000..bc60c65cf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/DBViews/UsersView.xaml.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.UI.CustomAttributes; + +namespace Tango.MachineStudio.UI.Views.DBViews +{ + /// <summary> + /// Interaction logic for UsersView.xaml + /// </summary> + [DBView] + public partial class UsersView : UserControl + { + public UsersView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml new file mode 100644 index 000000000..fbe45d36d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -0,0 +1,112 @@ +<controls:View x:Class="Tango.MachineStudio.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:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz" + xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:managers="clr-namespace:Tango.MachineStudio.UI.Managers" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1270" Background="White" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> + <Grid> + <materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}"> + <materialDesign:DrawerHost.LeftDrawerContent> + <DockPanel MinWidth="212"> + <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" + DockPanel.Dock="Top" + HorizontalAlignment="Right" Margin="16" + IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" /> + <ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0"> + <ListBoxItem>Item 1</ListBoxItem> + <ListBoxItem>Item 2</ListBoxItem> + <ListBoxItem>Item 3</ListBoxItem> + <ListBoxItem>Item 4</ListBoxItem> + <ListBoxItem>Item 5</ListBoxItem> + </ListBox> + </DockPanel> + </materialDesign:DrawerHost.LeftDrawerContent> + <DockPanel> + <materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" + Mode="PrimaryMid" DockPanel.Dock="Top"> + <DockPanel> + <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" IsChecked="False" + x:Name="MenuToggleButton"/> + <materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False"> + <StackPanel> + <Button Content="Hello World"/> + <Button Content="Nice Popup"/> + <Button Content="Can't Touch This" IsEnabled="False" /> + <Separator/> + <Button Content="Goodbye"/> + </StackPanel> + </materialDesign:PopupBox> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> + </StackPanel> + </DockPanel> + </materialDesign:ColorZone> + + <Grid> + <Grid> + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid> + <Menu IsMainMenu="True"> + <MenuItem Header="DataBase" ItemsSource="{x:Static managers:ViewsManager.DbViews}" DisplayMemberPath="Header"> + <MenuItem.ItemContainerStyle> + <Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}"> + <Setter Property="Command" Value="{Binding AddCommand}"></Setter> + </Style> + </MenuItem.ItemContainerStyle> + </MenuItem> + <MenuItem Header="Edit"></MenuItem> + </Menu> + </Grid> + + <dockablz:Layout Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible" FloatingItemsSource="{x:Static managers:ViewsManager.DisplayedViews}" FloatingItemDisplayMemberPath="View" FloatingItemHeaderMemberPath="Header"> + + </dockablz:Layout> + + <!--<dragablz:TabablzControl BorderThickness="0" FontSize="14" ItemContainerStyle="{DynamicResource TabItemStyle}"> + <dragablz:TabablzControl.Resources> + <Style x:Key="TabItemStyle" TargetType="{x:Type dragablz:DragablzItem}" BasedOn="{StaticResource MaterialDesignDragableTabItemStyle}"> + <Setter Property="Height" Value="60" /> + <Setter Property="Padding" Value="24,0,24,0" /> + </Style> + </dragablz:TabablzControl.Resources> + <dragablz:TabablzControl.InterTabController> + <dragablz:InterTabController /> + </dragablz:TabablzControl.InterTabController> + <TabItem Header="ORGANIZATIONS"> + <local:OrganizationsView></local:OrganizationsView> + </TabItem> + <TabItem Header="MACHINES"> + <local:MachinesView></local:MachinesView> + </TabItem> + <TabItem Header="ADDRESSES"> + <local:AddressesView></local:AddressesView> + </TabItem> + <TabItem Header="DISPENSERS"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Looks Quite Nice</TextBlock> + </TabItem> + <TabItem Header="MEDIA LIST"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Looks Quite Nice</TextBlock> + </TabItem> + </dragablz:TabablzControl>--> + </Grid> + </Grid> + </Grid> + </Grid> + </DockPanel> + </materialDesign:DrawerHost> + </Grid> +</controls:View> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs new file mode 100644 index 000000000..520b69741 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.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; +using Tango.MachineStudio.UI.SupervisingController; +using Tango.SharedUI; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.UI.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : View, IMainView + { + public MainView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/DialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/DialogWindow.xaml new file mode 100644 index 000000000..f23776ec2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/DialogWindow.xaml @@ -0,0 +1,32 @@ +<mahapps:MetroWindow x:Class="Tango.MachineStudio.UI.Windows.DialogWindow" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows" + mc:Ignorable="d" + Title="Machine Studio" Height="450" Width="650" EnableDWMDropShadow="True" ShowCloseButton="False" WindowTransitionsEnabled="False" ShowMaxRestoreButton="False" ShowMinButton="False" TitleCaps="False" BorderThickness="1" WindowStartupLocation="CenterOwner"> + <Grid> + <Border Margin="16"> + <DockPanel LastChildFill="True"> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top"> + <materialDesign:PackIcon Kind="TableEdit" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> + <TextBlock Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerTitle}"></TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding DialogOKCommand}" Click="OnOKClicked"> + ACCEPT + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{Binding DialogCancelCommand}" Click="OnCancelClicked"> + CANCEL + </Button> + </StackPanel> + <ScrollViewer Margin="0 10 0 10" VerticalScrollBarVisibility="Auto" Padding="5"> + <ContentPresenter x:Name="presenter"></ContentPresenter> + </ScrollViewer> + </DockPanel> + </Border> + </Grid> +</mahapps:MetroWindow> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/DialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/DialogWindow.xaml.cs new file mode 100644 index 000000000..c946d2b88 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/DialogWindow.xaml.cs @@ -0,0 +1,58 @@ +using MahApps.Metro.Controls; +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.Shapes; +using Tango.Core.Commands; + +namespace Tango.MachineStudio.UI.Windows +{ + /// <summary> + /// Interaction logic for DialogWindow.xaml + /// </summary> + public partial class DialogWindow : MetroWindow + { + public DialogWindow() + { + InitializeComponent(); + } + + + + public String InnerTitle + { + get { return (String)GetValue(InnerTitleProperty); } + set { SetValue(InnerTitleProperty, value); } + } + public static readonly DependencyProperty InnerTitleProperty = + DependencyProperty.Register("InnerTitle", typeof(String), typeof(DialogWindow), new PropertyMetadata(null)); + + + + public DialogWindow(FrameworkElement content) : this() + { + presenter.Content = content; + } + + private void OnOKClicked(object sender, RoutedEventArgs e) + { + DialogResult = true; + Close(); + } + + private void OnCancelClicked(object sender, RoutedEventArgs e) + { + DialogResult = false; + Close(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/design.ico b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/design.ico Binary files differnew file mode 100644 index 000000000..27b9939df --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/design.ico diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config new file mode 100644 index 000000000..05f5d8725 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="Dragablz" version="0.0.3.197" targetFramework="net46" /> + <package id="EntityFramework" version="6.2.0" targetFramework="net46" /> + <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> + <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> + <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> + <package id="MvvmLight" version="5.3.0.0" targetFramework="net46" /> + <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> +</packages>
\ No newline at end of file |
