public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; CurrentCapture?.Dispose(); }
/// <summary> /// 清理捕捉元件 /// </summary> private async Task CleanupCapture() { if (CurrentCapture != null) { // 若果正在錄制,則停止錄制 if (IsRecording) { await CurrentCapture.StopRecordAsync(); IsRecording = false; } CurrentCapture.Dispose(); CurrentCapture = null; } }
public async Task OnAppSuspending() { try { await SaveHistoryAsync(); if (IsPublishing) { await CurrentCapture.StopRecordAsync(); } IsPublishing = false; } catch (Exception ex) { } }
public void SetTarget(ICaptureTarget target) { if (IsDisposed) { throw new ObjectDisposedException(nameof(CaptureClient)); } if (CurrentCapture != null) { CurrentCapture.Dispose(); CurrentCapture = null; } if (target != null) { CurrentCapture = new Capture(target); CurrentCapture.Start(); CurrentTarget = target; } }
public Texture2D GetTexture() => CurrentCapture?.GetTexture();