[Mono-bugs] [Bug 412536] [PATCH] Timers tick before Form.OnLoad is called

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 13 01:48:23 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=412536

User awunwpa7 at yahoo.com.ph added comment
https://bugzilla.novell.com/show_bug.cgi?id=412536#c2


Steve Odbc <awunwpa7 at yahoo.com.ph> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |awunwpa7 at yahoo.com.ph
            Summary|Timers tick before Form.OnLoad is called        |[PATCH] Timers tick before Form.OnLoad is called




--- Comment #2 from Steve Odbc <awunwpa7 at yahoo.com.ph>  2008-10-12 23:48:23 MDT ---
Possible Patch:

In MONO, the Form class has a private field that is called "is_loaded". You
might check it from the FireTick() method of the Timer, using the following
reflection code:

internal void FireTick ()
{
  EventHandler SavedOnTick = OnTick;

  if (SavedOnTick != null)
  {
    object TargetClass = SavedOnTick.Target;

    if (TargetClass.GetType().IsSubclassOf(typeof(Form)))
    {
      FieldInfo IsLoadedField = typeof(Form).GetField("is_loaded",
                                                      BindingFlags.Instance |
                                                      BindingFlags.NonPublic);

      // are we ready yet?
      if (!(bool)IsLoadedField.GetValue(TargetClass)) return;
    }

    SavedOnTick (EventArgs.Empty);
  }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list