diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-21 15:56:57 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-21 15:56:57 +0200 |
| commit | 3234e33cc4ba354f0395bb514b8b2fa102cf38ec (patch) | |
| tree | 064121c6d1b2d7ea428e705d8457f86ca95e4a4b /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common | |
| parent | 68dca419117f9336d0fe21f9f04903906eeeef02 (diff) | |
| download | Tango-3234e33cc4ba354f0395bb514b8b2fa102cf38ec.tar.gz Tango-3234e33cc4ba354f0395bb514b8b2fa102cf38ec.zip | |
Started working on Developer module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
4 files changed, 90 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/TableGrid.cs new file mode 100644 index 000000000..07fd0c446 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/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.Common.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.Common/StudioApplication/IModuleRequestListener.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs new file mode 100644 index 000000000..b950d7bcd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IModuleRequestListener.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + /// <summary> + /// Represents a type which will be notified when a new module request was made by <see cref="IStudioApplicationManager.RequestModule(string, object)"/> + /// </summary> + public interface IModuleRequestListener + { + /// <summary> + /// Called when the request has been made. + /// </summary> + /// <param name="module">The module instance.</param> + /// <param name="args">The arguments.</param> + void OnRequestModule(IStudioModule module, Object args); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index a88a045a6..c67c34044 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -20,7 +20,7 @@ namespace Tango.MachineStudio.Common.StudioApplication /// <summary> /// Gets a value indicating whether Machine Studio is shutting down. /// </summary> - bool IsShuttingDown { get;} + bool IsShuttingDown { get; } /// <summary> /// Shutdown the application. @@ -40,6 +40,13 @@ namespace Tango.MachineStudio.Common.StudioApplication /// <summary> /// Gets a value indicating whether the <see cref="ConnectedMachine"/> is valid and connected through TCP/IP. /// </summary> - bool IsMachineConnectedViaTCP { get; } + bool IsMachineConnectedViaTCP { get; } + + /// <summary> + /// Loads the specified module if permitted. + /// </summary> + /// <param name="moduleName">Name of the module.</param> + /// <param name="args">The arguments.</param> + void RequestModule(String moduleName, Object args); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 42eae3c1e..e16703cfa 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -71,7 +71,9 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="Controls\TableGrid.cs" /> <Compile Include="Notifications\DialogViewVM.cs" /> + <Compile Include="StudioApplication\IModuleRequestListener.cs" /> <Compile Include="StudioApplication\IStudioApplicationManager.cs" /> <Compile Include="StudioApplication\IShutdownRequestBlocker.cs" /> <Compile Include="ExtensionMethods\IStudioMessageExtensions.cs" /> |
