Page 1 of 1

Plugin settings values and event

PostPosted: Thu May 11, 2023 8:28 am
by odino87
As I mention in the other thread I'll open this one to ask for other code related info.

First one
in the plugin code I saw this code
public void Cyclethreadstart_event()
{
//MessageBox.Show("Cycle is starting...");
}

with this one I can intercept the cycle start event. Is there something similar to intercept the cycle stop event?

Second one:
in my software I usually save user preferences settings.
I use a settings file and I can save and load properties using a code like
Code: Select all
Properties.Settings1.Default.PROPERTY = VALUE;

I tried to write something like this but the value are not stored. I can load the default value I write in the settings file during the compilation, but I can't save the value at runtime (from UCCNC).
Is there anyway to use settings and properties in plugins? Am I missing somethings?

Re: Plugin settings values and event

PostPosted: Thu May 11, 2023 11:09 am
by eabrust
Hi Odino,

I use the .net settings in my plugins just fine from UCCNC.

After you assign a value to a setting, are you doing a final settings.save before you exit the plugin?

Code: Select all
Properties.Settings1.Default.Save;


In my plugins, I usually just regularly monitor the LEDs for feedhold, cyclestop, and reset as trigger to stop/abort. There may be better ways, but it works for me:

Code: Select all
 If  UC.GetLED(25) Or UC.GetLED(36) Or UC.GetLED(217) Or abortflag Then ' Check for feedhold and cycle stop and reset

                Abort()
                Exit Sub

            End If


regards
Eric

Re: Plugin settings values and event

PostPosted: Thu May 11, 2023 7:30 pm
by odino87
ok so regarding the status of the software, like cycle stop and other status, I need to implement monitoring instead of event handling like I usually do.

Regardin the setting I noticed a strange behaviour.
If I had just a file, Settings.settings, if I try to save the value they will not be stored.
But if I had another settings file, for example Settings1.setting, I can save the value in this second file just fine.
Don't know if it's a bug or something else.

edit: It was my fault... I thought I had connected the event code and the UI event caller but it wasn't... now the settings file work properly...
my bad.