public CustomizationDialogWindow() { InitializeComponent(); // For now, Chatter is not supported ChatterCheckBox.IsEnabled = false; // Set the default values CurrentsForCustomization(); // Initializing Data Entry ComboBox ToolBreakageActionsComboBox.Items.Add("Alarm & Stop"); // index=0 ToolBreakageActionsComboBox.Items.Add("Alarm & Stop Later"); // index=1 ToolBreakageActionsComboBox.Items.Add("Alarm & Continue"); // index=2 switch (LSV2Caller.GetToolBreakageAction()) { case toolBreakageActionType.alarmAndStop: ToolBreakageActionsComboBox.SelectedIndex = 0; break; case toolBreakageActionType.alarmAndDelayStop: ToolBreakageActionsComboBox.SelectedIndex = 1; break; case toolBreakageActionType.alarmAndContinue: ToolBreakageActionsComboBox.SelectedIndex = 2; break; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (okayButtonSkiped) { LSV2Caller.SetToolBreakage(tempToolBreakage); LSV2Caller.SetAdaptiveControl(tempAdaptiveCont); LSV2Caller.SetVirtualRealConnection(tempVirtualReal); LSV2Caller.SetFeedbacktoReal(tempFeedback); isCustomizationOn = mainWindow.currCustomizationStatus; } //Console.WriteLine("Closing"); }
//---------------------------------------------------------------------------- // Utility procedures //---------------------------------------------------------------------------- // private void CurrentsForCustomization() { ToolBreakageCheckBox.IsChecked = LSV2Caller.GetToolBreakage(); if (!(bool)ToolBreakageCheckBox.IsChecked) { ToolBreakageCheckBox.Background = Brushes.Orange; } tempToolBreakage = LSV2Caller.GetToolBreakage(); AdaptiveContCheckBox.IsChecked = LSV2Caller.GetAdaptiveControl(); if (!(bool)AdaptiveContCheckBox.IsChecked) { AdaptiveContCheckBox.Background = Brushes.Orange; } tempAdaptiveCont = LSV2Caller.GetAdaptiveControl(); VirtualRealConnCheckBox.IsChecked = LSV2Caller.GetVirtualRealConnection(); if (!(bool)VirtualRealConnCheckBox.IsChecked) { VirtualRealConnCheckBox.Background = Brushes.Orange; } tempVirtualReal = LSV2Caller.GetVirtualRealConnection(); FeedBackCheckBox.IsChecked = LSV2Caller.GetFeedbacktoReal(); if (!(bool)FeedBackCheckBox.IsChecked) { FeedBackCheckBox.Background = Brushes.Orange; } tempFeedback = LSV2Caller.GetFeedbacktoReal(); if (LSV2Caller.GetIsPeekForceUsed()) { PeekForceCheckBox.IsChecked = true; } else { AverageForceCheckBox.IsChecked = true; } thresholdPercentage = LSV2Caller.GetThresholdPercentage(); thresholdTextBox.Text = thresholdPercentage.ToString(); samplingTimeFactor = LSV2Caller.GetSamplingTime(); SamplingTimeTextBox.Text = samplingTimeFactor.ToString(); //trackingTol = mainWindow.trackTolerans; TrackTolTextBox.Text = mainWindow.trackTolerans.ToString(); // done in main window, because address is not passed yet. spindleExhaustFactor = LSV2Caller.GetSpindleExhaustion(); SpindleExhaustTextBox.Text = spindleExhaustFactor.ToString(); rRef = LSV2Caller.GetGPCforce(); GPCforceTextBox.Text = rRef.ToString(); lambdaFactor = LSV2Caller.GetLambda(); LambdaTextBox.Text = lambdaFactor.ToString(); forceOvershootTolPercent = LSV2Caller.GetForceOvershootTolPer(); ForceOvershootTextBox.Text = forceOvershootTolPercent.ToString(); goToCheckTime = LSV2Caller.GetFeatureCheckTime(); GoToCheckTextBox.Text = goToCheckTime.ToString(); delayCompansationTime = LSV2Caller.GetCompCheckTime(); DelayCompTextBox.Text = delayCompansationTime.ToString(); }
//---------------------------------------------------------------------------- // CLICK procedures //---------------------------------------------------------------------------- // private void OkayButton_Click(object sender, RoutedEventArgs e) { LSV2Caller.SetToolBreakage((bool)ToolBreakageCheckBox.IsChecked); if ((bool)ToolBreakageCheckBox.IsChecked) { mainWindow.TabItemToolProcessButton.Background = Brushes.LightSeaGreen; } else { mainWindow.TabItemToolProcessButton.Background = Brushes.Gray; } LSV2Caller.SetAdaptiveControl((bool)AdaptiveContCheckBox.IsChecked); if ((bool)AdaptiveContCheckBox.IsChecked) { mainWindow.TabItemAdaptProcessButton.Background = Brushes.LightSeaGreen; } else { mainWindow.TabItemAdaptProcessButton.Background = Brushes.Gray; } LSV2Caller.SetVirtualRealConnection((bool)VirtualRealConnCheckBox.IsChecked); if ((bool)VirtualRealConnCheckBox.IsChecked) { mainWindow.TabItemVirtualFeedButton.Background = Brushes.LightSeaGreen; } else { mainWindow.TabItemVirtualFeedButton.Background = Brushes.Gray; } // Note: When Chatter is ready, add a line just like above // We need to combine this with Virtual Real Connection LSV2Caller.SetFeedbacktoReal((bool)FeedBackCheckBox.IsChecked); LSV2Caller.SetIsPeekForceUsed((bool)PeekForceCheckBox.IsChecked); //if (eta1LimitTextBox.Text != "") LSV2Caller.SetEta1Reference(Convert.ToDouble(eta1LimitTextBox.Text)); else return; //if (eta2LimitTextBox.Text != "") LSV2Caller.SetEta2Reference(Convert.ToDouble(eta2LimitTextBox.Text)); else return; //if (thresholdTextBox.Text != "") LSV2Caller.SetThresholdPercentage(Convert.ToInt16(thresholdTextBox.Text)); else return; //if (LambdaTextBox.Text != "") LSV2Caller.SetLambda(Convert.ToDouble(LambdaTextBox.Text)); else return; //if (AbarValueTextBox.Text != "") LSV2Caller.SetAbarvalue(Convert.ToDouble(AbarValueTextBox.Text)); else return; //if (GPCforceTextBox.Text != "") LSV2Caller.SetGPCforce(Convert.ToDouble(GPCforceTextBox.Text)); else return; //if (SpindleExhaustTextBox.Text != "") LSV2Caller.SetSpindleExhaustion(Convert.ToDouble(SpindleExhaustTextBox.Text)); else return; //if (ForceOvershootTextBox.Text != "") LSV2Caller.SetForceOvershootTolPer(Convert.ToDouble(ForceOvershootTextBox.Text)); else return; //if (GoToCheckTextBox.Text != "") LSV2Caller.SetFeatureCheckTime(Convert.ToDouble(GoToCheckTextBox.Text)); else return; //if (DelayCompTextBox.Text != "") LSV2Caller.SetCompCheckTime(Convert.ToDouble(DelayCompTextBox.Text)); else return; if ((thresholdTextBox.Text == "") || (LambdaTextBox.Text == "") || (SamplingTimeTextBox.Text == "") || (GPCforceTextBox.Text == "") || (SpindleExhaustTextBox.Text == "") || (ForceOvershootTextBox.Text == "") || (GoToCheckTextBox.Text == "") || (DelayCompTextBox.Text == "") || (TrackTolTextBox.Text == "")) { return; } LSV2Caller.SetThresholdPercentage(Convert.ToInt16(thresholdTextBox.Text)); LSV2Caller.SetLambda(Convert.ToDouble(LambdaTextBox.Text)); LSV2Caller.SetGPCforce(Convert.ToDouble(GPCforceTextBox.Text)); LSV2Caller.SetSamplingTime(Convert.ToDouble(SamplingTimeTextBox.Text)); LSV2Caller.SetSpindleExhaustion(Convert.ToDouble(SpindleExhaustTextBox.Text)); LSV2Caller.SetForceOvershootTolPer(Convert.ToDouble(ForceOvershootTextBox.Text)); LSV2Caller.SetFeatureCheckTime(Convert.ToDouble(GoToCheckTextBox.Text)); LSV2Caller.SetCompCheckTime(Convert.ToDouble(DelayCompTextBox.Text)); mainWindow.trackTolerans = Convert.ToDouble(TrackTolTextBox.Text); switch (ToolBreakageActionsComboBox.SelectedIndex) { case 0: LSV2Caller.SetToolBreakageAction(toolBreakageActionType.alarmAndStop); break; case 1: LSV2Caller.SetToolBreakageAction(toolBreakageActionType.alarmAndDelayStop); break; case 2: LSV2Caller.SetToolBreakageAction(toolBreakageActionType.alarmAndContinue); break; } // Check whether any field is changed // isCustomizationOn = false; if (!(ToolBreakageCheckBox.IsChecked == true)) { isCustomizationOn = true; } if (!(AdaptiveContCheckBox.IsChecked == true)) { isCustomizationOn = true; } if (!(VirtualRealConnCheckBox.IsChecked == true)) { isCustomizationOn = true; } if (!(FeedBackCheckBox.IsChecked == true)) { isCustomizationOn = true; } if (!(PeekForceCheckBox.IsChecked == true)) { isCustomizationOn = true; } if (Convert.ToInt16(thresholdTextBox.Text) != thresholdDefault) { isCustomizationOn = true; } if (Convert.ToDouble(SamplingTimeTextBox.Text) != samplingTimeDefault) { isCustomizationOn = true; } if (Convert.ToDouble(TrackTolTextBox.Text) != trackingToleranceDefault) { isCustomizationOn = true; } if (Convert.ToDouble(SpindleExhaustTextBox.Text) != spindleExhaustDefault) { isCustomizationOn = true; } if (Convert.ToDouble(GPCforceTextBox.Text) != gpcForceDefault) { isCustomizationOn = true; } if (Convert.ToDouble(LambdaTextBox.Text) != lambdaDefault) { isCustomizationOn = true; } if (Convert.ToDouble(ForceOvershootTextBox.Text) != forceOverShootDefault) { isCustomizationOn = true; } if (Convert.ToDouble(GoToCheckTextBox.Text) != goToCheckDefault) { isCustomizationOn = true; } if (Convert.ToDouble(DelayCompTextBox.Text) != delayCompensationDefault) { isCustomizationOn = true; } mainWindow.currCustomizationStatus = isCustomizationOn; // Okay button is not skiped. This is required for Clicks okayButtonSkiped = false; this.Close(); }