How to find out if the skin engine is ready? (1 Viewer)

Lightning303

MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    Hey,
    i have the following problem.

    In our plugin AtmoLight, during MP startup, AtmoLight tries to connect to other services like AtmoWin or a RaspberryPi, if this connection fails, AtmoLight displays a GUIDialogOK to tell the user that connecting failed.
    If this dialog gets called before MP is ready to display it (still on splashscreen), MP just freezes. So you can see the splashscreen that is saying "Starting plugins" and thats it.

    So i want to know how i can check if the MP gui is actually ready to display a dialog, so this wont happen.

    I already tried:

    Code:
    GUIWindowManager.Initalized
    Doesnt work, as it return true even if the splashscreen is still on.

    Code:
    GUIGraphicsContext.CurrentState
    Also doesnt work, as it returns RUNNING even if the splashscreen is still on.

    Also tried some others but had no luck with any of them.

    Thanks!
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    do not can check for the process of MP ?
    Keyword "WaitForInputIdle"

    Doesnt seem to work :(
    I tried getting the mp process and then waiting with this:

    Code:
    Process myProcess = Process.GetCurrentProcess();
    myProcess.WaitForInputIdle();

    but i just get this exception:
    System.InvalidOperationException: Fehler bei WaitForInputIdle. Möglicherweise hat der Prozess keine grafische Schnittstelle.

    However i think i was able to fix another problem with WaitForInputIdle :). Thank you!
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    I dont have an idle loop.
    All i want is to check if MP has finished loading when i try to open a dialog, so MP wont crash/freeze.

    Something like this:

    Code:
    private void MyMethod()
    {
      // Check if MP is ready
    
      GUIDialogOK myDialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
      ...
      ...
    }

    So i now tried this:
    Code:
    private void MyMethod()
    {
     
      Process myProcess = Process.GetCurrentProcess();
      myProcess.Refresh();
      myProcess.WaitForInputIdle();
    
      GUIDialogOK myDialog = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
      ...
      ...
    }

    And that throws the exception i quoted above.
     

    Users who are viewing this thread

    Top Bottom