Browse Source

Fix part of #525

pull/505/merge
Daniel Grunwald 11 years ago
parent
commit
71e2387f0d
  1. 20
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

20
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -50,6 +50,7 @@ namespace ICSharpCode.FormsDesigner @@ -50,6 +50,7 @@ namespace ICSharpCode.FormsDesigner
readonly Control pleaseWaitLabel = new Label() { Text = StringParser.Parse("${res:Global.PleaseWait}"), TextAlign=ContentAlignment.MiddleCenter };
DesignSurface designSurface;
bool disposing;
Timer timer = new Timer { Interval = 200 };
readonly IViewContent primaryViewContent;
readonly IDesignerLoaderProvider loaderProvider;
@ -142,10 +143,11 @@ namespace ICSharpCode.FormsDesigner @@ -142,10 +143,11 @@ namespace ICSharpCode.FormsDesigner
this.IsActiveViewContentChanged += this.IsActiveViewContentChangedHandler;
timer.Tick += Timer_Tick;
FileService.FileRemoving += this.FileServiceFileRemoving;
SD.Debugger.DebugStarting += this.DebugStarting;
}
public FormsDesignerViewContent(IViewContent primaryViewContent, IDesignerLoaderProvider loaderProvider)
: this(primaryViewContent)
{
@ -168,6 +170,20 @@ namespace ICSharpCode.FormsDesigner @@ -168,6 +170,20 @@ namespace ICSharpCode.FormsDesigner
this.Files.Add(primaryViewContent.PrimaryFile);
}
void Timer_Tick(object sender, System.EventArgs e)
{
// The WinForms designer internally relies on Application.Idle for some actions, e.g. 'Show Code'
// This event does not get raised in a WPF application.
// While we do forward WPF's equivalent idle event to WinForms (see WorkbenchStartup.cs),
// it doesn't happen often enough -- in particular, it doesn't get raised while the mouse
// is over the WinForms design surface.
// This caused the bug: https://github.com/icsharpcode/SharpDevelop/issues/525
// As a workaround, we use a timer to raise the event while the designer is open.
// Note: this timer is implemented in the WinForms designer and not globally in SharpDevelop
// so that we don't wake up the CPU unnecessarily when the designer is not in use.
Application.RaiseIdle(e);
}
bool inMasterLoadOperation;
protected override void LoadInternal(OpenedFile file, System.IO.Stream stream)
@ -344,6 +360,7 @@ namespace ICSharpCode.FormsDesigner @@ -344,6 +360,7 @@ namespace ICSharpCode.FormsDesigner
UpdatePropertyPad();
hasUnmergedChanges = false;
timer.Start();
LoggingService.Info("Form Designer: END INITIALIZE");
}
@ -404,6 +421,7 @@ namespace ICSharpCode.FormsDesigner @@ -404,6 +421,7 @@ namespace ICSharpCode.FormsDesigner
{
LoggingService.Debug("FormsDesigner unloading, setting ActiveDesignSurface to null");
designSurfaceManager.ActiveDesignSurface = null;
timer.Stop();
bool savedIsDirty = (this.DesignerCodeFile == null) ? false : this.DesignerCodeFile.IsDirty;
this.UserContent = this.pleaseWaitLabel;

Loading…
Cancel
Save