void OnProcessExited(object sender, EventArgs e) { if (RunButton.InvokeRequired) { RunButton.Invoke(new MethodInvoker(delegate() { RunButton.Enabled = true; })); } AddToListbox("******Done******"); AddToListbox(" "); }
private void EnableButtons(bool Enabled) { if (InvokeRequired) { BeginInvoke((Action)(() => { EnableButtons(Enabled); })); } else { RunButton.Enabled = Enabled; EditButton.Enabled = Enabled; if (Enabled) { RunButton.Focus(); } } }
private void Thread_ProgressChanged(object sender, ProgressChangedEventArgs e) { Action <int> Method = UpdateMethod; if (e.ProgressPercentage < 60) { LabelPercentage.ForeColor = Color.Black; } else { LabelPercentage.ForeColor = Color.White; } LabelPercentage.Text = e.ProgressPercentage + "%"; RunButton.Invoke(Method, e.ProgressPercentage); StatusText.Text = "Testiranje u toku... (" + e.ProgressPercentage.ToString() + "%)"; Update(); }
private void RefreshData() { PartsGrid.Invoke(new MethodInvoker(delegate { PartsGrid.DataSource = _parts.Parts.ToList(); PartsGrid.Columns["_id"].Visible = false; Parallel.ForEach(PartsGrid.Rows.OfType <DataGridViewRow>(), row => { var _part = _parts.Parts.Find(x => x._id == row.Cells["_id"].Value); if (_part != null) { switch (_part.status) { case PartClass.Status.Completed: row.DefaultCellStyle.BackColor = Color.LightGreen; break; case PartClass.Status.Unknown: row.DefaultCellStyle.BackColor = Color.LightGray; break; case PartClass.Status.Ready: row.DefaultCellStyle.BackColor = Color.LightYellow; break; case PartClass.Status.Resolving: row.DefaultCellStyle.BackColor = Color.LightBlue; break; case PartClass.Status.Target_Partition_Not_Found: row.DefaultCellStyle.BackColor = Color.LightPink; break; case PartClass.Status.Part_Not_Found: row.DefaultCellStyle.BackColor = Color.LightPink; break; } } }); PartsGrid.ClearSelection(); })); RunButton.Invoke(new MethodInvoker(delegate { if (_parts.Parts.FindAll(x => x.status == PartClass.Status.Ready).Count > 0) { RunButton.Enabled = true; } else { RunButton.Enabled = false; } })); }
void ReleaseDesignerOutlets() { if (AttackButton != null) { AttackButton.Dispose(); AttackButton = null; } if (EnemyDamageLabel != null) { EnemyDamageLabel.Dispose(); EnemyDamageLabel = null; } if (EnemyHealthLabel != null) { EnemyHealthLabel.Dispose(); EnemyHealthLabel = null; } if (RemainingRoundsLabel != null) { RemainingRoundsLabel.Dispose(); RemainingRoundsLabel = null; } if (RemainingRunsLabel != null) { RemainingRunsLabel.Dispose(); RemainingRunsLabel = null; } if (RunButton != null) { RunButton.Dispose(); RunButton = null; } if (UserDamageLabel != null) { UserDamageLabel.Dispose(); UserDamageLabel = null; } if (UserHealthLabel != null) { UserHealthLabel.Dispose(); UserHealthLabel = null; } }
private void CPUWindow_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.F5: RunButton.Focus(); RunButton_Click(sender, null); break; case Keys.F6: StepButton.Focus(); StepButton_Click(sender, null); break; case Keys.F7: StepOverButton.Focus(); StepOverButton_Click(sender, null); break; } }
public ConsoleToolbar() { root = Resources.GetTemplate("ConsoleToolbar.uxml"); Add(root); root.StretchToParentSize(); ClearButton.RegisterCallback <MouseDownEvent>(ClearClick); ClearButton.RegisterCallback <MouseUpEvent>(ClearStopClick); MultilineButton.RegisterCallback <MouseDownEvent>(ConsoleExpandToggle); ContextButton.RegisterCallback <MouseDownEvent>(ContextExpandToggle); RunButton.RegisterCallback <MouseDownEvent>(RunClick); RunButton.RegisterCallback <MouseUpEvent>(ClearRunClick); ResetButton.RegisterCallback <MouseUpEvent>(ResetClick); TemplatesDropdown.RegisterCallback <MouseUpEvent>(TemplatesClick); PrivateToggle.RegisterValueChangedCallback(OnPrivateToggle); PrivateToggle.value = State.Instance.ShowPrivate; OnPrivateToggle(null); RefreshConsoleState(); RefreshContextState(); }
void ReleaseDesignerOutlets() { if (MainLabel != null) { MainLabel.Dispose(); MainLabel = null; } if (RunButton != null) { RunButton.Dispose(); RunButton = null; } if (StatisticsLabel != null) { StatisticsLabel.Dispose(); StatisticsLabel = null; } if (StatusLabel != null) { StatusLabel.Dispose(); StatusLabel = null; } if (CategoryLabel != null) { CategoryLabel.Dispose(); CategoryLabel = null; } if (StopButton != null) { StopButton.Dispose(); StopButton = null; } }
public void SetLanguage(_Language lang) { this.lang = lang; if (lang == _Language.None) { LanguageLabel.Text = ""; } else { LanguageLabel.Text = lang.ToString(); } if (runnables.Contains(lang)) { RunButton.Show(); } else { RunButton.Hide(); } int line = 87; JsonTextReader reader = new JsonTextReader(new StringReader(File.ReadAllText(path + "bin/Monaco/config.json"))); while (reader.Read()) { if (reader.Value != null) { if (reader.TokenType == JsonToken.String) { line = Int32.Parse(reader.Value.ToString()); } } } if (lang == _Language.None) { ChangeLine(" language: '',", path + "bin/Monaco/Monaco.html", line); } else { ChangeLine(" language: '"+ lang.ToString().ToLower() + "',", path + "bin/Monaco/Monaco.html", line); } if (File.Exists(path + "bin/language.json")) { File.Delete(path + "bin/language.json"); } StringBuilder sb = new StringBuilder(); StringWriter strw = new StringWriter(sb); using (JsonWriter writer = new JsonTextWriter(strw)) { writer.Formatting = Formatting.Indented; writer.WriteStartObject(); writer.WritePropertyName("Language"); writer.WriteValue(lang.ToString()); writer.WriteEndObject(); } using (Stream s = File.Open(path + "bin/language.json", FileMode.CreateNew)) using (StreamWriter sw = new StreamWriter(s)) { sw.Write(sb.ToString()); } }
private void RunClick(MouseDownEvent evt) { RunButton.AddToClassList("pressed"); }
private async void ClearRunClick(MouseUpEvent evt) { RunButton.RemoveFromClassList("pressed"); await Console.CodeEvaluate(); }
protected async override Task UpdateBtns(InteractiveObject obj) { try { if (CanvasGroup.alpha == 0) { previousUpdateDone = true; return; } await base.UpdateBtns(obj); #if UNITY_ANDROID && AR_ON if (!CalibrationManager.Instance.Calibrated && !TrackingManager.Instance.IsDeviceTracking()) { SetActionPointParentButton.SetInteractivity(false, $"{SET_ACTION_POINT_PARENT_LABEL}\n(AR not calibrated)"); AddActionButton.SetInteractivity(false, $"{ADD_ACTION_LABEL}\n(AR not calibrated)"); AddActionButton2.SetInteractivity(false, $"{ADD_ACTION_LABEL}\n(AR not calibrated)"); AddConnectionButton.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(AR not calibrated)"); AddConnectionButton2.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(AR not calibrated)"); RunButton.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n(AR not calibrated)"); RunButton2.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n(AR not calibrated)"); AddActionPointButton.SetInteractivity(false, $"{ADD_ACTION_POINT_LABEL}\n(AR not calibrated)"); AddActionPointButton2.SetInteractivity(false, $"{ADD_ACTION_POINT_LABEL}\n(AR not calibrated)"); CopyButton.SetInteractivity(false, $"{COPY_LABEL}\n(AR not calibrated"); ActionPointAimingMenuButton.SetInteractivity(false, $"{ACTION_POINT_AIMING_LABEL}\n(AR not calibrated)"); } else #endif if (requestingObject || obj == null) { SetActionPointParentButton.SetInteractivity(false, $"{SET_ACTION_POINT_PARENT_LABEL}\n(no action point is selected)"); AddActionButton.SetInteractivity(false, $"{ADD_ACTION_LABEL}\n(no action point is selected)"); AddActionButton2.SetInteractivity(false, $"{ADD_ACTION_LABEL}\n(no action point is selected)"); AddConnectionButton.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(no input / output is selected)"); AddConnectionButton2.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(no input / output is selected)"); RunButton.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n(select action to execute it or START to run project)"); RunButton2.SetInteractivity(false, RunButton.GetAlternativeDescription()); AddActionPointButton.SetInteractivity(true); AddActionPointButton2.SetInteractivity(true); AddActionPointButton.SetDescription(ADD_ACTION_POINT_GLOBAL_LABEL); AddActionPointButton2.SetDescription(ADD_ACTION_POINT_GLOBAL_LABEL); CopyButton.SetInteractivity(false, $"{COPY_LABEL}\n(no object to duplicate selected)"); ActionPointAimingMenuButton.SetInteractivity(false, $"{ACTION_POINT_AIMING_LABEL}\n(no action point selected)"); RunDebugButton.SetInteractivity(false, $"{RUN_DEBUG_OR_TRIGGER_BREAKPOINT_LABEL}\n(select action point to trigger breakpoint or START to run debug mode)"); } else if (obj.IsLocked && obj.LockOwner != LandingScreen.Instance.GetUsername()) { SetActionPointParentButton.SetInteractivity(false, $"{SET_ACTION_POINT_PARENT_LABEL}\n(object is used by {obj.LockOwner})"); AddConnectionButton.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(object is used by {obj.LockOwner})"); AddConnectionButton2.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(object is used by {obj.LockOwner})"); RunButton.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n(object is used by {obj.LockOwner})"); RunButton2.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n(object is used by {obj.LockOwner})"); AddActionButton.SetInteractivity(false, $"{ADD_ACTION_POINT_LABEL}\n(object is used by {obj.LockOwner})"); AddActionButton2.SetInteractivity(false, $"{ADD_ACTION_POINT_LABEL}\n(object is used by {obj.LockOwner})"); CopyButton.SetInteractivity(false, $"{COPY_LABEL}\n(object is used by {obj.LockOwner})"); ActionPointAimingMenuButton.SetInteractivity(false, $"{ACTION_POINT_AIMING_LABEL}\n(object is used by {obj.LockOwner})"); RunDebugButton.SetInteractivity(false, $"{RUN_DEBUG_OR_TRIGGER_BREAKPOINT_LABEL}\n(object is used by {obj.LockOwner})"); } else { RunDebugButton.SetInteractivity(false, $"{RUN_DEBUG_OR_TRIGGER_BREAKPOINT_LABEL}\n(select action point to trigger breakpoint or START to run debug mode)"); SetActionPointParentButton.SetInteractivity(obj is ActionPoint3D, $"{SET_ACTION_POINT_PARENT_LABEL}\n(selected object is not action point)"); if (obj is ActionPoint3D ap) { AddActionButton.SetInteractivity(ProjectManager.Instance.AnyAvailableAction, $"{ADD_ACTION_LABEL}\n(no actions available)"); AddActionButton2.SetInteractivity(ProjectManager.Instance.AnyAvailableAction, $"{ADD_ACTION_LABEL}\n(no actions available)"); CopyButton.SetInteractivity(false, $"{COPY_LABEL}\n(checking...)"); WebsocketManager.Instance.CopyActionPoint(obj.GetId(), null, obj.GetName(), CopyActionPointDryRunCallback, true); RunDebugButton.SetInteractivity(true); RunDebugButton.SetDescription(ap.BreakPoint ? TRIGGER_BREAKPOINT_OFF_LABEL : TRIGGER_BREAKPOINT_ON_LABEL); } else { AddActionButton.SetInteractivity(false, $"{ADD_ACTION_LABEL}\n(selected object is not action point)"); AddActionButton2.SetInteractivity(false, $"{ADD_ACTION_LABEL}\n(selected object is not action point)"); CopyButton.SetInteractivity(obj is Base.Action && !(obj is StartEndAction), $"{COPY_LABEL}\n(selected object cannot be duplicated)"); } ActionPointAimingMenuButton.SetInteractivity(obj is ActionPoint3D || obj is APOrientation, $"{ACTION_POINT_AIMING_LABEL}\n(selected object is not action point or orientation)"); if (obj is IActionPointParent) { AddActionPointButton.SetDescription($"Add AP relative to {obj.GetName()}"); AddActionPointButton.SetInteractivity(true); } else { AddActionPointButton.SetInteractivity(false, $"{ADD_ACTION_POINT_LABEL}\n(selected object could not be parent of AP"); } AddActionPointButton2.SetInteractivity(AddActionPointButton.IsInteractive(), $"{ADD_ACTION_POINT_LABEL}\n({AddActionPointButton.GetAlternativeDescription()})"); AddActionPointButton2.SetDescription(AddActionPointButton.GetDescription()); if (!MainSettingsMenu.Instance.ConnectionsSwitch.IsOn()) { AddConnectionButton.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(connections are hidden)"); AddConnectionButton2.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(connections are hidden)"); } else { if (obj is Base.Action) { if (obj is EndAction) { AddConnectionButton.SetInteractivity(false, $"{ADD_CONNECTION_LABEL}\n(end action could not be connected to anything else)"); } else { AddConnectionButton.SetInteractivity(true); } AddConnectionButton2.SetInteractivity(AddConnectionButton.IsInteractive(), AddConnectionButton.GetAlternativeDescription()); } } string runBtnInteractivity = null; if (obj.GetType() == typeof(Action3D)) { if (!SceneManager.Instance.SceneStarted) { runBtnInteractivity = "scene offline"; } else if (!string.IsNullOrEmpty(GameManager.Instance.ExecutingAction)) { string actionName = ProjectManager.Instance.GetAction(GameManager.Instance.ExecutingAction).GetName(); runBtnInteractivity = $"action '{actionName}' running"; } RunButton.SetDescription(RUN_ACTION_LABEL); RunButton2.SetDescription(RUN_ACTION_LABEL); RunButton.SetInteractivity(string.IsNullOrEmpty(runBtnInteractivity), $"{RUN_ACTION_LABEL}\n({runBtnInteractivity})"); RunButton2.SetInteractivity(string.IsNullOrEmpty(runBtnInteractivity), $"{RUN_ACTION_LABEL}\n({runBtnInteractivity})"); } else if (obj.GetType() == typeof(StartAction)) { if (!ProjectManager.Instance.ProjectMeta.HasLogic) { runBtnInteractivity = "project without logic could not be started from editor"; } else if (ProjectManager.Instance.ProjectChanged) { runBtnInteractivity = "project has unsaved changes"; } RunButton.SetDescription(RUN_TEMP_PACKAGE_LABEL); RunButton2.SetDescription(RUN_TEMP_PACKAGE_LABEL); RunDebugButton.SetDescription(RUN_DEBUG_LABEL); RunButton.SetInteractivity(string.IsNullOrEmpty(runBtnInteractivity), $"{RUN_TEMP_PACKAGE_LABEL}\n({runBtnInteractivity})"); RunButton2.SetInteractivity(string.IsNullOrEmpty(runBtnInteractivity), $"{RUN_TEMP_PACKAGE_LABEL}\n({runBtnInteractivity})"); RunDebugButton.SetInteractivity(string.IsNullOrEmpty(runBtnInteractivity), $"{RUN_DEBUG_LABEL}\n({runBtnInteractivity})"); } else { runBtnInteractivity = "select action to execute it or START to run project"; RunButton.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n({runBtnInteractivity})"); RunButton2.SetInteractivity(false, $"{RUN_ACTION_OR_PACKAGE_LABEL}\n({runBtnInteractivity})"); } } if (!SceneManager.Instance.SceneStarted) { AddActionPointUsingRobotButton.SetInteractivity(false, $"{ADD_ACTION_POINT_USING_ROBOT_LABEL}\n(scene offline"); } else { AddActionPointUsingRobotButton.SetInteractivity(true); } } finally { previousUpdateDone = true; } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.NumPad1) { button1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad2) { button2.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad3) { button3.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad4) { button4.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad5) { button5.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad6) { button6.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad7) { button7.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad8) { button8.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad9) { button9.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.NumPad0) { button0.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Add) { PlusButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Subtract) { MinusButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Divide) { DivideButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Multiply) { MultiplyButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.OemComma || e.Key == Key.Decimal) { buttonComma.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.Back) { ClearEverything.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } else if (e.Key == Key.PageDown || e.Key == Key.Enter) { RunButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } }
// Start is called before the first frame update void Start() { control = GameObject.FindWithTag("Arduino").GetComponent <ControlArduino>(); runbtn = GameObject.FindWithTag("RunBlock").GetComponent <RunButton>(); MeshPrint = this.gameObject.GetComponent <MeshRenderer>(); }
// Aqui moveremos y giraremos la araña en funcion del Input void FixedUpdate() { // Si estoy en pausa no hacer nada (no moverme ni atacar) if (paused) { return; } ///////////////////////////////////////////////////////////////////////////////////// // Si giro izquierda: _angularSpeed = -rotateSpeed; // Calculo de velocidad lineal (_speed) y angular (_angularSpeed) en función del Input // Si camino/corro hacia delante delante: _speed = walkSpeed / _speed = runSpeed // Si camino / corro hacia delante detras: _speed = -walkSpeed / _speed = -runSpeed // Si no me muevo: _speed = 0 ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// // Si giro izquierda: _angularSpeed = -rotateSpeed; // Si giro izquierda: _angularSpeed = -rotateSpeed; // Si giro derecha: _angularSpeed = rotateSpeed; // Si no giro : _angularSpeed = 0; ///////////////////////////////////////////////////////////////////////////////////// #if UNITY_IOS || UNITY_ANDROID float direction = 0f; if (CrossButton.GetInput(InputType.UP)) { direction = 1f; } else if (CrossButton.GetInput(InputType.DOWN)) { direction = -1f; } if (RunButton.IsRun()) { _speed = direction * runSpeed; } else { _speed = direction * walkSpeed; } float torqueDirection = 0f; if (CrossButton.GetInput(InputType.RIGHT)) { torqueDirection = 1f; } else if (CrossButton.GetInput(InputType.LEFT)) { torqueDirection = -1f; } _angularSpeed = torqueDirection * rotateSpeed; #else float verticalAxis = Input.GetAxis("Vertical"); if (Input.GetButton("Run")) { _speed = verticalAxis * runSpeed; } else { _speed = verticalAxis * walkSpeed; } _angularSpeed = Input.GetAxis("Horizontal") * rotateSpeed; #endif // Actualizamos el parámetro "Speed" en función de _speed. Para activar la anicación de caminar/correr _animator.SetFloat(SpeedHash, _speed); // Movemov y rotamos el rigidbody (MovePosition y MoveRotation) en función de "_speed" y "_angularSpeed" _rigidbody.MovePosition(transform.position + transform.forward * _speed * Time.deltaTime); _rigidbody.MoveRotation(transform.rotation * Quaternion.Euler(0, _angularSpeed * Time.deltaTime, 0)); // Mover el collider en función del parámetro "Distance" (necesario cuando atacamos) Vector3 center = _boxCollider.center; center.z = _originalColliderZ + _animator.GetFloat(DistanceHash) * _boxCollider.size.z; _boxCollider.center = center; }
public void ClickRun() { RunButton.Click(); }