Detect closing Repetier-Host

Hi!

I'm developing a webcam controller for Repetier-Host, using their Plugin development skills.

I can choose, open and close my webcams using my Plugin; but if I close directly Repetier-Host (using X windows button), my webcam still open. So I would like to introduce the "webcam-closing-command" in the "closing-RepetierHost" routine.

How do I do? With a event handler?

A simply code capture: https://ibb.co/fYX2402

Thanks :)

Comments

  • On closing the host sends the event "core:closing" so just register a function for that event like
    RegisterNamedEvent("core:printerSettingsChanged", UpdateScripts);

  • Repetier said:
    On closing the host sends the event "core:closing" so just register a function for that event like
    RegisterNamedEvent("core:printerSettingsChanged", UpdateScripts);


    Thanks for your reply! :)

    I've implemented this script as: https://ibb.co/WgcyFVG

    * I want to active the event core:closing
    * My webcam closing function is: arcadi.ClosingWebCam()

    The "UpdateScripts" as you have defined is a "FunctionStringObject(string function, object val)". But I don't know the second argument of "FunctionStringObject", its defined as "object val"... What do I have to put? I've tried diferents types of variables (int, string...).

    Thanks!
  • To keep in my example make the target function look like this:
    void UpdateScripts(string evt, object data)

    c# will do the rest. You won't use the second argument here. There are some events where they contain event specific content and need to be cast to right type. here just ignor eit.
  • Perfect!!! It works :)

    The code is (if it helps someone):

    ------------------------------
    public void PreInitilaize(IHost _host)
    {
       host=_host;
       host.RegisterNameEvent("core:closing", ClosingApplication_Event);
    }

    void ClosingApplication_Event(string evt, object data)
     {
       webcam.ClosingWebCam();
    }

    ------------------------------

    Thanks
Sign In or Register to comment.