public MainPage() { InitializeComponent(); if (!GraphicsCaptureSession.IsSupported()) { IsEnabled = false; var dialog = new MessageDialog( "Screen capture is not supported on this device for this release of Windows!", "Screen capture unsupported"); var ignored = dialog.ShowAsync(); return; } // initialize screen recording screenDevice = Direct3D11Helpers.CreateDevice(); // connect to the powerpoint app service App.AppServiceConnected += MainPage_AppServiceConnected; _timer.Interval = new TimeSpan(0, 0, 1); _timer.Tick += _timer_Tick; }
public MainPage() { this.InitializeComponent(); _device = Direct3D11Helpers.CreateDevice(); _semaphore = new SemaphoreSlim(0, 1); var appView = ApplicationView.GetForCurrentView(); if (!appView.IsViewModeSupported(ApplicationViewMode.CompactOverlay)) { OverlayButton.IsEnabled = false; } }
public MainPage() { InitializeComponent(); VM = new VideoManager(); if (!GraphicsCaptureSession.IsSupported()) { IsEnabled = false; var dialog = new MessageDialog( "Sorry! Screen capture is not supported on your device.", "Screen capture unsupported"); var ignored = dialog.ShowAsync(); return; } _device = Direct3D11Helpers.CreateDevice(); var settings = GetCachedSettings(); var names = new List <string>(); names.Add(nameof(VideoEncodingQuality.HD1080p)); names.Add(nameof(VideoEncodingQuality.HD720p)); names.Add(nameof(VideoEncodingQuality.Uhd2160p)); names.Add(nameof(VideoEncodingQuality.Uhd4320p)); QualityComboBox.ItemsSource = names; QualityComboBox.SelectedIndex = names.IndexOf(settings.Quality.ToString()); var frameRates = new List <string> { "30fps", "60fps" }; FrameRateComboBox.ItemsSource = frameRates; FrameRateComboBox.SelectedIndex = frameRates.IndexOf($"{settings.FrameRate}fps"); UseSourceSizeCheckBox.IsChecked = settings.UseSourceSize; ExampleNotif.Show("Some trext", 5); }
public MainPage() { InitializeComponent(); ApplicationView.GetForCurrentView().SetPreferredMinSize( new Size(350, 200)); if (!GraphicsCaptureSession.IsSupported()) { IsEnabled = false; var dialog = new MessageDialog( "Screen capture is not supported on this device for this release of Windows!", "Screen capture unsupported"); var ignored = dialog.ShowAsync(); return; } _device = Direct3D11Helpers.CreateDevice(); var settings = GetCachedSettings(); var names = new List <string>(); names.Add(nameof(VideoEncodingQuality.HD1080p)); names.Add(nameof(VideoEncodingQuality.HD720p)); names.Add(nameof(VideoEncodingQuality.Uhd2160p)); names.Add(nameof(VideoEncodingQuality.Uhd4320p)); QualityComboBox.ItemsSource = names; QualityComboBox.SelectedIndex = names.IndexOf(settings.Quality.ToString()); var frameRates = new List <string> { "30fps", "60fps" }; FrameRateComboBox.ItemsSource = frameRates; FrameRateComboBox.SelectedIndex = frameRates.IndexOf($"{settings.FrameRate}fps"); UseCaptureItemSizeCheckBox.IsChecked = settings.UseSourceSize; }
public MainPage() { InitializeComponent(); //Adjust minimum and default window size ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(400, 250)); ApplicationView.PreferredLaunchViewSize = new Size(400, 250); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; //hide titlebar ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar; formattableTitleBar.ButtonBackgroundColor = Colors.Transparent; CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; //Record icon RecordIcon.Visibility = Visibility.Visible; StopIcon.Visibility = Visibility.Collapsed; Ellipse.Visibility = Visibility.Collapsed; ToolTip toolTip = new ToolTip(); toolTip.Content = "Start recording"; ToolTipService.SetToolTip(MainButton, toolTip); AutomationProperties.SetName(MainButton, "Start recording"); _device = Direct3D11Helpers.CreateDevice(); var settings = GetCachedSettings(); _resolutions = new List <ResolutionItem>(); foreach (var resolution in EncoderPresets.Resolutions) { _resolutions.Add(new ResolutionItem() { DisplayName = $"{resolution.Width} x {resolution.Height}", Resolution = resolution, }); } ResolutionComboBox.ItemsSource = _resolutions; ResolutionComboBox.SelectedIndex = GetResolutionIndex(settings.Width, settings.Height); _bitrates = new List <BitrateItem>(); foreach (var bitrate in EncoderPresets.Bitrates) { var mbps = (float)bitrate / 1000000; _bitrates.Add(new BitrateItem() { DisplayName = $"{mbps:0.##} Mbps", Bitrate = bitrate, }); } BitrateComboBox.ItemsSource = _bitrates; BitrateComboBox.SelectedIndex = GetBitrateIndex(settings.Bitrate); _frameRates = new List <FrameRateItem>(); foreach (var frameRate in EncoderPresets.FrameRates) { _frameRates.Add(new FrameRateItem() { DisplayName = $"{frameRate}fps", FrameRate = frameRate, }); } FrameRateComboBox.ItemsSource = _frameRates; FrameRateComboBox.SelectedIndex = GetFrameRateIndex(settings.FrameRate); UseCaptureItemToggleSwitch.IsOn = settings.UseSourceSize; PreviewToggleSwitch.IsOn = settings.Preview; }
public MainPage() { InitializeComponent(); this.Loaded += LoadedHandler; MergingProgressRing.Visibility = Visibility.Collapsed; SilentPlayer = new MediaPlayer() { IsLoopingEnabled = true }; SilentPlayer.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/Silence.ogg")); SilentPlayer.Play(); ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(400, 260)); //hide titlebar SetupTitleBar(); ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar; formattableTitleBar.ButtonBackgroundColor = Colors.Transparent; //Record icon RecordIcon.Visibility = Visibility.Visible; StopIcon.Visibility = Visibility.Collapsed; Ellipse.Visibility = Visibility.Collapsed; ToolTip toolTip = new ToolTip(); toolTip.Content = Strings.Resources.RecordingStart; ToolTipService.SetToolTip(MainButton, toolTip); AutomationProperties.SetName(MainButton, Strings.Resources.RecordingStart); _device = Direct3D11Helpers.CreateDevice(); var settings = GetCachedSettings(); _resolutions = new List <ResolutionItem>(); foreach (var resolution in EncoderPresets.Resolutions) { _resolutions.Add(new ResolutionItem() { DisplayName = $"{resolution.Width} x {resolution.Height}", Resolution = resolution, }); } _resolutions.Add(new ResolutionItem() { DisplayName = Strings.Resources.SourceSizeToggle, Resolution = new SizeUInt32() { Width = 0, Height = 0 }, }); ResolutionComboBox.ItemsSource = _resolutions; ResolutionComboBox.SelectedIndex = GetResolutionIndex(settings.Width, settings.Height); _bitrates = new List <BitrateItem>(); foreach (var bitrate in EncoderPresets.Bitrates) { var mbps = (float)bitrate / 1000000; _bitrates.Add(new BitrateItem() { DisplayName = $"{mbps:0.##} Mbps", Bitrate = bitrate, }); } BitrateComboBox.ItemsSource = _bitrates; BitrateComboBox.SelectedIndex = GetBitrateIndex(settings.Bitrate); _frameRates = new List <FrameRateItem>(); foreach (var frameRate in EncoderPresets.FrameRates) { _frameRates.Add(new FrameRateItem() { DisplayName = $"{frameRate}fps", FrameRate = frameRate, }); } FrameRateComboBox.ItemsSource = _frameRates; FrameRateComboBox.SelectedIndex = GetFrameRateIndex(settings.FrameRate); AudioToggleSwitch.IsOn = settings.IntAudio; ExtAudioToggleSwitch.IsOn = settings.ExtAudio; GalleryToggleSwitch.IsOn = settings.Gallery; SystemPlayerToggleSwitch.IsOn = settings.SystemPlayer; OverlayToggleSwitch.IsOn = settings.ShowOnTop; if (AudioToggleSwitch.IsOn) { InternalAudioCheck(); } }