public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }
            IsDisposed = true;

            CurrentCapture?.Dispose();
        }
예제 #2
0
파일: App.xaml.cs 프로젝트: jtlai0921/-02
        /// <summary>
        /// 清理捕捉元件
        /// </summary>
        private async Task CleanupCapture()
        {
            if (CurrentCapture != null)
            {
                // 若果正在錄制,則停止錄制
                if (IsRecording)
                {
                    await CurrentCapture.StopRecordAsync();

                    IsRecording = false;
                }
                CurrentCapture.Dispose();
                CurrentCapture = null;
            }
        }
예제 #3
0
        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();