Exemple #1
0
 /// <summary>
 ///     construct the ViewModel
 /// </summary>
 /// <param name="pipConfiguration">IPipConfiguration</param>
 /// <param name="pipTranslations">IPipTranslations</param>
 public PipConfigViewModel(
     IPipConfiguration pipConfiguration,
     IPipTranslations pipTranslations)
 {
     Id = "C_Pip";
     PipConfiguration = pipConfiguration;
     PipTranslations  = pipTranslations;
     pipTranslations.CreateDisplayNameBinding(this, nameof(IPipTranslations.Title));
 }
Exemple #2
0
        /// <summary>
        /// The constructor
        /// </summary>
        /// <param name="pipConfiguration">IPipConfiguration</param>
        /// <param name="locationPool">LocationPool used to find a location</param>
        /// <param name="hWnd">IntPtr with the hWnd to mirror</param>
        /// <param name="uiSynchronizationContext">SynchronizationContext used to make it possible to modify the UI</param>
        public ThumbnailForm(IPipConfiguration pipConfiguration, LocationPool locationPool, IntPtr hWnd, SynchronizationContext uiSynchronizationContext)
        {
            _thumbnailRect = locationPool.Pool();
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            _pipConfiguration = pipConfiguration;
            _locationPool     = locationPool;

            // Make sure that changes to the settings are applied
            _configurationMonitor = _pipConfiguration.OnPropertyChanged()
                                    .Where(args => PropertiesToMonitor.Contains(args.PropertyName))
                                    .Throttle(TimeSpan.FromMilliseconds(200))
                                    .SubscribeOn(uiSynchronizationContext)
                                    .ObserveOn(uiSynchronizationContext)
                                    .Subscribe(args => UpdateThumbnail());

            _hWnd = hWnd;

            // Make sure the PIP closes when the source closes
            _windowCloseMonitor = WinEventHook.Create(WinEvents.EVENT_OBJECT_DESTROY)
                                  .SubscribeOn(uiSynchronizationContext)
                                  .ObserveOn(uiSynchronizationContext)
                                  .Subscribe(info =>
            {
                if (info.Handle == _hWnd)
                {
                    Close();
                }
            });

            // Make sure the thumbnail changes when the window changes
            _windowSizeChangeMonitor = WinEventHook.Create(WinEvents.EVENT_OBJECT_LOCATIONCHANGE)
                                       .SubscribeOn(uiSynchronizationContext)
                                       .ObserveOn(uiSynchronizationContext)
                                       .Subscribe(info =>
            {
                if (info.Handle == _hWnd)
                {
                    UpdateThumbnail();
                }
            });

            Location        = _thumbnailRect.Location;
            Size            = _thumbnailRect.Size;
            StartPosition   = FormStartPosition.Manual;
            TopMost         = true;
            Text            = "PIP";
            FormBorderStyle = FormBorderStyle.None;
            BackColor       = Color.Gray;
            Enabled         = false;
            ShowInTaskbar   = false;
        }
Exemple #3
0
 public PipService(IPipConfiguration pipConfiguration, LocationPool locationPool)
 {
     _pipConfiguration = pipConfiguration;
     _locationPool     = locationPool;
 }
Exemple #4
0
 public StartupReadyToastViewModel(IPipTranslations pipTranslations, IPipConfiguration pipConfiguration)
 {
     _pipTranslations  = pipTranslations;
     _pipConfiguration = pipConfiguration;
 }