Forráskód Böngészése

BatteryConfigView , SteeringConfigView Add

ys-hwang 6 éve
szülő
commit
70f3dc4258

+ 6 - 0
Dev/OHV/OHV.Module.Interactivity/MessageController.cs

@@ -33,6 +33,7 @@ namespace OHV.Module.Interactivity
             containerRegistry.RegisterDialog<InOutView , InOutViewModel>();
             containerRegistry.RegisterDialog<DriveServoView , DriveServoViewModel>();
             containerRegistry.RegisterDialog<LockServoView , LockServoViewModel>();
+            containerRegistry.RegisterDialog<BatteryConfigView , BatteryConfigViewModel>();
         }
 
         public void ShowNotificationView( string Message , bool isOK = true )
@@ -72,5 +73,10 @@ namespace OHV.Module.Interactivity
         {
             this.dialogService.ShowDialog( "DriveServoView" , new DialogParameters() , null );
         }
+
+        public void ShowBatteryPopupView()
+        {
+            this.dialogService.ShowDialog( "BatteryConfigView" , new DialogParameters() , null );
+        }
     }
 }

+ 17 - 4
Dev/OHV/OHV.Module.Interactivity/OHV.Module.Interactivity.csproj

@@ -36,6 +36,10 @@
     <Reference Include="CommonServiceLocator, Version=2.0.4.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
       <HintPath>..\packages\CommonServiceLocator.2.0.4\lib\net45\CommonServiceLocator.dll</HintPath>
     </Reference>
+    <Reference Include="GSG.NET.WPF, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>C:\Users\user\Desktop\새 폴더 (3)\OHV\Assambly\GSG.NET.WPF.dll</HintPath>
+    </Reference>
     <Reference Include="MaterialDesignColors, Version=1.2.2.920, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\MaterialDesignColors.1.2.2\lib\net45\MaterialDesignColors.dll</HintPath>
     </Reference>
@@ -87,6 +91,9 @@
     <Compile Include="PopUp\BatteryConfigView.xaml.cs">
       <DependentUpon>BatteryConfigView.xaml</DependentUpon>
     </Compile>
+    <Compile Include="PopUp\BatteryConfigViewModel.cs">
+      <DependentUpon>BatteryConfigView.xaml</DependentUpon>
+    </Compile>
     <Compile Include="PopUp\CalcuratorView.xaml.cs">
       <DependentUpon>CalcuratorView.xaml</DependentUpon>
     </Compile>
@@ -123,6 +130,9 @@
     <Compile Include="PopUp\ServoConfigViewModel.cs">
       <DependentUpon>ServoConfigView.xaml</DependentUpon>
     </Compile>
+    <Compile Include="PopUp\SteeringConfigView.xaml.cs">
+      <DependentUpon>SteeringConfigView.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -166,20 +176,23 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="PopUp\SteeringConfigView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\..\..\..\GSG\GSG\GSG.NET.WPF\GSG.NET.WPF.csproj">
-      <Project>{6b91fca2-0a26-41d5-8959-a6f27645dacd}</Project>
-      <Name>GSG.NET.WPF</Name>
-    </ProjectReference>
     <ProjectReference Include="..\OHV.Common\OHV.Common.csproj">
       <Project>{0d1f7fbc-bfb0-4ee4-852d-e2a8d62c5708}</Project>
       <Name>OHV.Common</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <Content Include="PopUp\HokuyoReader.png" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

+ 50 - 16
Dev/OHV/OHV.Module.Interactivity/PopUp/BatteryConfigView.xaml

@@ -51,46 +51,73 @@
                     </Grid.RowDefinitions>
 
                     <Grid Grid.Row="0">
-                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
+                        <StackPanel Margin="25,0,0,0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
                             <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
-                                <Button Content="Version" Margin="3" IsEnabled="False"/>
-                                <Button Content="LifeTime" Margin="3" IsEnabled="False"/>
+                                <Button Content="Comport" Margin="3" IsEnabled="False"/>
+                                <Button Content="Baudrate" Margin="3" IsEnabled="False"/>
+                                <Button Content="DataBits" Margin="3" IsEnabled="False"/>
                             </StackPanel>
 
                             <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
