aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-12-13 15:19:55 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-12-13 15:19:55 +0200
commit2a51f05523c1397b77eca5e5188520919205638c (patch)
treeedc40c2ca201be6e881ea6746469fb5cb412e8bc /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls
parent2c376ac3ae651dd6c6592cc4cbf72768dc97a93d (diff)
downloadTango-2a51f05523c1397b77eca5e5188520919205638c.tar.gz
Tango-2a51f05523c1397b77eca5e5188520919205638c.zip
Successfully separated Machine Studio to modules...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml41
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs38
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/TableGrid.cs58
3 files changed, 137 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml
new file mode 100644
index 000000000..d1c62ed7e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml
@@ -0,0 +1,41 @@
+<UserControl x:Class="Tango.MachineStudio.DB.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/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs
new file mode 100644
index 000000000..9ae14952b
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/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.DB.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/Modules/Tango.MachineStudio.DB/Controls/TableGrid.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/TableGrid.cs
new file mode 100644
index 000000000..53a990d4d
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/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.DB.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;
+ }
+ }
+ }
+}