Beispiel #1
0
        private bool Connect(string host, int port)
        {
            string dbFile = m_resultsFileTextBox.Text;

            //connect to data engine before launching the process -- we don't want to launch if this fails
            IDataEngine storage = null;

            try
            {
                //storage = new SqlServerCompactEngine(dbFile, true);
                if (SQLiteRadio.Checked)
                {
                    storage = new SQLiteEngine(dbFile, true);
                }
                else if (SQLiteMemoryRadio.Checked)
                {
                    storage = new SQLiteMemoryEngine();
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            ConnectProgress progress = new ConnectProgress(host, port, storage, 10);

            progress.ShowDialog(this);

            if (progress.Client != null)
            {
                Connection conn = new Connection(storage);
                conn.RunClient(progress.Client);
                conn.SetAutoSnapshots(10000, false);

                var profilerWindow = new ProfilerWindow(m_mainWindow, conn);
                profilerWindow.Show();

                TypeEntry visEntry = m_visualizerCombo.SelectedItem as TypeEntry;
                if (visEntry != null && visEntry.Type != null)
                {
                    profilerWindow.AddVisualizer(visEntry.Type);
                }

                profilerWindow.BringToFront();
            }
            else
            {
                storage.Dispose();
                return(false);
            }

            return(true);
        }
Beispiel #2
0
		private bool Connect(string host, int port)
		{
			string dbFile = m_resultsFileTextBox.Text;

			//connect to data engine before launching the process -- we don't want to launch if this fails
			IDataEngine storage = null;
			try
			{
				//storage = new SqlServerCompactEngine(dbFile, true);
				if(SQLiteRadio.Checked)
					storage = new SQLiteEngine(dbFile, true);
				else if(SQLiteMemoryRadio.Checked)
					storage = new SQLiteMemoryEngine();
				else
					throw new NotImplementedException();
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return false;
			}

			ConnectProgress progress = new ConnectProgress(host, port, storage, 10);
			progress.ShowDialog(this);

			if(progress.Client != null)
			{
				Connection conn = new Connection(storage);
				conn.RunClient(progress.Client);
				conn.SetAutoSnapshots(10000, false);

				var profilerWindow = new ProfilerWindow(m_mainWindow, conn);
				profilerWindow.Show();

				TypeEntry visEntry = m_visualizerCombo.SelectedItem as TypeEntry;
				if(visEntry != null && visEntry.Type != null)
					profilerWindow.AddVisualizer(visEntry.Type);

				profilerWindow.BringToFront();
			}
			else
			{
				storage.Dispose();
				return false;
			}

			return true;
		}
Beispiel #3
0
        private bool LaunchLocal()
        {
            string dbFile = m_resultsFileTextBox.Text;

            if (!m_launcher.CheckParams())
            {
                return(false);
            }

            //connect to data engine before launching the process -- we don't want to launch if this fails
            IDataEngine data = null;

            if (m_connectCheckBox.Checked)
            {
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    if (m_sqliteRadio.Checked)
                    {
                        data = new SQLiteEngine(dbFile, true);
                    }
                    else if (m_sqliteMemoryRadio.Checked)
                    {
                        data = new SQLiteMemoryEngine();
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }

            if (!m_launcher.Launch())
            {
                if (data != null)
                {
                    data.Dispose();
                }
                return(false);
            }

            //connect, if we're asked to
            if (m_connectCheckBox.Checked)
            {
                ConnectProgress progress = new ConnectProgress("localhost", m_launcher.ListenPort, data, 10);
                progress.ShowDialog(this);

                if (progress.Client != null)
                {
                    Connection conn = new Connection(data);
                    conn.Executable = m_launcher.Name;
                    conn.RunClient(progress.Client);
                    //TODO: set options like auto snapshot frequency
                    conn.SetAutoSnapshots(10000, false);

                    var profilerWindow = new ProfilerWindow(m_mainWindow, conn);
                    profilerWindow.Show();

                    TypeEntry visEntry = m_visualizerCombo.SelectedItem as TypeEntry;
                    if (visEntry != null && visEntry.Type != null)
                    {
                        profilerWindow.AddVisualizer(visEntry.Type);
                    }

                    profilerWindow.BringToFront();
                }
                else
                {
                    //connection failed, shut down the storage
                    data.Dispose();
                }
            }

            return(true);
        }
Beispiel #4
0
		private bool LaunchLocal()
		{
			string dbFile = m_resultsFileTextBox.Text;

			if(!m_launcher.CheckParams())
				return false;

			//connect to data engine before launching the process -- we don't want to launch if this fails
			IDataEngine data = null;
			if(m_connectCheckBox.Checked)
			{
				try
				{
					this.Cursor = Cursors.WaitCursor;
					if(m_sqliteRadio.Checked)
						data = new SQLiteEngine(dbFile, true);
					else if(m_sqliteMemoryRadio.Checked)
						data = new SQLiteMemoryEngine();
					else
						throw new NotImplementedException();
				}
				catch(Exception ex)
				{
					MessageBox.Show(ex.Message, "Launch Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
					return false;
				}
				finally
				{
					this.Cursor = Cursors.Default;
				}
			}

			if(!m_launcher.Launch())
			{
				if(data != null)
					data.Dispose();
				return false;
			}

			//connect, if we're asked to
			if(m_connectCheckBox.Checked)
			{
				ConnectProgress progress = new ConnectProgress("localhost", m_launcher.ListenPort, data, 10);
				progress.ShowDialog(this);

				if(progress.Client != null)
				{
					Connection conn = new Connection(data);
					conn.Executable = m_launcher.Name;
					conn.RunClient(progress.Client);
					//TODO: set options like auto snapshot frequency
					conn.SetAutoSnapshots(10000, false);

					var profilerWindow = new ProfilerWindow(m_mainWindow, conn);
					profilerWindow.Show();

					TypeEntry visEntry = m_visualizerCombo.SelectedItem as TypeEntry;
					if(visEntry != null && visEntry.Type != null)
						profilerWindow.AddVisualizer(visEntry.Type);

					profilerWindow.BringToFront();
				}
				else
				{
					//connection failed, shut down the storage
					data.Dispose();
				}
			}

			return true;
		}