Browse Source

added workaround to fix http://community.sharpdevelop.net/forums/p/10063/27905.aspx

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4911 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
b6fcec94d0
  1. 19
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs

19
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/WpfViewer.cs

@ -5,11 +5,11 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using ICSharpCode.Core;
using System; using System;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Integration; using System.Windows.Forms.Integration;
using ICSharpCode.Core.Presentation; using ICSharpCode.Core.Presentation;
using ICSharpCode.Profiler.Controller.Data; using ICSharpCode.Profiler.Controller.Data;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
@ -54,7 +54,15 @@ namespace ICSharpCode.Profiler.AddIn.Views
/// </summary> /// </summary>
public WpfViewer(OpenedFile file) public WpfViewer(OpenedFile file)
{ {
// HACK : OpenedFile architecture does not allow to keep files open
// but it is necessary for the ProfilerView to keep the session file open.
// We don't want to load all session data into memory.
// this.Files.Add(file); // this.Files.Add(file);
// HACK : The file is not recognised by the FileService for closing if it is deleted while open.
// (reason see above comment)
FileService.FileRemoving += FileServiceFileRemoving;
this.file = file; this.file = file;
this.provider = ProfilingDataSQLiteProvider.FromFile(file.FileName); this.provider = ProfilingDataSQLiteProvider.FromFile(file.FileName);
this.TabPageText = Path.GetFileName(file.FileName); this.TabPageText = Path.GetFileName(file.FileName);
@ -69,6 +77,13 @@ namespace ICSharpCode.Profiler.AddIn.Views
); );
} }
void FileServiceFileRemoving(object sender, FileCancelEventArgs e)
{
if (FileUtility.IsEqualFileName(e.FileName, file.FileName) ||
FileUtility.IsBaseDirectory(e.FileName, file.FileName))
this.WorkbenchWindow.CloseWindow(true);
}
/// <summary> /// <summary>
/// Refreshes the view /// Refreshes the view
/// </summary> /// </summary>
@ -86,6 +101,8 @@ namespace ICSharpCode.Profiler.AddIn.Views
this.dataView.SaveUserState(); this.dataView.SaveUserState();
this.host.Dispose(); this.host.Dispose();
this.provider.Close(); this.provider.Close();
FileService.FileRemoving -= FileServiceFileRemoving;
base.Dispose(); base.Dispose();
} }
} }

Loading…
Cancel
Save