瀏覽代碼

修改了部分代码

luo 9 月之前
父節點
當前提交
28aa6a45cc

+ 0 - 1
ShakerControl/App.config

@@ -4,6 +4,5 @@
     <add key="ClientID" value="123"/>
     <add key="ServerIP" value="127.0.0.1"/>    
     <add key="ServerPort" value="61616"/>
-    <add key="IsOffine" value="False"/>
   </appSettings>
 </configuration>

+ 6 - 0
ShakerControl/App.xaml.cs

@@ -33,6 +33,12 @@ namespace ShakerControl
 
                     splashScreen.Visibility = Visibility.Collapsed;
                     ShakerControl.MainWindow mainWindow = new ShakerControl.MainWindow();
+#if RELEASE
+                    mainWindow.Top = 0;
+                    mainWindow.Left = 0;
+                    mainWindow.Topmost = true;
+                    mainWindow.ShowInTaskbar = true;
+#endif
                     mainWindow.Show();
                     splashScreen.Close();
                 }));

+ 1 - 1
ShakerControl/ShakerControl.csproj

@@ -8,7 +8,7 @@
     <UseWPF>true</UseWPF>
     <ApplicationManifest>app.manifest</ApplicationManifest>
     <ApplicationIcon>控制端.ico</ApplicationIcon>
-    <AssemblyName>液压振动台控制端</AssemblyName>
+    <AssemblyName>电动振动台集散控制组件控制端</AssemblyName>
     <Company>北京航天希尔测试技术有限公司</Company>
     <Authors>北京航天希尔测试技术有限公司</Authors>
   </PropertyGroup>

+ 13 - 4
ShakerControl/ViewModel/PowerAmplifierViewModel.cs

@@ -11,6 +11,7 @@ namespace ShakerControl.ViewModel
 
     internal class PowerAmplifierViewModel : ViewModelBase<Shaker.Model.PowerAmplifierModel>
     {
+        private const int SLEEP_TIME = 500;
         public ShakerControlViewModel Parent { get; init; }
         private IPLCControl _control;
         private object locker = new object();
@@ -44,19 +45,25 @@ namespace ShakerControl.ViewModel
         public ICommand StopCommand => new DelegateCommand(StopControl);
         public ICommand ResetCommand => new DelegateCommand(ResetControl);
         public ICommand GainSwitchCommand => new DelegateCommand<ExCommandParameter>(GainSwitchControl);
-        public void StartControl()
+        public async void StartControl()
         {
             Parent.PublishLog("启动功放");
+            _control.WriteBit(Model.StartAddress, Model.StopBitIndex, false);
+            await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.StartAddress, Model.StartBitIndex, true);
         }
-        public void StopControl()
+        public async void StopControl()
         {
             Parent.PublishLog("停止功放");
+            _control.WriteBit(Model.StopAddress, Model.StopBitIndex, false);
+            await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.StopAddress, Model.StopBitIndex, true);
         }
-        public void ResetControl()
+        public async void ResetControl()
         {
             Parent.PublishLog("复位报警");
+            _control.WriteBit(Model.ResetAddress, Model.StopBitIndex, false);
+            await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.ResetAddress, Model.ResetBitIndex, true);
         }
         public void GainSwitchControl(ExCommandParameter parameter)
@@ -66,9 +73,11 @@ namespace ShakerControl.ViewModel
                 GainSwitchControl(switchon);
             }
         }
-        public void GainSwitchControl(bool switchon)
+        public async void GainSwitchControl(bool switchon)
         {
             Parent.PublishLog($"{(switchon ? "打开" : "关闭")}增益");
+            _control.WriteBit(Model.GainSwitchAddress, Model.StopBitIndex, false);
+            await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.GainSwitchAddress, Model.GainSwitchBitIndex, switchon);
             if (!switchon) SetGain(0);
         }

+ 1 - 1
ShakerManger/ShakerManger.csproj

@@ -11,7 +11,7 @@
     <IsPublishable>False</IsPublishable>
     <Company>北京航天希尔测试技术有限公司</Company>
     <ApplicationIcon>管理端.ico</ApplicationIcon>
-    <AssemblyName>液压振动台管理端</AssemblyName>
+    <AssemblyName>电动振动台集散控制组件管理端</AssemblyName>
     <Authors>北京航天希尔测试技术有限公司</Authors>
   </PropertyGroup>