private void InitData() { SpeedBar.Value = AdsCommunication.ReadLongReal(ReferenceHandler.GetReferenceAdress("continousOverride")); switch (AdsCommunication.ReadLongReal(ReferenceHandler.GetReferenceAdress("StepSize")) * 10) { case 1: StepSize.SelectedIndex = 0; break; case 2: StepSize.SelectedIndex = 1; break; case 5: StepSize.SelectedIndex = 2; break; case 10: StepSize.SelectedIndex = 3; break; default: break; } }
private void SpeedBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (SpeedBox != null) { SpeedBox.Text = Math.Round((decimal)SpeedBar.Value, 0).ToString() + " %"; AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("Override"), (Double)Math.Round((decimal)SpeedBar.Value, 2)); } }
private void GoTo_Click(object sender, RoutedEventArgs e) { if (Selector.Text != "") { AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress(axisName + Selector.Text), SaveTempPos); ComboBoxItem comboBoxItem = Selector.SelectedItem as ComboBoxItem; TargetPos.Text = Math.Round(AdsCommunication.ReadLongReal(ReferenceHandler.GetReferenceAdress(axisName + comboBoxItem.Content.ToString())), 2).ToString(); } }
private void btnMode_Click(object sender, RoutedEventArgs e) { if (!AdsCommunication.ReadBit(ReferenceHandler.GetReferenceAdress("mode"))) { AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("mode"), true); } else { AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("mode"), false); } }
private void CloseNotification_ButtonClick(object sender, RoutedEventArgs e) { if (notifiDisplayer.btnOK.Opacity == 100) { AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("confirm"), true); //if(AdsCommunication.ReadInt(GetReferenceAdress("message_number", NotificationData)) == 0) //{ // CloseNotification(); //} } }
private void MovementModeSelect_Click(object sender, RoutedEventArgs e) { if (AdsCommunication.ReadBit(ReferenceHandler.GetReferenceAdress("ManualMovementMode"))) { SetStatement(false); } else { SetStatement(true); } }
public void SetStatement(bool state) { if (state) { MovementModeSelect.Content = LanguageHandler.GetMessageResource("btnContinous"); SpeedBox.Foreground = (FindResource("AccentColorBrush") as SolidColorBrush); StepSizeText.Foreground = (FindResource("PrimaryHueLightBrush") as SolidColorBrush); StepSize.Foreground = (FindResource("PrimaryHueLightBrush") as SolidColorBrush); SpeedBar.IsEnabled = true; StepSize.IsEnabled = false; } else { MovementModeSelect.Content = LanguageHandler.GetMessageResource("btnStep"); SpeedBox.Foreground = (FindResource("PrimaryHueLightBrush") as SolidColorBrush); StepSizeText.Foreground = (FindResource("AccentColorBrush") as SolidColorBrush); StepSize.Foreground = (FindResource("AccentColorBrush") as SolidColorBrush); SpeedBar.IsEnabled = false; StepSize.IsEnabled = true; } AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("ManualMovementMode"), state); }
private void SavePos_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if ((DateTime.Now - click_Started).TotalSeconds > 10) { if (CurrentlySelected != -1) { coordinate[CurrentlySelected] = PositionSyncronizer.CurrentPosition; PositionSyncronizer.TargetPosition = coordinate[CurrentlySelected]; AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("PositionArray"), coordinate); } DisplayData(coordinate[CurrentlySelected], C_Axis_Exists); SetGridStlye(C_Axis_Exists); dispatcherTimer.Stop(); SavePos.Content = "Save"; SavePos.Foreground = FindResource("AccentColorBrush") as SolidColorBrush; } else { dispatcherTimer.Stop(); SavePos.Content = "Save"; } }
private void SyncCoord() { coordinate = AdsCommunication.CoordinateArrayRead(MaxCoordinateNR, ReferenceHandler.GetReferenceAdress("PositionArray")); }
private void Selector_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem comboBoxItem = Selector.SelectedItem as ComboBoxItem; TargetPos.Text = Math.Round(AdsCommunication.ReadLongReal(ReferenceHandler.GetReferenceAdress(axisName + comboBoxItem.Content.ToString())), 2).ToString(); }
private void ExecuteButtonCommand(string VarName, bool status) { AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress(VarName), status); }
public void TwinCat3Client_AdsNotificationEx(object sender, AdsNotificationExEventArgs e) { Application.Current.Dispatcher.Invoke (new Action(() => { if (e.UserData == ReferenceHandler.GetReferenceObject("controll")) { if ((bool)e.Value) { btnControl.Background = (SolidColorBrush)FindResource("BaseGreenBrush"); } else { btnControl.Background = (SolidColorBrush)FindResource("BaseRedBrush"); } } if (e.UserData == ReferenceHandler.GetReferenceObject("mode")) { if ((bool)e.Value) { btnMode.Background = (SolidColorBrush)FindResource("BaseGreenBrush"); btnModeContent.Text = "A"; } else { btnMode.Background = (SolidColorBrush)FindResource("BaseYellowBrush"); btnModeContent.Text = "M"; } } if (e.UserData == ReferenceHandler.GetReferenceObject("deprag_status")) { mainPage.tbStatus.Text = e.Value.ToString(); } if (e.UserData == ReferenceHandler.GetReferenceObject("deprag_step")) { mainPage.tbStepNr.Text = e.Value.ToString(); } if (e.UserData == ReferenceHandler.GetReferenceObject("result_torque")) { mainPage.tbTorque.Text = Math.Round((Single)e.Value, 3).ToString(); } if (e.UserData == ReferenceHandler.GetReferenceObject("result_angle")) { mainPage.tbAngle.Text = e.Value.ToString(); } if (e.UserData == ReferenceHandler.GetReferenceObject("deprag_program")) { mainPage.tbProgramNumber.Text = e.Value.ToString(); } if (e.UserData == ReferenceHandler.GetReferenceObject("deprag_CycleTime")) { mainPage.tbProcessTime.Text = Math.Round((Single)e.Value, 3).ToString(); } if (e.UserData == ReferenceHandler.GetReferenceObject("Override")) { SpeedBar.Value = (Double)e.Value; SpeedBox.Text = Math.Round((decimal)(Double)e.Value, 0).ToString() + " %"; } if (e.UserData == ReferenceHandler.GetReferenceObject("message_number")) { if (int.Parse(e.Value.ToString()) != 0) { AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("confirm"), false); AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("ClearNotifi"), false); DisplayError(int.Parse(e.Value.ToString())); } } if (e.UserData == ReferenceHandler.GetReferenceObject("ClearNotifi") && AdsCommunication.ReadInt(ReferenceHandler.GetReferenceAdress("message_number")) == 0 && NotifiSlot.Children.Count != 0) { CloseNotification(); AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("confirm"), false); } })); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { InitData(); SetStatement(AdsCommunication.ReadBit(ReferenceHandler.GetReferenceAdress("ManualMovementMode"))); }
private void StepSize_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem comboBoxItem = StepSize.SelectedItem as ComboBoxItem; AdsCommunication.WriteAny(ReferenceHandler.GetReferenceAdress("StepSize"), double.Parse(comboBoxItem.Content.ToString())); }