示例#1
0
		private void ProfilerControl_Closed(object sender, EventArgs e)
		{
			if(delegatorObj!=null)
				System.Runtime.InteropServices.Marshal.ReleaseComObject(delegatorObj);
			try
			{
				SharpClientForm.profilerTable.Remove(this.pid);   
			}
			catch{}
			finally
			{
				bQuit=true;
			}
			TryKill();	
			try
			{
				try
				{
					this.Visible=false;					
				}
				catch{}
				Application.DoEvents();
				if(lastFile!=null && MessageBox.Show("Do you want to open the last saved profiling results now?","Open Last Results?",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
				{					 
					if(configString=="PERFORMANCE_ANALYSIS")
					{
						if(!lastFile.Trim().ToLower().EndsWith(".fxml"))
						{
							lastFile+=".fxml";
						}
					}
					else if(configString=="MEMORY_ANALYSIS")
					{
						if(!lastFile.Trim().ToLower().EndsWith(".oxml"))
						{
							lastFile+=".oxml";
						}
					}
					if(System.IO.File.Exists(lastFile))
					{
						SharpClientTabPage newResultsTab=new SharpClientTabPage("Loading...",lastFile ); 				
						newResultsTab.Dock =DockStyle.Fill ;
						SharpClientForm.scInstance.sharpClientMDITab.TabPages.Add(newResultsTab); 
						SharpClientForm.scInstance.sharpClientMDITab.SelectedTab =newResultsTab ;
						newResultsTab.Show();   
					}
				}
			}
			catch{}

		}
示例#2
0
		private void SharpClientForm_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			if(e.Data.GetDataPresent(DataFormats.FileDrop) )
			{
				string[] files=e.Data.GetData(DataFormats.FileDrop) as string[] ;
				try
				{
					foreach (string fileName in files)
					{
						Application.DoEvents();
						if(fileName.ToLower().EndsWith(".oxml"))
						{							
							SharpClientTabPage objectTab=new SharpClientTabPage("Loading...",fileName ); 				
							objectTab.Dock =DockStyle.Fill ;
							this.sharpClientMDITab.TabPages.Add(objectTab); 
							this.sharpClientMDITab.SelectedTab =objectTab ;
							objectTab.Show();   
						}
						else if(fileName.ToLower().EndsWith(".fxml"))
						{
							SharpClientTabPage functionTab=new SharpClientTabPage("Loading...",fileName  ); 				
							functionTab.Dock =DockStyle.Fill ;
							this.sharpClientMDITab.TabPages.Add(functionTab); 
							this.sharpClientMDITab.SelectedTab =functionTab ;
							functionTab.Show(); 
						}
						else
						{
							throw new Exception("Unrecognized file format."); 
						}
						Application.DoEvents();
						break;//we only want to open 1 file at a time.

					}
				}
				catch(Exception except)
				{
					MessageBox.Show("ProfileSharp was unable to open one or more files specified.\n"+except.Message,"Error in opening file!",MessageBoxButtons.OK,MessageBoxIcon.Error)   ;
				}
			}
			
		}
示例#3
0
		private void OpenMemorySession()
		{
			openProfilerSession.Title ="Open Memory Analysis Session File";
			openProfilerSession.Filter ="Memory Analysis files(*.oxml)|*.oxml";
			openProfilerSession.RestoreDirectory =true;
			if(openProfilerSession.ShowDialog() ==DialogResult.OK)
			{
				SharpClientTabPage objectTab=new SharpClientTabPage("Loading...",openProfilerSession.FileName ); 				
				objectTab.Dock =DockStyle.Fill ;
				this.sharpClientMDITab.TabPages.Add(objectTab); 
				this.sharpClientMDITab.SelectedTab =objectTab ;
				objectTab.Show();   
			}
		}
示例#4
0
		private void OpenPerformanceSession()
		{
			openProfilerSession.Title ="Open Performance Analysis Session File";
			openProfilerSession.Filter ="Performance Analysis files(*.fxml)|*.fxml";
			openProfilerSession.RestoreDirectory =true;
			if(openProfilerSession.ShowDialog() ==DialogResult.OK)
			{				
				SharpClientTabPage functionTab=new SharpClientTabPage("Loading...",openProfilerSession.FileName ); 				
				functionTab.Dock =DockStyle.Fill ;
				this.sharpClientMDITab.TabPages.Add(functionTab); 
				this.sharpClientMDITab.SelectedTab =functionTab ;
				functionTab.Show(); 
			}	
		}
示例#5
0
		private void SharpClientForm_Load(object sender, System.EventArgs e)
		{	
			
			try
			{

				psStatusBar.Panels[0].Icon=this.Icon;  
				psStatusBar.Panels[0].Text="Welcome to ProfileSharp. The .NET Code, Performance and Memory Profiler by SoftProdigy.";
				Application.DoEvents();  
				splashForm=new SplashForm();
				splashForm.Show();  
				Application.DoEvents(); 		
				this.Cursor =Cursors.WaitCursor ;
				Application.DoEvents(); 
				
				try
				{
					Configurator.RestoreDefaultConfiguration();
				}
				catch{}			
											
				try
				{
					FunctionImporter.DeleteCache("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Application.StartupPath+@"\SharpBase.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False;",true); 
				}
				catch{}
				try
				{
					ObjectImporter.DeleteCache("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Application.StartupPath+@"\SharpBase.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False;",true); 
				}
				catch{}				
				Application.DoEvents();  
				if(CanCompact())
				{
					CompactDB(); 
				}
				System.Threading.Thread.Sleep(3000);   
				
			}
			catch
			{
				if(splashForm!=null)
				{
					try
					{
						splashForm.Close();
						splashForm.Dispose();
						splashForm=null;
						Application.DoEvents();  
					}
					catch{}
				}				
			}
			finally
			{			
				this.Cursor=Cursors.Arrow ;  
				SharpClientForm.scInstance.AddStackControlTab("Profiler-Options","Profiler-Options",12,SharpClient.UI.Docking.State.DockLeft,"Choose an option","Profile desktop application.||Profile windows service.||Profile ASP.NET||Profile COM+ application.||Open performance results.||Open memory results.||Compare two memory snapshots.||Report a bug.||Suggest a feature.||Ask for a customization.||View help file.||ProfileSharp license agreement.||Check for updates.||About us.","\nPlease choose an action to perform\nwith ProfileSharp." ,-1,true,false);
				
				if(splashForm!=null)
				{
					try
					{
						splashForm.Close();
						splashForm.Dispose();
						splashForm=null;
						Application.DoEvents();  
					}
					catch{}
				}
 
			}
			/////////Auto Attach Start Thread
			Application.DoEvents();  
			profileeThread = new System.Threading.Thread(new System.Threading.ThreadStart(refreshProcessView));
			profileeThread.Start();

			//////////////////
		
			if (SharpClientForm.arguments!=null &&   SharpClientForm.arguments.Length>0)
			{
				try
				{
					foreach (string fileName in SharpClientForm.arguments)
					{
						Application.DoEvents();
						if(fileName.ToLower().EndsWith(".oxml"))
						{							
							SharpClientTabPage objectTab=new SharpClientTabPage("Loading...",fileName ); 				
							objectTab.Dock =DockStyle.Fill ;
							this.sharpClientMDITab.TabPages.Add(objectTab); 
							this.sharpClientMDITab.SelectedTab =objectTab ;
							objectTab.Show();   
						}
						else if(fileName.ToLower().EndsWith(".fxml"))
						{
							SharpClientTabPage functionTab=new SharpClientTabPage("Loading...",fileName  ); 				
							functionTab.Dock =DockStyle.Fill ;
							this.sharpClientMDITab.TabPages.Add(functionTab); 
							this.sharpClientMDITab.SelectedTab =functionTab ;
							functionTab.Show(); 
						}
						Application.DoEvents();
						break;//we only want to open 1 file at a time.

					}
				}										
				catch(Exception except)
				{					
					MessageBox.Show("ProfileSharp was unable to open one or more files specified.\n"+except.Message,"Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)   ;
				}			

			}
			
		}