Example #1
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (_randy?.Dave != null)
                {
                    _randy.Dave.DesktopBackgroundChanged -= OnDesktopBackgroundChanged;
                }

                _randy?.Dispose();
                _randy = null;

                if (_dave != null)
                {
                    _dave.DesktopBackgroundChanged -= OnDesktopBackgroundChanged;
                    _dave?.Dispose();
                    _dave = null;
                }
            }

            _disposed = true;
            Current   = null;
        }
        /// <summary>
        /// kill dave
        /// </summary>
        public void Filicide()
        {
            Dave?.Dispose();
            Dave = null;

            _messagePumpThread.Abort();
        }
Example #3
0
 public KioskModeOperation(
     IDesktopFactory desktopFactory,
     IDesktopMonitor desktopMonitor,
     IExplorerShell explorerShell,
     ILogger logger,
     IProcessFactory processFactory,
     SessionContext sessionContext) : base(sessionContext)
 {
     this.desktopFactory = desktopFactory;
     this.desktopMonitor = desktopMonitor;
     this.explorerShell  = explorerShell;
     this.logger         = logger;
     this.processFactory = processFactory;
 }
        /// <summary>
        /// Keeps the message pump alive
        /// </summary>
        private void MessagePumpLifeSupport()
        {
            Dave = _monitorFactory.GetDesktopMonitor(DesktopMonitorType.WndProcNativeWindow);
            Application.ThreadException += (s, e) => Application.Exit();

            _initialized.Set();

            if (Dave is Form megaDave)
            {
                Application.Run(megaDave);
            }
            else
            {
                Application.Run();
            }
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Desktop"/> class.
 /// </summary>
 /// <param name="monitor">The monitor.</param>
 private Desktop(IDesktopMonitor monitor)
 {
     _dave = monitor;
     _dave.DesktopBackgroundChanged += OnDesktopBackgroundChanged;
 }