jangwon il y a 4 ans
Parent
commit
d112918ef7

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

@@ -106,6 +106,10 @@
     <Reference Include="MaterialDesignThemes.Wpf, Version=3.0.1.920, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\MaterialDesignThemes.3.0.1\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
     </Reference>
+    <Reference Include="OHVConnector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\VehicleControlSystem\bin\Debug\OHVConnector.dll</HintPath>
+    </Reference>
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="Prism, Version=7.2.0.1422, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">

+ 2 - 1
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoView.xaml

@@ -453,7 +453,8 @@
                     </Button>
                 </StackPanel>
             </Grid>
-            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{DynamicResource ResourceKey=SettingView_DriveWarning}" TextAlignment="Center" Foreground="#DDFF0000" VerticalAlignment="Top" Margin="0,526,0,-132" Grid.Row="1" Height="100" Width="1126" FontSize="78" Grid.ColumnSpan="2" Visibility="{c:Binding 'OcsState == OHVCommonShareds:eOcsState.DisConnect'}" />
+
+            <TextBlock Text="{DynamicResource SettingView_DriveWarning}" HorizontalAlignment="Left" TextWrapping="Wrap" TextAlignment="Center" Foreground="Red" VerticalAlignment="Top" Margin="0,526,0,-132" Grid.Row="1" Height="100" Width="1126" FontSize="78" Grid.ColumnSpan="2" Visibility="{c:Binding 'OcsState == OHVCommonShareds:eOcsState.DisConnect'}"/>
 
             <!--<xctk:BusyIndicator x:Name="MyProgress" Grid.RowSpan="2" Grid.ColumnSpan="2" IsBusy="{Binding IsBusy, FallbackValue=true}" BusyContent="{Binding BusyText}"/>-->
 

+ 1 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoView.xaml.cs

@@ -20,6 +20,7 @@ namespace OHV.Module.Interactivity.PopUp
     /// </summary>
     public partial class DriveServoView : UserControl
     {
+
         public DriveServoView( )
         {
             InitializeComponent();

+ 15 - 11
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoViewModel.cs

@@ -22,6 +22,7 @@ using VehicleControlSystem;
 using VehicleControlSystem.ControlLayer;
 using VehicleControlSystem.ControlLayer.IO;
 using VehicleControlSystem.ControlLayer.MQ;
+using VehicleControlSystem.Managers;
 
 namespace OHV.Module.Interactivity.PopUp
 {
@@ -222,13 +223,6 @@ namespace OHV.Module.Interactivity.PopUp
             set { SetProperty(ref this.busyText, value); }
         }
 
-        //private bool warningEnabled;
-        //public bool WarningEnabled
-        //{
-        //    get { return warningEnabled; }
-        //    set { SetProperty(ref this.warningEnabled, value); }
-        //}
-
         eOcsState ocsState = eOcsState.DisConnect;
         public eOcsState OcsState
         {
@@ -239,6 +233,7 @@ namespace OHV.Module.Interactivity.PopUp
 
         VCSystem vcSystem;
         ZmqManager zmqManager;
+        HostManager hostManager;
 
         SqliteManager sql;
         MessageController messageController;
@@ -264,6 +259,8 @@ namespace OHV.Module.Interactivity.PopUp
             this.zmqManager = system.ZmqManager;
             system.ZmqManager.PropertyChanged += ZmqManager_PropertyChanged;
 
+            this.hostManager = system.hostManager;
+
             this.SelectPosCommand = new DelegateCommand<object>( ExecuteSelectPosCommand );
             this.MoveToCommand = new DelegateCommand( ExecuteMoveToCommand );
             this.CurrentToTargetCommand = new DelegateCommand( ExecuteCurrentToTargetCommand );
@@ -289,8 +286,11 @@ namespace OHV.Module.Interactivity.PopUp
             var ezIO = this.vcSystem.IO as EzIO;
             ezIO.OnChangedIO += EzIO_OnChangedIO;
 
-            //WarningEnabled = true;
-        }
+            //var currentState = IsConnected;
+        } 
+
+        //OHVConnector.Manager manager = new OHVConnector.Manager();
+        //public bool IsConnected { get { return this.manager.Connected; } }
 
         private void ExecuteBreakOffCommand()
         {
@@ -314,6 +314,11 @@ namespace OHV.Module.Interactivity.PopUp
             this.DriveAutoReadyState( this.zmqManager.IsCanStanbyLocation );
             this.UpdateDriveState( this.zmqManager.DriveState );
 
+            if(hostManager.IsConnected)
+            {
+                this.OcsState = eOcsState.Connect;
+            }
+
             if (!vcSystem.ZmqManager.SetOperationState(eOperatationMode.ManualMode))
                 messageController.ShowNotificationView("Drive Manual Mode Change Fail", false);
         }
@@ -602,11 +607,9 @@ namespace OHV.Module.Interactivity.PopUp
             {
                 case HostConnectedEventArgs.eConnectedState.Connected:
                     this.OcsState = eOcsState.Connect;
-                    //WarningEnabled = false;
                     break;
                 case HostConnectedEventArgs.eConnectedState.Disconnected:
                     this.OcsState = eOcsState.DisConnect;
-                    //WarningEnabled = true;
                     break;
             }
         }
@@ -856,6 +859,7 @@ namespace OHV.Module.Interactivity.PopUp
         {
             RequestClose?.Invoke( dialogResult );
         }
+
         #endregion
     }
 }

+ 1 - 1
Dev/OHV/VehicleControlSystem/VCSystem.cs

@@ -33,7 +33,7 @@ namespace VehicleControlSystem
 
         Scheduler scheduler = null;
         public AutoManager autoManager = null;
-        HostManager hostManager = null;
+        public HostManager hostManager = null;
         SqliteManager sql = null;
 
         IEventAggregator eventAggregator = null;