Exemple #1
0
        public async Task <GraphicsCaptureItemWrapper> UserSelectAsync(IntPtr hwnd)
        {
            var picker = new GraphicsCapturePicker();

            picker.SetWindow(hwnd);
            var item = await picker.PickSingleItemAsync();

            return(item != null ? new GraphicsCaptureItemWrapper(item, "UserSelect") : null);
        }
Exemple #2
0
        private async Task StartPickerCaptureAsync()
        {
            var picker = new GraphicsCapturePicker();

            picker.SetWindow(hwnd);
            GraphicsCaptureItem item = await picker.PickSingleItemAsync();

            if (item != null)
            {
                sample.StartCaptureFromItem(item);
            }
        }
        private async Task StartPickerCaptureAsync()
        {
            var picker = new GraphicsCapturePicker();

            picker.SetWindow(_hwnd);
            var item = await picker.PickSingleItemAsync();

            if (item != null)
            {
                var dc = this.DataContext as MainViewModel;
                dc.TargetName.Value = item.DisplayName;
                StartCapture(item);
            }
        }
Exemple #4
0
        private async Task PrepareCapture()
        {
            lbInfo.Content = "상태 : 윈도우 선택중";
            var picker = new GraphicsCapturePicker();

            picker.SetWindow(hwnd);
            GraphicsCaptureItem item = await picker.PickSingleItemAsync();

            if (item != null)
            {
                IntPtr hWnd = GethWnd(item.DisplayName);

                if (hWnd == IntPtr.Zero)
                {
                    if (MessageBox.Show("해당 윈도우는 캡쳐할 수 없습니다" + System.Environment.NewLine + "윈도우가 활성화 되어 있는지 확인해 주세요", "오류", MessageBoxButton.OK) == MessageBoxResult.OK)
                    {
                        Close();
                    }
                }
                else
                {
                    item.Closed += (s, a) =>
                    {
                        StopCapture();
                    };
                    sample.StartCaptureFromItem(item, hWnd);
                    callback();

                    lbInfo.Content = "상태 : 캡쳐 중 - " + item.DisplayName;
                }
            }
            else
            {
                Close();
            }
        }