示例#1
0
 private void frmSSASDiag_Resize(object sender, EventArgs e)
 {
     btnSettings.Left = Width - btnSettings.Width - 15;
     lkAbout.Top      = lkBugs.Top = lkDiscussion.Top = lkFeedback.Top = Height - 56;
     tcCollectionAnalysisTabs.Height = Height - 59;
     tcAnalysis.Height                    = Height - 119;
     btnImportProfilerTrace.Left          = Width / 2 - btnImportProfilerTrace.Width / 2;
     splitProfilerAnalysis.Height         = Height - 232;
     txtProfilerAnalysisQuery.Width       = Width - 254;
     lblProfilerAnalysisStatusCenter.Left = Width / 2 - lblProfilerAnalysisStatusCenter.Width / 2;
     if (tcAnalysis.TabPages.ContainsKey("Network Trace") || HiddenTabPages.Where(t => t.Name == "Network Trace").Count() > 0)
     {
         Button btnAnalyzeNetworkTrace = tcAnalysis.TabPages.ContainsKey("Network Trace") ?
                                         tcAnalysis.TabPages["Network Trace"].Controls["btnAnalyzeNetworkTrace"] as Button :
                                         HiddenTabPages.First(t => t.Name == "Network Trace").Controls["btnAnalyzeNetworkTrace"] as Button;
         btnAnalyzeNetworkTrace.Left = Width / 2 - btnAnalyzeNetworkTrace.Width / 2;
     }
     // Expand last column of profiler analysis grid
     if (dgdProfilerAnalyses.Columns.Count > 0)
     {
         if (dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].AutoSizeMode == DataGridViewAutoSizeColumnMode.None)
         {
             dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
         }
         if (dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].Width < 80)
         {
             dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
         }
         dgdProfilerAnalyses.Refresh();
         int lastCellFullHeaderWidth = dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].Width;
         dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
         dgdProfilerAnalyses.Columns[dgdProfilerAnalyses.Columns.Count - 1].Width        = lastCellFullHeaderWidth;
     }
 }
示例#2
0
        private void frmSSASDiag_Load(object sender, EventArgs e)
        {
            InitializeArgs();
            SetupDebugTrace();

            if (!(Environment.OSVersion.Version.Major >= 7 || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 1)) && Environment.UserInteractive)
            {
                if (Environment.UserInteractive && bFullyInitialized)
                {
                    MessageBox.Show("Network trace collection requires\nWindows 7 or Server 2008 R2 or greater.\nPlease upgrade your OS to use that feature.", "SSAS Diagnotics Network Trace Incompatibility Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                chkGetNetwork.Enabled = false;
            }

            imgPlay.Tag      = "Play"; imgPlayLit.Tag = "Play Lit"; imgPlayHalfLit.Tag = "Play Half Lit"; imgStop.Tag = "Stop"; imgStopLit.Tag = "Stop Lit"; imgStopHalfLit.Tag = "Stop Half Lit";
            btnCapture.Image = imgPlay;
            if (AppDomain.CurrentDomain.GetData("originalbinlocation") as string != null)
            {
                Environment.CurrentDirectory = AppDomain.CurrentDomain.GetData("originalbinlocation") as string;
            }
            else
            {
                Hide();
                MessageBox.Show("The tool cannot run from its own temp directory, used internally.  Please run from another location.", "App cannot run from its own temp location - by design", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            if (!Args.ContainsKey("outputdir") && Properties.Settings.Default["SaveLocation"] as string != Environment.CurrentDirectory && Properties.Settings.Default["SaveLocation"] as string != "")
            {
                Environment.CurrentDirectory = Properties.Settings.Default["SaveLocation"] as string;
            }
            if (Args.ContainsKey("outputdir"))
            {
                Environment.CurrentDirectory = Args["outputdir"];
            }

            PopulateInstanceDropdown();

            if (Args.ContainsKey("stoptime"))
            {
                chkStopTime.Checked = true;
                try { dtStopTime.Value = Convert.ToDateTime(Args["stoptime"]); }
                catch { chkStopTime.Checked = false; }
            }
            else
            {
                dtStopTime.Value = DateTime.Now.AddHours(1);
            }
            dtStopTime.MinDate       = DateTime.Now.AddMinutes(1);
            dtStopTime.CustomFormat += TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours > 0 ? "+"
                                       + TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours.ToString() : TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours.ToString();
            dtStartTime.CustomFormat = dtStopTime.CustomFormat;
            dtStartTime.MinDate      = DateTime.Now;
            dtStartTime.MaxDate      = DateTime.Now.AddDays(30);
            if (Args.ContainsKey("starttime"))
            {
                chkStartTime.Checked = true;
                try { dtStartTime.Value = Convert.ToDateTime(Args["starttime"]); }
                catch { chkStartTime.Checked = false; }
            }

            // UI timer to enable detection of fast/slow scroll to avoid messagebox if fast sliding past middle setting...
            tmScrollStart.Interval = 250;
            tmScrollStart.Tick    += tmLevelOfDataScroll_Tick;
            frmSSASDiag_Resize(this, e);

            foreach (TabPage t in tcAnalysis.TabPages)
            {
                HiddenTabPages.Add(t);
            }
            for (int i = 0; i < tcAnalysis.TabPages.Count; i++)
            {
                tcAnalysis.TabPages.RemoveAt(0);
            }

            txtSaveLocation.Text = Environment.CurrentDirectory;

            AnalysisMessagePumpTimer.Tick        += AnalysisMessagePumpTimer_Tick;
            AnalysisQueryExecutionPumpTimer.Tick += AnalysisQueryExecutionPumpTimer_Tick;

            if (!Args.ContainsKey("zip") && Args.Count > 0)
            {
                chkZip.Checked = false;
            }
            if (Args.ContainsKey("deleteraw"))
            {
                chkDeleteRaw.Checked = true;
            }

            if (!Args.ContainsKey("rollover") && Args.Count > 0)
            {
                chkRollover.Checked = false;
            }
            else
            {
                try { udRollover.Value = Convert.ToInt32(Args["rollover"]); }
                catch {  }
            }

            if (Args.ContainsKey("autorestartprofiler") && Args.ContainsKey("stoptime"))
            {
                chkAutoRestart.Checked = true;
            }

            if (Args.ContainsKey("perfmoninterval"))
            {
                try { udInterval.Value = Convert.ToInt32(Args["perfmoninterval"]); }
                catch { }
            }
        }