public void Start() { running = true; CreateStack(); BeforeStart.Fire(this); Run(); }
public void Start() { BeforeStart?.Invoke(null, null); _running = true; IO.Clear(); _instructionCycle = new Thread(InstructionCycle); _instructionCycle.IsBackground = true; _instructionCycle.Start(); }
public static void Init() { #region Default Start Up BeforeStart.Init(key => { var setting = WebConfigurationManager.AppSettings[key]; return(setting.Text()); }, typeof(E), (key) => HttpContext.Current.Session[key], (key, value) => HttpContext.Current.Session[key] = value, () => HttpContext.Current.Request.GetOwinContext()); #endregion }
public void Start() { IsRunning = true; BeforeStart?.Fire(this); try { Run(); } catch (Exception ex) { Debug.Print("Emulator exception when executing {0}. {1}\r\n{2}", CurrentInstruction, ex.Message, ex.StackTrace); ExceptionRaised?.Invoke(this, new EmulatorExceptionEventArgs(ex)); } }
public void Start(double second) { BeforeStart?.Invoke(); _initValue = second; bwCountDown.RunWorkerAsync(); }
private async Task Loop(System.Collections.Concurrent.ConcurrentQueue <ConsoleKeyInfo> inputQueue) { // Running in PS Core the thread has already the name of `Pipeline Execution Thread` if (System.Threading.Thread.CurrentThread.Name == null) { System.Threading.Thread.CurrentThread.Name = "UI Thread"; } BeforeStart?.Invoke(); var g = new UI.Graphics(this); Measure(new Size(g.Width, g.Height)); Arrange(new Rect(0, 0, g.Width, g.Height)); Render(g.GraphicsBuffer); //g.Draw(); while (this.running) { if (Width != Console.WindowWidth || Height != Console.WindowHeight) { Width = Console.WindowWidth; Height = Console.WindowHeight; g.Resize(); //this.InvalidateMeasure(); // We ned to render evything new. :( Measure(new Size(g.Width, g.Height)); Arrange(new Rect(0, 0, g.Width, g.Height)); Render(g.GraphicsBuffer); } if (ActiveControl == null && this.tabList.Count > 0) { ActiveControl = this.tabList[0]; } foreach (var item in this.elementsMeasureDirty.ConsumableEnumerator()) { item.MeasureWithLastAvailableSize(); } foreach (var item in this.elementsArrangeDirty.ConsumableEnumerator()) { item.ArrangeWithLastAvailableSize(); } foreach (var item in this.elementsRenderDirty.ConsumableEnumerator()) { item.RenderWithLastAvailableSize(); } if (this.needToDraw) { g.Draw(); } this.needToDraw = false; await Task.Delay(100); while (this.running && inputQueue.TryDequeue(out var k)) { var active = ActiveControl; if (active != null) { var path = active.GetPathToRoot().OfType <FrameworkElement>().ToArray(); bool handled = false; for (int i = path.Length - 1; i >= 0 && !handled; i--) { if (path[i].PreviewHandleInput(active, k)) { handled = true; } } for (int i = 0; i < path.Length && !handled; i++) { if (path[i].HandleInput(active, k)) { handled = true; } } } else { if (!PreviewHandleInput(this, k)) { HandleInput(this, k); } } } while (this.running && postQueue.TryDequeue(out var action)) { action.Action(); action.TaskSource.SetResult(true); } } }
protected virtual void OnBeforeStart() { BeforeStart?.Invoke(this, EventArgs.Empty); }