public static void Close() { if (_state == State.Running || _state == State.Initialized) { _state = State.Terminated; _sc.Post((obj) => { _dialogBox.Close(); }, null); } }