示例#1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.host         = (SystemHost)e.Parameter;
            this.refreshTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(100)
            };
            this.refreshTimer.Tick += (s, ee) => this.RefreshDebug();

            this.host.Processor.BreakHandler = async() => await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                this.BreakButton.IsEnabled    = false;
                this.ContinueButton.IsEnabled = true;
                this.StepButton.IsEnabled     = true;

                this.refreshTimer.Stop();

                this.RefreshDebug();
            });

            var running = this.host.Processor.IsRunning;

            this.BreakButton.IsEnabled    = running;
            this.ContinueButton.IsEnabled = !running;
            this.StepButton.IsEnabled     = !running;

            if (running)
            {
                this.refreshTimer.Start();
            }

            this.RefreshDebug();
        }
示例#2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.host = (SystemHost)e.Parameter;
            this.currentPressedKeys = new HashSet <ulong>();
            this.refreshTimer       = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(1000 / 24)
            };

            this.refreshTimer.Tick  += (s, ee) => this.displayBitmap.FromByteArray(this.host.Display.RawBuffer);
            this.displayBitmap       = new WriteableBitmap((int)this.host.Display.Width, (int)this.host.Display.Height);
            this.DisplayImage.Width  = (int)this.host.Display.Width;
            this.DisplayImage.Height = (int)this.host.Display.Height;
            this.DisplayImage.Source = this.displayBitmap;

            this.refreshTimer.Start();

            Window.Current.CoreWindow.KeyUp   += this.OnKeyEvent;
            Window.Current.CoreWindow.KeyDown += this.OnKeyEvent;

            this.host.Processor.Continue();
        }