diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-16 12:17:10 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-16 12:17:10 +0200 |
| commit | 0fda2ba3ff49bdc1ffc6833f658e2164af187008 (patch) | |
| tree | 6f3a24d0671ebda50debb8511ab40e0bda0a0df0 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | 28103646681686bf1b58275d5dbccb92d2b26f9f (diff) | |
| download | Tango-0fda2ba3ff49bdc1ffc6833f658e2164af187008.tar.gz Tango-0fda2ba3ff49bdc1ffc6833f658e2164af187008.zip | |
Embedded RealTimeGraphEx library to solution.
Added graphs to technician view.
Implemented simple sensors data test using Machine Emulator.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
10 files changed, 123 insertions, 91 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml index 8e5876e79..fe50851a0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml @@ -11,7 +11,10 @@ <!-- Accent and AppTheme setting --> <ResourceDictionary Source="pack://application:,,,/Tango.MachineStudio.Common;component/Resources/MaterialDesign.xaml"></ResourceDictionary> - <!-- Include the Dragablz Material Design style --> + <!--RealTimeGraphEx--> + <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary> + + <!-- Include the Dragablz Material Design style --> <ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/materialdesign.xaml"/> <ResourceDictionary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 5944af2d1..0e1bd829b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -25,6 +25,7 @@ namespace Tango.MachineStudio.UI.Modules { private IAuthenticationProvider _authenticationProvider; private bool _loaded; + public event EventHandler ModulesLoaded; /// <summary> /// Initializes a new instance of the <see cref="DefaultStudioModuleLoader"/> class. @@ -115,6 +116,8 @@ namespace Tango.MachineStudio.UI.Modules { UserModules = AllModules.Where(x => _authenticationProvider.CurrentUser.HasPermission(x.Permission)).ToObservableCollection(); } + + ModulesLoaded?.Invoke(this, new EventArgs()); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 2fa8c7562..56abbd702 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.UI.Navigation diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 68af7bdc3..06b4dca7c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -49,6 +49,11 @@ namespace Tango.MachineStudio.UI.StudioApplication private IExternalBridgeClient _connectedMachine; /// <summary> + /// Occurs when the connected machine property has changed. + /// </summary> + public event EventHandler<IExternalBridgeClient> ConnectedMachineChanged; + + /// <summary> /// Gets or sets the currently connected machine if any. /// </summary> public IExternalBridgeClient ConnectedMachine @@ -66,6 +71,8 @@ namespace Tango.MachineStudio.UI.StudioApplication _connectedMachine.StateChanged -= ConnectedMachine_StateChanged; _connectedMachine.StateChanged += ConnectedMachine_StateChanged; } + + ConnectedMachineChanged?.Invoke(this, _connectedMachine); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs index 3de061de8..fd8ef4be5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/SupervisingController/IMainView.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.MachineStudio.Common; using Tango.SharedUI; namespace Tango.MachineStudio.UI.SupervisingController @@ -13,6 +14,10 @@ namespace Tango.MachineStudio.UI.SupervisingController /// <seealso cref="Tango.SharedUI.IView" /> public interface IMainView : IView { - + /// <summary> + /// Navigates to the specified studio module. + /// </summary> + /// <param name="module">The module.</param> + void NavigateToModule(IStudioModule module); } } 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 index b752ca4b7..9b498cfb6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -241,6 +241,10 @@ <Resource Include="design.ico" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> + <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> + <Name>RealTimeGraphEx</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 5f315f7f4..7ceab8268 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -67,7 +67,7 @@ namespace Tango.MachineStudio.UI if (!ViewModelBase.IsInDesignModeStatic) { - LogManager.RegisterLogger(new VSOutputLogger()); + //LogManager.RegisterLogger(new VSOutputLogger()); LogManager.RegisterLogger(new FileLogger()); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index fcbdc90a3..fdab1a93c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -1,4 +1,5 @@ -using System; +using GalaSoft.MvvmLight.Ioc; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; @@ -275,14 +276,22 @@ namespace Tango.MachineStudio.UI.ViewModels { IsMenuOpened = false; + foreach (var m in StudioModuleLoader.AllModules.Where(x => x != module)) + { + m.IsLoaded = false; + } + if (module != null) { CurrentModule = module; + CurrentModule.IsLoaded = true; IsModuleLoaded = true; + View.NavigateToModule(module); } else { IsModuleLoaded = false; + View.NavigateToModule(null); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 616187288..99654f602 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -165,95 +165,66 @@ </Grid.RowDefinitions> <Grid Grid.Row="1"> - <Grid.RowDefinitions> - <RowDefinition Height="150"/> - <RowDefinition Height="*"/> - </Grid.RowDefinitions> - <Grid> - <StackPanel Margin="30 20" HorizontalAlignment="Left"> - <TextBlock Style="{StaticResource MaterialDesignDisplay1TextBlock}">Welcome to Machine Studio</TextBlock> - <TextBlock HorizontalAlignment="Right" Margin="0 5 -130 0" FontStyle="Italic" Style="{StaticResource MaterialDesignSubheadingTextBlock}" Foreground="{StaticResource AccentColorBrush}">Select Your Studio Module...</TextBlock> - </StackPanel> - </Grid> + <controls:MultiTransitionControl x:Name="TransitionControl" AlwaysFade="True" TransitionType="Zoom"> + <controls:MultiTransitionControl.Controls> + <ContentControl Tag="Home"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="150"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <Grid> + <StackPanel Margin="30 20" HorizontalAlignment="Left"> + <TextBlock Style="{StaticResource MaterialDesignDisplay1TextBlock}">Welcome to Machine Studio</TextBlock> + <TextBlock HorizontalAlignment="Right" Margin="0 5 -130 0" FontStyle="Italic" Style="{StaticResource MaterialDesignSubheadingTextBlock}" Foreground="{StaticResource AccentColorBrush}">Select Your Studio Module...</TextBlock> + </StackPanel> + </Grid> - <Grid Grid.Row="2"> - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> - <ItemsControl ItemsSource="{Binding StudioModuleLoader.UserModules}" Margin="10"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <WrapPanel IsItemsHost="True"></WrapPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> + <Grid Grid.Row="2"> + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> + <ItemsControl ItemsSource="{Binding StudioModuleLoader.UserModules}" Margin="10"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True"></WrapPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <materialDesign:Card Width="300" Margin="10" Height="400"> - <Grid > - <Grid.RowDefinitions> - <RowDefinition Height="180" /> - <RowDefinition Height="*" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - <Image Source="{Binding Image,Mode=OneWay}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" /> - <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}" Grid.Row="0" Margin="0,0,20,-35" HorizontalAlignment="Right" Width="70" Height="70" VerticalAlignment="Bottom" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" ToolTip="Start This Module"> - <materialDesign:PackIcon Kind="Play" Width="30" Height="30" /> - </Button> - <StackPanel Grid.Row="1" Margin="8,24,8,0"> - <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding Name,Mode=OneWay}"></TextBlock> - <TextBlock VerticalAlignment="Center" Margin="0 5 0 0" FontSize="14" TextWrapping="Wrap" Text="{Binding Description,Mode=OneWay}"></TextBlock> - </StackPanel> - <StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal"> - <materialDesign:PopupBox Padding="2,0,2,0" Style="{StaticResource MaterialDesignToolPopupBox}"> - <StackPanel> - <Button Content="More" /> - <Button Content="Options" /> - </StackPanel> - </materialDesign:PopupBox> - </StackPanel> - </Grid> - </materialDesign:Card> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </ScrollViewer> - </Grid> - </Grid> - - <Grid Grid.Row="1" RenderTransformOrigin="0.5,0.5"> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="RenderTransform"> - <Setter.Value> - <ScaleTransform ScaleX="0" ScaleY="0"></ScaleTransform> - </Setter.Value> - </Setter> - <Setter Property="Opacity" Value="0"></Setter> - - <Style.Triggers> - <DataTrigger Binding="{Binding IsModuleLoaded}" Value="False"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0" Duration="00:00:0.5"></DoubleAnimation> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" Duration="00:00:0.5"></DoubleAnimation> - <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.5"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.5"></DoubleAnimation> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.5"></DoubleAnimation> - <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.5"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </Grid.Style> - <ContentPresenter Content="{Binding CurrentModule.MainView}"/> + <ItemsControl.ItemTemplate> + <DataTemplate> + <materialDesign:Card Width="300" Margin="10" Height="400"> + <Grid > + <Grid.RowDefinitions> + <RowDefinition Height="180" /> + <RowDefinition Height="*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Image Source="{Binding Image,Mode=OneWay}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant" /> + <Button Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}" Grid.Row="0" Margin="0,0,20,-35" HorizontalAlignment="Right" Width="70" Height="70" VerticalAlignment="Bottom" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" ToolTip="Start This Module"> + <materialDesign:PackIcon Kind="Play" Width="30" Height="30" /> + </Button> + <StackPanel Grid.Row="1" Margin="8,24,8,0"> + <TextBlock FontWeight="Bold" FontSize="20" Text="{Binding Name,Mode=OneWay}"></TextBlock> + <TextBlock VerticalAlignment="Center" Margin="0 5 0 0" FontSize="14" TextWrapping="Wrap" Text="{Binding Description,Mode=OneWay}"></TextBlock> + </StackPanel> + <StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal"> + <materialDesign:PopupBox Padding="2,0,2,0" Style="{StaticResource MaterialDesignToolPopupBox}"> + <StackPanel> + <Button Content="More" /> + <Button Content="Options" /> + </StackPanel> + </materialDesign:PopupBox> + </StackPanel> + </Grid> + </materialDesign:Card> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </Grid> + </Grid> + </ContentControl> + </controls:MultiTransitionControl.Controls> + </controls:MultiTransitionControl> </Grid> </Grid> 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 index f52393e1c..bcded15cf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs @@ -14,11 +14,14 @@ using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.Modules; using Tango.MachineStudio.UI.Notifications; using Tango.MachineStudio.UI.SupervisingController; using Tango.SharedUI; using Tango.SharedUI.Controls; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.Views { @@ -27,9 +30,35 @@ namespace Tango.MachineStudio.UI.Views /// </summary> public partial class MainView : View, IMainView { + private DefaultStudioModuleLoader _loader; + public MainView() : base() { InitializeComponent(); + + _loader = ServiceLocator.Current.GetInstance<IStudioModuleLoader>() as DefaultStudioModuleLoader; + _loader.ModulesLoaded += Loader_ModulesLoaded; + } + + public void NavigateToModule(IStudioModule module) + { + TransitionControl.AutoNavigate(module != null ? module.Name : "Home"); + } + + private void Loader_ModulesLoaded(object sender, EventArgs e) + { + TransitionControl.Controls.RemoveAll((x) => x.Tag.ToString() != "Home"); + + foreach (var module in _loader.UserModules) + { + TransitionControl.Controls.Add(new ContentControl() + { + Tag = module.Name, + Content = module.MainView + }); + } + + TransitionControl.RefreshControls(); } } } |
