Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…lect project resource as form icon: "This operation can be called on the main thread only"
  • Loading branch information
dgrunwald committed Sep 28, 2010
1 parent 1876bf4 commit eedd9dd
Showing 1 changed file with 10 additions and 5 deletions.
Expand Up @@ -17,6 +17,7 @@
using ICSharpCode.FormsDesigner.Services;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;

namespace ICSharpCode.FormsDesigner.Gui
Expand Down Expand Up @@ -369,11 +370,15 @@ static TreeNode GetOrCreateDirectoryNode(TreeNode root, string directory)

Dictionary<string, object> GetResources(string fileName)
{
Stream s;
OpenedFile file = FileService.GetOpenedFile(fileName);
if (file != null) {
s = file.OpenRead();
} else {
Stream s = null;
WorkbenchSingleton.SafeThreadCall(
delegate {
OpenedFile file = FileService.GetOpenedFile(fileName);
if (file != null) {
s = file.OpenRead();
}
});
if (s == null) {
s = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
}
using(s) {
Expand Down

0 comments on commit eedd9dd

Please sign in to comment.