-                                <Button Content="1.0.0.01" Margin="3" Background="{x:Null}"/>
-                                <Button Content="yyyy-MM-dd" Margin="3" Background="{x:Null}"/>
+                                <!--<Button Content="{Binding BatteryComPort, FallbackValue=COM1}" Margin="3" Background="{x:Null}"/>-->
+                                <ComboBox
+                                    materialDesign:HintAssist.Hint="ComPort">
+                                    <ComboBoxItem>
+                                        COM1
+                                    </ComboBoxItem>
+                                    <ComboBoxItem>
+                                        COM2
+                                    </ComboBoxItem>
+                                    <ComboBoxItem>
+                                        COM3
+                                    </ComboBoxItem>
+                                    <ComboBoxItem>
+                                        COM4
+                                    </ComboBoxItem>
+                                </ComboBox>
+                                <Button Content="{Binding BatteryBaudRate, FallbackValue=19200}" Margin="3" Background="{x:Null}"/>
+                                <Button Content="{Binding BatteryDataBits, FallbackValue=8}" Margin="3" Background="{x:Null}"/>
                             </StackPanel>
                         </StackPanel>
                     </Grid>
                     
                     <!--Send Message Buttons-->
-                    <StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
-                        <Button Margin="5">
+                    <StackPanel Margin="20,0,0,0" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
+                        <Button Margin="10" Width="80" Height="60"
+                                Command="{Binding MsgSelect}"
+                                CommandParameter="1">
                             <StackPanel>
                                 <TextBlock Text="MSG1"/>
                             </StackPanel>
                         </Button>
 
-                        <Button Margin="5">
+                        <Button Margin="10" Width="80" Height="60"
+                                Command="{Binding MsgSelect}"
+                                CommandParameter="2">
                             <StackPanel>
                                 <TextBlock Text="MSG2"/>
                             </StackPanel>
                         </Button>
 
-                        <Button Margin="5">
+                        <Button Margin="10" Width="80" Height="60"
+                                Command="{Binding MsgSelect}"
+                                CommandParameter="3">
                             <StackPanel>
                                 <TextBlock Text="MSG3"/>
                             </StackPanel>
                         </Button>
 
-                        <Button Margin="5">
+                        <Button Margin="10" Width="80" Height="60"
+                                Command="{Binding MsgSelect}"
+                                CommandParameter="4">
                             <StackPanel>
                                 <TextBlock Text="MSG4"/>
                             </StackPanel>
                         </Button>
 
-                        <Button Margin="5">
+                        <Button Margin="10" Width="80" Height="60"
+                                Command="{Binding MsgSelect}"
+                                CommandParameter="5">
                             <StackPanel>
                                 <TextBlock Text="MSG5"/>
                             </StackPanel>
@@ -99,17 +126,23 @@
                 </Grid>
 
                 <Grid Grid.Row="1">
-
+                    <StackPanel VerticalAlignment="Top">
+                        <GroupBox
+                            Margin="30,0,20,0"
+                            Header="Data Receive" FontSize="15">
+                            <TextBox Text="{Binding BatteryReceive, FallbackValue=[Receive] : xxxxx}"/>
+                        </GroupBox>
+                    </StackPanel>
                 </Grid>
             </Grid>
         </Grid>
 
-        <Grid Grid.Column="1" Background="#37474f">
+        <Grid Grid.Column="1" Background="#263238">
             <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
             <StackPanel>
                 <Button Margin="5" HorizontalAlignment="Stretch" Height="69" 
                         BorderBrush="Gray" BorderThickness="2" 
-                        Command="{Binding CloseDialogCommand}" CommandParameter="true">
+                        Command="{Binding BatteryOpenCommand}" CommandParameter="true">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
                         <TextBlock Text="Open" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
@@ -118,14 +151,15 @@
 
                 <Button Margin="5" HorizontalAlignment="Stretch" Height="69" 
                         BorderBrush="Gray" BorderThickness="2" 
-                        Command="{Binding CloseDialogCommand}" CommandParameter="true">
+                        Command="{Binding BatteryCloseCommand}" CommandParameter="true">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
                         <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
                     </StackPanel>
                 </Button>
 
-                <Button Margin="5,50" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
+                <Button Margin="5,50" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" 
+                        Command="{Binding CloseDialogCommand}" CommandParameter="true">
                     <StackPanel>
                         <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
                         <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />

+ 84 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/BatteryConfigViewModel.cs

