diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-11 21:46:22 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-11 21:46:22 +0200 |
| commit | a84ca3e4bee123600c08f8897eca5be83b3ffcf8 (patch) | |
| tree | cccdce1734f55c0647b5c19c1fcc733be92ddbf6 /Software/Visual_Studio/MachineStudio | |
| parent | a801f688bde7b6c75f47ca4ebd2991271c521d34 (diff) | |
| download | Tango-a84ca3e4bee123600c08f8897eca5be83b3ffcf8.tar.gz Tango-a84ca3e4bee123600c08f8897eca5be83b3ffcf8.zip | |
Added TechView for Developer..
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
9 files changed, 43 insertions, 244 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 722d8efe6..43ebc515d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -113,7 +113,6 @@ <Compile Include="ViewModels\DBViewContextWrapper.cs" /> <Compile Include="ViewModels\IOVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> - <Compile Include="ViewModels\MonitoringViewVM.cs" /> <Compile Include="Views\IMainView.cs" /> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> @@ -121,9 +120,6 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> - <Compile Include="Views\MonitoringView.xaml.cs"> - <DependentUpon>MonitoringView.xaml</DependentUpon> - </Compile> <Page Include="Controls\IOMonitorControl.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -136,10 +132,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\MonitoringView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> @@ -227,6 +219,10 @@ <Project>{d0ce8122-077d-42a2-9490-028ae4769b52}</Project> <Name>Tango.MachineStudio.MachineDesigner</Name> </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.Technician\Tango.MachineStudio.Technician.csproj"> + <Project>{5d39c1e1-3ecd-4634-bd1b-2bcf71c54a15}</Project> + <Name>Tango.MachineStudio.Technician</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Resource Include="Images\rgb.png" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index 200c89e19..46c7ecf00 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -21,7 +21,6 @@ namespace Tango.MachineStudio.Developer SimpleIoc.Default.Register<IMainView>(() => MainView.Self); SimpleIoc.Default.Register<MainViewVM>(); - SimpleIoc.Default.Register<MonitoringViewVM>(); } public static MainViewVM MainViewVM @@ -31,13 +30,5 @@ namespace Tango.MachineStudio.Developer return ServiceLocator.Current.GetInstance<MainViewVM>(); } } - - public static MonitoringViewVM MonitoringViewVM - { - get - { - return ServiceLocator.Current.GetInstance<MonitoringViewVM>(); - } - } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index d6c127b1f..f9ec5b063 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -28,6 +28,7 @@ using Tango.Transport; using Tango.Integration.Printing; using Tango.Integration.Diagnostics; using Microsoft.Win32; +using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Developer.ViewModels { @@ -344,6 +345,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } } + private MachineTechViewVM _machineTechViewVM; + /// <summary> + /// Gets or sets the machine tech view models. + /// </summary> + public MachineTechViewVM MachineTechViewVM + { + get { return _machineTechViewVM; } + set { _machineTechViewVM = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -535,6 +546,8 @@ namespace Tango.MachineStudio.Developer.ViewModels ToggleCameraCommand = new RelayCommand<CaptureDevice>(ToggleCamera); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + MachineTechViewVM = new MachineTechViewVM(applicationManager, notificationProvider, false); } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs deleted file mode 100644 index 99fbc5114..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Google.Protobuf.Collections; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; -using Tango.Integration.Services; -using Tango.MachineStudio.Common.StudioApplication; -using Tango.PMR.Diagnostics; -using Tango.SharedUI; - -namespace Tango.MachineStudio.Developer.ViewModels -{ - public class MonitoringViewVM : ViewModel - { - private ObservableCollection<IOVM> _availableControllers; - public ObservableCollection<IOVM> AvailableControllers - { - get { return _availableControllers; } - set { _availableControllers = value; } - } - - private ObservableCollection<IOVM> _controllers; - public ObservableCollection<IOVM> Controllers - { - get { return _controllers; } - set { _controllers = value; } - } - - private ObservablesEntitiesAdapter _adapter; - public ObservablesEntitiesAdapter Adapter - { - get { return _adapter; } - set { _adapter = value; } - } - - public IStudioApplicationManager ApplicationManager { get; set; } - - public MonitoringViewVM(IStudioApplicationManager applicationManager) - { - ApplicationManager = applicationManager; - ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - - if (!this.DesignMode) - { - Adapter = ObservablesEntitiesAdapter.Instance; - AvailableControllers = Adapter.TechMonitors.Select(x => new IOVM(x, x.Name)).ToObservableCollection(); - } - - Controllers = new ObservableCollection<IOVM>(); - } - - private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) - { - if (machine != null) - { - machine.DiagnosticsDataAvailable -= Machine_DiagnosticsDataAvailable; - machine.DiagnosticsDataAvailable += Machine_DiagnosticsDataAvailable; - } - } - - private void Machine_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse data) - { - foreach (var prop in data.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - IOVM controller = _controllers.SingleOrDefault(x => x.IO.Name == prop.Name); - - if (controller != null) - { - if (!controller.IO.MultiChannel) - { - RepeatedField<double> arr = prop.GetValue(data) as RepeatedField<double>; - controller.Value = arr.Last(); - } - else - { - //DoubleArray[] arrayOfDoubles = Enumerable.ToArray(prop.GetValue(data) as IEnumerable<DoubleArray>); - //(controller as GraphMultiController).PushData(arrayOfDoubles.Select(x => x.Data.ToList()).ToList()); - } - } - } - } - - public void OnDropAvailableIO(IOVM ioVM) - { - Controllers.Add(ioVM); - AvailableControllers.Remove(ioVM); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 4cbae2941..cd5cdb8a2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -7,6 +7,7 @@ xmlns:global="clr-namespace:Tango.MachineStudio.Developer" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:techViews="clr-namespace:Tango.MachineStudio.Technician.Views;assembly=Tango.MachineStudio.Technician" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" @@ -1988,7 +1989,7 @@ </Style> </Grid.Style> - <local:MonitoringView Margin="50 0 0 0" /> + <techViews:MachineTechView DataContext="{Binding MachineTechViewVM}" /> </Grid> </Grid> </Grid> @@ -2147,7 +2148,7 @@ <Rectangle HorizontalAlignment="Right" Stroke="#CECECE" StrokeThickness="1"></Rectangle> </Grid> - <Button Background="Transparent" Command="{Binding ToggleSideBarCommand}" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Center" Height="200" Width="50" Margin="0 0 -50 0"> + <Button Background="Transparent" Command="{Binding ToggleSideBarCommand}" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Center" Height="200" Width="50" Margin="0 300 -50 0"> <Border Background="#F6F6F6" CornerRadius="0 10 10 0" BorderThickness="0 1 1 1" BorderBrush="#C6C0C0"> <Grid> <TextBlock Foreground="#FF7272" Text="CONFIGURATION" FontSize="16" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Center" HorizontalAlignment="Center"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml deleted file mode 100644 index bd78ef13e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml +++ /dev/null @@ -1,76 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Developer.Views.MonitoringView" - 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:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" - xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" - xmlns:controls="clr-namespace:Tango.MachineStudio.Developer.Controls" - xmlns:global="clr-namespace:Tango.MachineStudio.Developer" - xmlns:observables="clr-namespace:Tango.Integration.Observables;assembly=Tango.Integration" - xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" - mc:Ignorable="d" - d:DesignHeight="600" d:DesignWidth="1280" Background="White" d:DataContext="{d:DesignInstance Type=vm:MonitoringViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MonitoringViewVM}"> - <Grid> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="230"/> - </Grid.ColumnDefinitions> - - <Grid dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}" dragAndDrop:DragAndDropService.Drop="OnDropAvailableIO"> - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> - <ItemsControl ItemsSource="{Binding Controllers}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <WrapPanel IsItemsHost="True" Orientation="Horizontal" /> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - - <ItemsControl.ItemTemplate> - <DataTemplate DataType="{x:Type vm:IOVM}"> - <Grid Margin="10" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> - <StackPanel> - <TextBlock Text="{Binding IO.Description}" Width="180" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="10" HorizontalAlignment="Center"></TextBlock> - <Viewbox Stretch="Fill" Width="180" Height="100"> - <controls:IOMonitorControl Foreground="Gainsboro" FontFamily="{StaticResource digital-7}" Value="{Binding Value,Mode=OneWay}" /> - </Viewbox> - </StackPanel> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </ScrollViewer> - </Grid> - - <Grid Grid.Column="1"> - <DockPanel> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> - <Image Source="../Images/graphs.png" Width="42"></Image> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">AVAILABLE IO'S</TextBlock> - </StackPanel> - - <Grid> - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> - <ItemsControl ItemsSource="{Binding AvailableControllers}"> - <ItemsControl.ItemTemplate> - <DataTemplate DataType="{x:Type vm:IOVM}"> - <Grid IsHitTestVisible="True" Background="Transparent" Margin="10" Opacity="0.4" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> - <StackPanel IsHitTestVisible="False"> - <TextBlock Text="{Binding IO.Description}" Width="180" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="10" HorizontalAlignment="Center"></TextBlock> - <Viewbox Stretch="Fill" Width="180" Height="100" IsHitTestVisible="False"> - <controls:IOMonitorControl Foreground="Gainsboro" FontFamily="{StaticResource digital-7}" IsHitTestVisible="False" /> - </Viewbox> - </StackPanel> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </ScrollViewer> - </Grid> - </DockPanel> - </Grid> - </Grid> - <dragAndDrop:DraggingSurface x:Name="draggingSurface" IsHitTestVisible="False" /> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs deleted file mode 100644 index 0d649237e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs +++ /dev/null @@ -1,50 +0,0 @@ -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.DragAndDrop; -using Tango.MachineStudio.Developer.ViewModels; - -namespace Tango.MachineStudio.Developer.Views -{ - /// <summary> - /// Interaction logic for MonitoringView.xaml - /// </summary> - public partial class MonitoringView : UserControl - { - private MonitoringViewVM _vm; - - public DraggingSurface DraggingSurface - { - get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } - set { SetValue(DraggingSurfaceProperty, value); } - } - public static readonly DependencyProperty DraggingSurfaceProperty = - DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MonitoringView), new PropertyMetadata(null)); - - public MonitoringView() - { - InitializeComponent(); - DraggingSurface = draggingSurface; - this.Loaded += (x, y) => - { - _vm = this.DataContext as MonitoringViewVM; - }; - } - - private void OnDropAvailableIO(object sender, DropEventArgs e) - { - _vm.OnDropAvailableIO(e.Draggable.DataContext as IOVM); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index e3cbb61cd..d87652e42 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1,4 +1,5 @@ -using Google.Protobuf.Collections; +using GalaSoft.MvvmLight.Ioc; +using Google.Protobuf.Collections; using Microsoft.Win32; using RealTimeGraphEx.Controllers; using System; @@ -98,6 +99,16 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _disableRendering = value; RaisePropertyChangedAuto(); OnDisableRenderingChanged(); } } + private bool _hideMenu; + /// <summary> + /// Gets or sets a value indicating whether [hide menu]. + /// </summary> + public bool HideMenu + { + get { return _hideMenu; } + set { _hideMenu = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -112,7 +123,13 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Constructors - public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) + [PreferredConstructor] + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) : this(applicationManager, notificationProvider, true) + { + + } + + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, bool loadLastProject) { _notification = notificationProvider; _singleControllers = new Dictionary<SingleGraphItem, GraphController>(); @@ -132,7 +149,7 @@ namespace Tango.MachineStudio.Technician.ViewModels _lastTechProjectFile = SettingsManager.Default.MachineStudio.TechnicianModule.LasTechProjectFile; - if (File.Exists(_lastTechProjectFile)) + if (File.Exists(_lastTechProjectFile) && loadLastProject) { OpenProjectFile(_lastTechProjectFile); } @@ -703,7 +720,7 @@ namespace Tango.MachineStudio.Technician.ViewModels await MachineOperator.StopThreadJogging(new ThreadAbortJoggingRequest()); } }; - } + } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 3ad0330a8..7042be696 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -19,7 +19,7 @@ d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MachineTechViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineTechViewVM}"> <UserControl.Resources> - <ResourceDictionary Source="pack://application:,,,/Tango.MachineStudio.Common;component/Resources/MaterialDesign.xaml"></ResourceDictionary> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> </UserControl.Resources> <Grid> @@ -35,7 +35,7 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <Menu Padding="5" Background="#C6ECECEC"> + <Menu Padding="5" Background="#C6ECECEC" Visibility="{Binding HideMenu,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <MenuItem Header="File"> <MenuItem Command="{Binding OpenProjectCommand}" MinWidth="180" Header="Open" VerticalContentAlignment="Center"> <MenuItem.Icon> |
