Updating from eto.forms dialog

I am very new to using eto.forms, but am trying to test something simple out before I go to far with it.

The goal is to have eto dialog pop up so that others can use a grasshopper script and select which geometry they are working with without getting too far into it, with variables being passed into the dialog from my grasshopper script.

I have got it working with a dropdown list being populated from grasshopper, but cannot get variables to update without closing the dialog box, is it possible? Or am I barking up the wrong tree?

I know that I can use something like Human or Synapse, but would rather solve it without another plugin if I can avoid it.

Here is my cobbled together code:

import Rhino
import scriptcontext
import System
import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms

class SlopeWindow(forms.Dialog[bool]):
    def __init__(self):
        super(SlopeWindow, self).__init__()

        self.Title = 'Controls for slopes'
        self.Padding = drawing.Padding(15)
        self.Resizable = False

        # list box label
        self.m_label = forms.Label()
        self.m_label.Text = 'Which curve?'

        # list box - which curve
        self.m_listbox = forms.ListBox()
        self.m_listbox.DataStore = x
        self.m_listbox.SelectedIndex = 0

        # ok button to select the curve
        self.DefaultButton = forms.Button()
        self.DefaultButton.Text = 'OK'
        self.DefaultButton.Click += self.OnOKButtonClick

        # Create the abort button
        self.AbortButton = forms.Button()
        self.AbortButton.Text = 'Cancel'
        self.AbortButton.Click += self.OnCloseButtonClick

        # Try to bring it together
        layout = forms.DynamicLayout()
        layout.Spacing = drawing.Size(5, 5)
        layout.AddRow(self.m_label, self.m_listbox)
        layout.AddRow(None) # spacer
        layout.AddRow(self.DefaultButton, self.AbortButton)

        # Set dialog content
        self.Content = layout

    # Listen to the window
    def GetListValue(self):
        return self.m_listbox.SelectedValue

    def GetListIndex(self):
        return self.m_listbox.SelectedIndex

    # Close button click handler
    def OnCloseButtonClick(self, sender, e):
        self.Close(False)

    # OK button clicker
    def OnOKButtonClick(self, sender, e):
        if self.m_listbox.SelectedValue == "":
            self.Close(False)
        else:
            global a
            global b
            a = self.GetListValue()  # Update the variable 'a'
            b = self.GetListIndex()
            self.Close(True)

def GetLine():
    dialog = SlopeWindow()
    rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
    if rc:
        print("Selected curve:", a)

if __name__ == "__main__":
    x = ["c1", "c2", "c3"]  # just for testing - gets passed in from grasshopper otherwise
    a = None
    b = None
    GetLine()