private void SetPauseState(bool focus, bool pause) { if (focus && !pause) { //唤醒 BeSleep = false; if (BeShowLog) { Debug.Log("[nafio-net]--->唤醒"); } ResumeEvent?.Invoke(); } if (!focus && pause) { if (BeShowLog) { Debug.Log("[nafio-net]--->睡眠"); } //睡 BeSleep = true; SleepEvent?.Invoke(); } }
/// <summary> /// 恢复按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void resume_Click(object sender, EventArgs e) { if (running) //运行中 { if (pausing) //暂停中 { ResumeEvent?.Invoke(); pausing = false; pause.Enabled = true; } else { return; } } else { return; } }
protected virtual void OnResumeEvent(EventArgs args) { ResumeEvent?.Invoke(this, args); }