コード例 #1
0
            public DebugCycleInfo(DebugDialog dlg, GAB.FeatureGAB gab, int count)
            {
                this.cycleCount = count;
                this.gab        = gab;
                timer.Interval  = 1000;
                timer.Tick     += (a, b) =>
                {
                    dlg.Text = string.Format("Cycle {0} of {1}", cycleIndex + 1, cycleCount);
                    dlg.GarbageCollect();

                    if (((DebugInfo)dlg.Properties.SelectedObject).ActiveTasks == 0)
                    {
                        // Make sure the value is stable at zero
                        ++zeroCount;
                        if (zeroCount >= 3)
                        {
                            zeroCount = 0;
                            Logger.Instance.Debug(this, "CYCLER");
                            ++cycleIndex;

                            if (cycleIndex >= cycleCount)
                            {
                                timer.Stop();
                                dlg.Hide();
                                ThisAddIn.Instance.Quit(false);
                            }
                            else
                            {
                                DebugCycle();
                            }
                        }
                    }
                };
            }
コード例 #2
0
 /// <summary>
 /// Runs the specific number of cycles. In each cycle the GAB is resynced. This is to test
 /// memory errors, which show most frequently when using the GAB, as that touches most of
 /// the code.
 /// </summary>
 /// <param name="count">The number of cycles to run</param>
 internal void DebugCycle(int count)
 {
     GAB.FeatureGAB gab = ThisAddIn.Instance.GetFeature <GAB.FeatureGAB>();
     if (gab != null)
     {
         cycle = new DebugCycleInfo(this, gab, count);
         cycle.Run();
     }
 }