private void doOnTickRun()
    {
        if (ontickUpdateBtn.Checked)
        {
            if (_compiledHandle != null)
            {
                setCompileRunResult(CSCompile.DoRun(_compiledHandle));
            }
        }

        if (_clerAreacb.Checked)
        {
            Function.Call(Hash.SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 0f);
            Function.Call(Hash.SET_PED_DENSITY_MULTIPLIER_THIS_FRAME, 0f);
            Function.Call(Hash.SET_PARKED_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME, 0f);
            var pos = Game.Player.Character.Position;
            Function.Call(Hash.SET_GARBAGE_TRUCKS, 0);
            Function.Call(Hash.CLEAR_AREA, pos.X, pos.Y, pos.Z, 9000f, 0, 0, 0, 0, 0);
            Function.Call(Hash.DELETE_ALL_TRAINS);
            Game.Player.WantedLevel = 0;

            Game.Player.Character.FreezePosition = true;
            Game.Player.Character.IsVisible      = false;
            Function.Call(Hash.DESTROY_MOBILE_PHONE);

            _mapCleared = true;
        }

        if (!_clerAreacb.Checked && _mapCleared)
        {
            _mapCleared = false;
            Game.Player.Character.FreezePosition = false;
            Game.Player.Character.IsVisible      = true;
        }

        if (_useEmptyMapCb.Checked)
        {
            if (!_mapRemoved)
            {
                var IPLs = File.ReadAllLines("MapList.txt");
                foreach (var ipl in IPLs)
                {
                    Function.Call(Hash.REMOVE_IPL, ipl);
                }
                _mapRemoved = true;
            }
        }
        else
        {
            if (_mapRemoved)
            {
                var IPLs = File.ReadAllLines("MapList.txt");
                foreach (var ipl in IPLs)
                {
                    Function.Call(Hash.REQUEST_IPL, ipl);
                }
                _mapRemoved = false;
            }
        }
    }
    private void updatePropertiesGrid()
    {
        if (_propMapData.Count == 0)
        {
            return;
        }

        //   StringBuilder sb = new StringBuilder();
        foreach (var key in _propMapData.Keys)
        {
            PropertyBoundItem propertyBoundItem = _propMapData[key];

            // Submit for compile/run
            if (propertyBoundItem.CompileHandle == null)
            {
                string errorText;
                propertyBoundItem.CompileHandle = CSCompile.DoCompile(propertyBoundItem.CodeBehind, out errorText);

                if (errorText != null)
                {
                    SetProp(key, "Compile Fail - See Output for Details");
                    _outputText.Text = errorText;
                    propertyBoundItem.CompileHandle = null;
                    continue;
                }
                else
                {
                    _outputText.Text = "Compiled Successfully";
                }
            }

            try
            {
                propertyBoundItem.RunResults = CSCompile.DoRun(propertyBoundItem.CompileHandle);
                SetProp(key, propertyBoundItem.RunResults);
            }
            catch (Exception ex)
            {
                SetProp(key, "Code Execution Fail on Row " + key + " - See Output for Details");
                _outputText.Text = ex.ToString();
            }
        }
        _propertyControlGrid.ClearSelection();
        _propertyControlGrid.Refresh();
    }
    private void doImmediateCompileRun()
    {
        try
        {
            string sourceCode;
            if ((sourceCode = DequeueImmediateSourceCode()) == null)
            {
                return;
            }

            string outVal = CSCompile.DoImmediateCompileRun(sourceCode);
            setCompileRunResult(outVal);
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex);
        }
    }
    private void doOnTickCompile()
    {
        string sourceCode;

        if ((sourceCode = DequeueOnTickSourceCode()) == null)
        {
            return;
        }

        string errorText;

        _compiledHandle = CSCompile.DoCompile(sourceCode, out errorText);

        if (errorText != null)
        {
            setCompileRunResult(errorText);
            _compiledHandle = null;
        }
    }