示例#1
0
        protected override void OnLoad(EventArgs evt)
        {
            base.OnLoad(evt);
            if (DesignMode)
            {
                return;
            }

            _notifListener = new NotificationListener();
            _notifListener.OnNotification += OnNotificationReceived;

            InitShortcuts();

            RegisterViewerConfig config = ConfigManager.Config.Debug.RegisterViewer;

            RestoreLocation(config.WindowLocation, config.WindowSize);

            mnuAutoRefresh.Checked = config.AutoRefresh;
            ctrlScanlineCycleSelect.Initialize(config.RefreshScanline, config.RefreshCycle, EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy ? CpuType.Gameboy : CpuType.Cpu);

            _refreshManager                  = new WindowRefreshManager(this);
            _refreshManager.AutoRefresh      = config.AutoRefresh;
            _refreshManager.AutoRefreshSpeed = RefreshSpeed.High;

            UpdateTabs();

            RefreshData();
            RefreshViewer();

            mnuAutoRefresh.CheckedChanged += mnuAutoRefresh_CheckedChanged;
        }
示例#2
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            _notifListener?.Dispose();
            _refreshManager?.Dispose();

            RegisterViewerConfig config = ConfigManager.Config.Debug.RegisterViewer;

            config.WindowSize      = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            config.WindowLocation  = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            config.AutoRefresh     = mnuAutoRefresh.Checked;
            config.RefreshScanline = ctrlScanlineCycleSelect.Scanline;
            config.RefreshCycle    = ctrlScanlineCycleSelect.Cycle;
            ConfigManager.ApplyChanges();

            base.OnFormClosed(e);
        }