@@ -0,0 +1,84 @@
+using Prism.Commands;
+using Prism.Events;
+using Prism.Mvvm;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+
+namespace OHV.Module.Interactivity.PopUp
+{
+    public class BatteryConfigViewModel : BindableBase, IDialogAware
+    {
+        private DelegateCommand<string> _closeDialogCommand;
+        public DelegateCommand<string> CloseDialogCommand =>
+            _closeDialogCommand ?? ( _closeDialogCommand = new DelegateCommand<string>( CloseDialog ) );
+
+        private string _title = "BatteryConfigView";
+        public string Title
+        {
+            get { return this._title; }
+            set
+            {
+                this.SetProperty( ref this._title , value );
+            }
+        }
+
+        public event Action<IDialogResult> RequestClose;
+
+        public ICommand BatteryOpenCommand { get; set; }
+        public ICommand BatteryCloseCommand { get; set; }
+
+        IEventAggregator eventAggregator = null;
+        public BatteryConfigViewModel( IEventAggregator _ea )
+        {
+            this.eventAggregator = _ea;
+
+            this.BatteryOpenCommand = new DelegateCommand( ExecuteOpenCommand );
+            this.BatteryCloseCommand = new DelegateCommand( ExecuteCloseCommand );
+        }
+
+        private void ExecuteOpenCommand( )
+        {
+        }
+
+        private void ExecuteCloseCommand( )
+        {
+        }
+
+        #region Dialog
+        public bool CanCloseDialog( )
+        {
+            return true;
+        }
+
+        public void OnDialogClosed( )
+        {
+        }
+
+        public void OnDialogOpened( IDialogParameters parameters )
+        {
+        }
+
+        private void CloseDialog( string parameter )
+        {
+            ButtonResult result = ButtonResult.None;
+
+            if ( parameter?.ToLower() == "true" )
+                result = ButtonResult.OK;
+            else if ( parameter?.ToLower() == "false" )
+                result = ButtonResult.Cancel;
+
+            RaiseRequestClose( new DialogResult( result ) );
+        }
+
+        public virtual void RaiseRequestClose( IDialogResult dialogResult )
+        {
+            RequestClose?.Invoke( dialogResult );
+        }
+        #endregion
+    }
+}

+ 3 - 16
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoView.xaml

@@ -190,20 +190,7 @@
                 </Grid>
 
                 <Grid Grid.Row="1">
-                    <!--<Grid.ColumnDefinitions>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                        <ColumnDefinition Width="*"/>
-                    </Grid.ColumnDefinitions>
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="*"/>
-                        <RowDefinition Height="*"/>
-                        <RowDefinition Height="*"/>
-                    </Grid.RowDefinitions>-->
-
-                    <StackPanel Margin="0,0,0,90" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
+                    <StackPanel Margin="50,0,0,90" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
                         <Button
                             Style="{StaticResource MaterialDesignRaisedButton}"
                             materialDesign:ButtonAssist.CornerRadius="10"
@@ -218,7 +205,7 @@
                             </StackPanel>
                         </Button>
 
-                        <materialDesign:Badged
+                        <!--<materialDesign:Badged
                             Badge="Current Pos"
                             BadgeColorZoneMode="Dark"
                             BadgePlacementMode="Top"
@@ -231,7 +218,7 @@
                                     <TextBlock Text="0.000"/>
                                 </StackPanel>
                             </Button>
-                        </materialDesign:Badged>
+                        </materialDesign:Badged>-->
 
                         <Button
                             Style="{StaticResource MaterialDesignRaisedButton}"

BIN
Dev/OHV/OHV.Module.Interactivity/PopUp/HokuyoReader.png


+ 8 - 9
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoView.xaml

@@ -104,7 +104,6 @@
                             <TextBlock HorizontalAlignment="Center"><Run Text="Difference"/></TextBlock>
                             <TextBlock HorizontalAlignment="Center"><Run Text="Pos"/></TextBlock>
                         </StackPanel>
-
                     </Button>
 
                     <!--Column2-->
@@ -203,7 +202,7 @@
                 </Grid>
 
                 <Grid Grid.Row="1">
-                    <StackPanel Margin="0,0,0,90" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
+                    <StackPanel Margin="50,0,0,90" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
                         <Button
                             Style="{StaticResource MaterialDesignRaisedButton}"
                             materialDesign:ButtonAssist.CornerRadius="10"
@@ -218,7 +217,7 @@
                             </StackPanel>
                         </Button>
 
-                        <materialDesign:Badged
+                        <!--<materialDesign:Badged
                             Badge="Current Pos"
                             BadgeColorZoneMode="Dark"
                             BadgePlacementMode="Top"
@@ -231,7 +230,7 @@
                                     <TextBlock Text="0.000"/>
                                 </StackPanel>
                             </Button>
-                        </materialDesign:Badged>
+                        </materialDesign:Badged>-->
 
                         <Button
                             Style="{StaticResource MaterialDesignRaisedButton}"
@@ -282,11 +281,11 @@
                         </materialDesign:Badged>
 
                         <Button
