Rhino 8 Feature: ScriptEditor (CPython, CSharp)

Hello, this’s a amazing work. How can I use ghenv.Component in RhinoCode? I want to write a scripts like this ExpireSolution in GhPython, but it shows “ghenv not defined”. Looking forward to your reply, Thanks!

from scriptcontext import sticky

thisDoc = ghenv.Component.OnPingDocument()
slider = ghenv.Component.Params.Input[0].Sources[0]

if click_me:
    # reset values to starting position
    sticky['running'] = True
    slider.TickValue = 30 

desired_area = 12
if sticky['running']:
    if area > desired_area or slider.TickValue >= slider.TickCount:
        sticky['running'] = False # break the loop
    else:
        def sln_delegate(doc):
            slider.TickValue +=1 
        thisDoc.ScheduleSolution(1, sln_delegate) # call the delegate function and schedule a solution in 1 millisecond