예제 #1
0
        //Compares most recent value in savelist to user-defined threshold. If below threshold, program paused.
        private void CheckIonTrapped()
        {
            int CheckIonSum1 = 0;
            int CheckIonSum2 = 0;
            if (savelist1.LongCount() != 0)
            {
                CheckIonSum1 += Convert.ToInt32(savelist1.ElementAt(Convert.ToInt32(savelist1.LongCount() - 1)).Y); //Should these be savelist or DataBuffer
            }
            double CheckIonAverage1 = CheckIonSum1;

            if (savelist2.LongCount() != 0)
            {
                CheckIonSum2 += Convert.ToInt32(savelist2.ElementAt(Convert.ToInt32(savelist2.LongCount() - 1)).Y);
            }
            double CheckIonAverage2 = CheckIonSum2;

            if ((CheckIonAverage2 < ThresholdLineValue2) && (CheckIonAverage1 < ThresholdLineValue1))
            {
                StopWarningThreshold = true;
                ThresholdWarning warning = new ThresholdWarning();

                DialogResult dialog = warning.ShowDialog();
                if (dialog == DialogResult.OK)
                {
                    if (warning.IsChecked() == true)
                    {
                        StopWarningThreshold = true;
                    }
                    else
                    {
                        StopWarningThreshold = false;
                    }
                    Console.WriteLine("OK");

                }
                warning.Dispose();
                ThresholdScrollBar1.Value = ThresholdScrollBar1.Maximum;
                Window2.ThresholdScrollBar2.Value = Window2.ThresholdScrollBar2.Maximum;
                ThresholdLineValue1 = 0;
                ThresholdLineValue2 = 0;

            }
        }
예제 #2
0
        // Function to check if fluorescence drops below threshold level, suggesting ions have escaped
        private void CheckIonTrapped()
        {
            int CheckIonSum1 = 0;
            int CheckIonSum2 = 0;

            // Only most recent value compared to threshold, could be improved by checking many values
            if (savelist1.LongCount() != 0)
            {
                CheckIonSum1 += Convert.ToInt32(savelist1.ElementAt(Convert.ToInt32(savelist1.LongCount() - 1)).Y);
            }
            double CheckIonAverage1 = CheckIonSum1;

            if (savelist2.LongCount() != 0)
            {
                CheckIonSum2 += Convert.ToInt32(savelist2.ElementAt(Convert.ToInt32(savelist2.LongCount() - 1)).Y);

            }
            double CheckIonAverage2 = CheckIonSum2;
            if (RHSPane.Checked && LHSPane.Checked)
            {
                if ((CheckIonAverage2 < ThresholdLineValue2) && (CheckIonAverage1 < ThresholdLineValue1))
                {
                    StopWarningThreshold = true;

                    ThresholdWarning warning = new ThresholdWarning();
                    DialogResult dialogresult = warning.ShowDialog();
                    if (dialogresult == DialogResult.OK)
                    {
                        if (warning.IsChecked() == true)
                        {
                            StopWarningThreshold = true;
                        }
                        else
                        {
                            StopWarningThreshold = false;
                        }
                        Console.WriteLine("OK");
                        Pause = false;
                    }
                    warning.Dispose();
                    ThresholdScrollBar1.Value = ThresholdScrollBar1.Maximum;
                    ThresholdScrollBar2.Value = ThresholdScrollBar2.Maximum;
                    ThresholdLineValue1 = 0;
                    ThresholdLineValue2 = 0;
                }

            }

            else if (!LHSPane.Checked && RHSPane.Checked)
            {
                if (CheckIonAverage2 < ThresholdLineValue2)
                {
                    ThresholdWarning warning = new ThresholdWarning();

                    DialogResult dialogresult = warning.ShowDialog();
                    if (dialogresult == DialogResult.OK)
                    {
                        if (warning.IsChecked() == true)
                        {
                            StopWarningThreshold = true;
                        }
                        else
                        {
                            StopWarningThreshold = false;
                        }
                        Console.WriteLine("OK");
                        Pause = false;
                    }
                    warning.Dispose();
                    ThresholdScrollBar1.Value = ThresholdScrollBar1.Maximum;
                    ThresholdScrollBar2.Value = ThresholdScrollBar2.Maximum;
                    ThresholdLineValue1 = 0;
                    ThresholdLineValue2 = 0;
                }

            }

            else if (LHSPane.Checked && !RHSPane.Checked)
            {
                if (CheckIonAverage1 < ThresholdLineValue1)
                {
                    ThresholdWarning warning = new ThresholdWarning();

                    DialogResult dialogresult = warning.ShowDialog();
                    if (dialogresult == DialogResult.OK)
                    {
                        if (warning.IsChecked() == true)
                        {
                            StopWarningThreshold = true;
                        }
                        else
                        {
                            StopWarningThreshold = false;
                        }
                        Console.WriteLine("OK");
                        Pause = false;
                    }
                    warning.Dispose();
                    ThresholdScrollBar1.Value = ThresholdScrollBar1.Maximum;
                    ThresholdScrollBar2.Value = ThresholdScrollBar2.Maximum;
                    ThresholdLineValue1 = 0;
                    ThresholdLineValue2 = 0;
                }
            }
        }