-                    Margin="5"
-                    Grid.Row="2" 
-                    Grid.Column="3"
-                    HorizontalAlignment="Stretch"
-                    Height="auto">
+                            Margin="5"
+                            Grid.Row="2" 
+                            Grid.Column="3"
+                            HorizontalAlignment="Stretch"
+                            Height="auto">  
                             <StackPanel>
                                 <materialDesign:PackIcon Kind="ArrowRightBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                                 <TextBlock><Run Text="Jog(+)"/></TextBlock>

+ 83 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/SteeringConfigView.xaml

@@ -0,0 +1,83 @@
+<UserControl x:Class="OHV.Module.Interactivity.PopUp.SteeringConfigView"
+             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:OHV.Module.Interactivity.PopUp"
+             xmlns:prism="http://prismlibrary.com/"
+             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             mc:Ignorable="d" 
+             Width="800"
+             Height="600"
+             Background="#455a64">
+
+    <prism:Dialog.WindowStyle>
+        <Style TargetType="Window">
+            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
+            <Setter Property="Background" Value="Transparent"/>
+            <Setter Property="AllowsTransparency" Value="True"/>
+            <Setter Property="ResizeMode" Value="NoResize"/>
+            <Setter Property="WindowStyle" Value="None"/>
+            <Setter Property="BorderThickness" Value="1"/>
+            <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
+            <Setter Property="Template" Value="{DynamicResource WindowTemplateKey}"/>
+
+            <!--<Style.Triggers>
+                <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
+                    <Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
+                </Trigger>
+            </Style.Triggers>-->
+        </Style>
+    </prism:Dialog.WindowStyle>
+
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="*"/>
+            <ColumnDefinition Width="130"/>
+        </Grid.ColumnDefinitions>
+
+        <Grid Grid.Column="0" Margin="15" Background="#37474f">
+            <StackPanel>
+                <Border Margin="15" HorizontalAlignment="Left" VerticalAlignment="Bottom"
+                        Height="250"
+                        Width="250">
+                    <Border.Background>
+                        <ImageBrush ImageSource="HokuyoReader.png"/>
+                    </Border.Background>
+                </Border>
+            </StackPanel>
+        </Grid>
+
+        <Grid Grid.Column="1" Background="#263238">
+            <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
+            <StackPanel>
+                <Button Margin="5" HorizontalAlignment="Stretch" Height="69" 
+                        BorderBrush="Gray" BorderThickness="2" 
+                        Command="{Binding SteeringConnectCommand}" CommandParameter="true">
+                    <StackPanel>
+                        <!--<materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
+                        <TextBlock Text="Connect" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
+                    </StackPanel>
+                </Button>
+
+                <Button Margin="5" HorizontalAlignment="Stretch" Height="69" 
+                        BorderBrush="Gray" BorderThickness="2" 
+                        Command="{Binding SteeringDisConnectCommand}" CommandParameter="true">
+                    <StackPanel>
+                        <!--<materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
+                        <TextBlock Text="Disonnect" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
+                    </StackPanel>
+                </Button>
+
+                <Button Margin="5,50" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" 
+                        Command="{Binding CloseDialogCommand}" CommandParameter="true">
+                    <StackPanel>
+                        <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
+                        <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
+                    </StackPanel>
+                </Button>
+            </StackPanel>
+        </Grid>
+    </Grid>
+</UserControl>

+ 28 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/SteeringConfigView.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 OHV.Module.Interactivity.PopUp
+{
+    /// <summary>
+    /// SteeringConfigView.xaml에 대한 상호 작용 논리
+    /// </summary>
+    public partial class SteeringConfigView : UserControl
+    {
+        public SteeringConfigView( )
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 7 - 0
Dev/OHV/OHV.Module.MainViews/Views/UnitViewModel.cs

@@ -20,6 +20,7 @@ namespace OHV.Module.MainViews.Views
 
         public ICommand ServoConfigCommand { get; set; }
         public ICommand InoutPupup { get; set; }
+        public ICommand BatteryPopup { get; set; }
 
         public UnitViewModel( IEventAggregator _ea , VCSystem _vcSystem , MessageController _msgController )
         {
@@ -29,6 +30,12 @@ namespace OHV.Module.MainViews.Views
 
             this.ServoConfigCommand = new DelegateCommand( ExecuteServoConfigCommand );
             this.InoutPupup = new DelegateCommand( ExecuteInOutCommand );
+            this.BatteryPopup = new DelegateCommand( ExecuteBatteryCommand );
+        }
+
+        private void ExecuteBatteryCommand( )
+        {
+            this.msgController.ShowBatteryPopupView();
         }
 
         private void ExecuteInOutCommand( )