예제 #1
0
 public static void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dialog = new OpenFileDialog())
     {
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             Top top = DataRegistry.QueryAddref(dialog.FileName);
             if (top == null)
             {
                 top = OutOfPhaseTraceScheduleAnalyzer.Top.Read(
                     dialog.FileName,
                     new FileStream(dialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read));
                 DataRegistry.Add(dialog.FileName, top);
             }
             new VisualizerForm(top, dialog.FileName).Show();
         }
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            #region Debugger Attach Helper
            {
                bool waitDebugger = false;
                if ((args.Length > 0) && String.Equals(args[0], "-waitdebugger"))
                {
                    waitDebugger = true;
                    Array.Copy(args, 1, args, 0, args.Length - 1);
                    Array.Resize(ref args, args.Length - 1);
                }

                bool debuggerBreak = false;
                if ((args.Length > 0) && String.Equals(args[0], "-break"))
                {
                    debuggerBreak = true;
                    Array.Copy(args, 1, args, 0, args.Length - 1);
                    Array.Resize(ref args, args.Length - 1);
                }

                if (waitDebugger)
                {
                    while (!Debugger.IsAttached)
                    {
                        System.Threading.Thread.Sleep(100);
                    }
                }
                if (debuggerBreak)
                {
                    Debugger.Break();
                }
            }
            #endregion

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Idle += new EventHandler(
                delegate(object sender, EventArgs e)
            {
                if (Application.OpenForms.Count == 0)
                {
                    Application.Exit();
                }
            });

            if (args.Length == 0)
            {
                using (OpenFileDialog dialog = new OpenFileDialog())
                {
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        args = new string[] { dialog.FileName };
                    }
                }
            }

            foreach (string arg in args)
            {
                Top top = DataRegistry.QueryAddref(arg);
                if (top == null)
                {
                    top = Top.Read(
                        arg,
                        new FileStream(arg, FileMode.Open, FileAccess.Read, FileShare.Read));
                    DataRegistry.Add(arg, top);
                }
                new VisualizerForm(top, arg).Show();
            }

            Application.Run();
        }
예제 #3
0
 protected override void OnFormClosed(FormClosedEventArgs e)
 {
     base.OnFormClosed(e);
     DataRegistry.Release(top);
 }