public void DoGUIUpdate(string paramString) { try { if (this.InvokeRequired) { GUIDelegate delegateMethod = new GUIDelegate(this.DoGUIUpdate); this.Invoke(delegateMethod, new object[] { paramString }); } else { switch (Id) { case 1: Id = 2; //double l; //l = Double.Parse(paramString)/10; this.label10.Text = paramString; StartPoll(); break; case 2: Id = 1; this.label11.Text = paramString; StartPoll(); break; } } } catch (Exception ex) { MessageBox.Show("Error in DoGUIUpdate: " + ex.Message); } }
public void OnTriggerEnter2D(Collider2D col) { if (col.tag.Contains("PlayerTag")) { GUIDelegate.updateCoinUI(1); Destroy(gameObject); } }
// Use this for initialization void Start() { getObjectComponents(); InvokeRepeating("Shoot", 0f, .3f); GUIDelegate.updateHealthUI(health); }
void FlaggedGUI(GUIDelegate gui, MeshFlags affectsMesh = MeshFlags.None, bool affectsShader = false) { GUI.changed = false; gui(); if (GUI.changed) { MarkAsDirty(serializedObject, affectsMesh, affectsShader); } }
private void SecondTimerTick(object source, ElapsedEventArgs e) { var timeLeft = TimerCompleteAt.Subtract(DateTime.Now); if (textBox_CurrentJob_Hours.InvokeRequired) { GUIDelegate guiDelegate = new GUIDelegate(UpdateGUI); Invoke(guiDelegate, new object[] { timeLeft }); } }
public void DoGUIUpdate(string paramString) { if (this.InvokeRequired) { GUIDelegate delegateMethod = new GUIDelegate(this.DoGUIUpdate); this.Invoke(delegateMethod, new object[] { paramString }); } else { this.listBox1.Items.Add(paramString); } }
public void DoGUIUpdate(string paramString) { /* função delegada para incluir os itens da lista de registros */ if (this.InvokeRequired) { GUIDelegate delegateMethod = new GUIDelegate(this.DoGUIUpdate); this.Invoke(delegateMethod, new object[] { paramString }); } else { this.lstRegisterValues.Items.Add(paramString); } }
void DrawControlBox(string title, string docLink, ref bool open, GUIDelegate contents) { EditorGUIUtility.labelWidth = defaultLabelWidth; EditorGUIUtility.fieldWidth = defaultFieldWidth; GUI.color = new Color(0.95f, 0.95f, 0.95f, 1f); EditorGUILayout.LabelField(title, EditorStyles.toolbarButton); GUI.color = Color.white; Rect lastRect = GUILayoutUtility.GetLastRect(); DrawHelpButton(docLink, lastRect); Rect toggleRect = new Rect(lastRect); toggleRect.x += 16f; toggleRect.y += 2f; open = EditorGUI.Foldout(toggleRect, open, new GUIContent("")); if (open) { EditorGUILayout.BeginVertical(style); EditorGUILayout.Space(); contents(); EditorGUILayout.Space(); EditorGUILayout.EndVertical(); } else { EditorGUILayout.GetControlRect(false, 1f); } EditorGUIUtility.labelWidth = defaultLabelWidth; EditorGUIUtility.fieldWidth = defaultFieldWidth; }
// <CONSTRUCTORS> /// <summary> /// Constructor /// </summary> public MainWindow() { InitializeComponent(); DataContext = this; // default binding data context program = Program.GetInstance(); Resources.Add("program", program); guiDelegate += GUIUpdate; // main GUI update method compensationWindowCloseDelegate += CompensationClose; program.Device.PropertyChanged += (object sender, PropertyChangedEventArgs e) => Dispatcher.Invoke(guiDelegate, null); program.CompensationFinished += (bool b) => Dispatcher.Invoke(compensationWindowCloseDelegate, null); program.CompensationFinished += Program_CompensationFinished; // fill combo box modes Array modes = Enum.GetValues(typeof(Mode)); foreach (int i in modes) { comboBoxMode.Items.Add(((Mode)i).Name()); } // fill combo box bias modes Array biasmodes = Enum.GetValues(typeof(BiasMode)); foreach (int i in biasmodes) { comboBoxBiasMode.Items.Add(((BiasMode)i).Name()); } // fill frequency combo boxes foreach (int i in Global.Frequencies) { string item; if (i >= 10000) { item = (i / 1000).ToString() + " kHz"; } else { item = i.ToString() + " Hz"; } comboBoxFrequency.Items.Add(item); comboBoxSweepStart.Items.Add(item); comboBoxSweepStop.Items.Add(item); } comboBoxSweepStart.SelectedIndex = 0; // select first item comboBoxSweepStop.SelectedIndex = comboBoxSweepStop.Items.Count - 1; // select last item // bindings in code // Manual / sweep logging Binding menuItemFileLogManualAndSweepBinding = new Binding(nameof(program.LogManualAndSweep)); menuItemFileLogManualAndSweepBinding.Source = program; menuItemFileLogManualAndSweepBinding.Mode = BindingMode.TwoWay; menuItemFileLogManualAndSweep.SetBinding(MenuItem.IsCheckedProperty, menuItemFileLogManualAndSweepBinding); bindingExpressions.Add(menuItemFileLogManualAndSweep.GetBindingExpression(MenuItem.IsCheckedProperty)); // Continuous logging Binding menuItemFileLogAllBinding = new Binding(nameof(program.LogContinuous)); menuItemFileLogAllBinding.Source = program; menuItemFileLogAllBinding.Mode = BindingMode.TwoWay; menuItemFileLogAll.SetBinding(MenuItem.IsCheckedProperty, menuItemFileLogAllBinding); bindingExpressions.Add(menuItemFileLogAll.GetBindingExpression(MenuItem.IsCheckedProperty)); // binding expressions, bindings in XAML bindingExpressions.Add(statusBarBottomFilePath.GetBindingExpression(ContentProperty)); bindingExpressions.Add(statusBarBottomConnection.GetBindingExpression(ContentProperty)); bindingExpressions.Add(textBlockX.GetBindingExpression(TextBlock.TextProperty)); bindingExpressions.Add(labelXUnit.GetBindingExpression(Label.ContentProperty)); bindingExpressions.Add(labelXName.GetBindingExpression(Label.ContentProperty)); bindingExpressions.Add(textBlockY.GetBindingExpression(TextBlock.TextProperty)); bindingExpressions.Add(labelYUnit.GetBindingExpression(Label.ContentProperty)); bindingExpressions.Add(labelYName.GetBindingExpression(Label.ContentProperty)); bindingExpressions.Add(radioButtonMeasureSingle.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonMeasureContinuous.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonModelSeries.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonModelParallel.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonAveragingNone.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonAveragingSix.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonSpeedFast.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonSpeedMedium.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(radioButtonSpeedSlow.GetBindingExpression(RadioButton.IsCheckedProperty)); bindingExpressions.Add(textBoxVoltage.GetBindingExpression(TextBox.TextProperty)); bindingExpressions.Add(comboBoxMode.GetBindingExpression(ComboBox.SelectedIndexProperty)); bindingExpressions.Add(comboBoxFrequency.GetBindingExpression(ComboBox.SelectedIndexProperty)); bindingExpressions.Add(buttonSweepStartStop.GetBindingExpression(Button.ContentProperty)); bindingExpressions.Add(comboBoxMode.GetBindingExpression(ComboBox.IsEnabledProperty)); bindingExpressions.Add(comboBoxFrequency.GetBindingExpression(ComboBox.IsEnabledProperty)); bindingExpressions.Add(textBoxVoltage.GetBindingExpression(TextBox.IsEnabledProperty)); bindingExpressions.Add(buttonFrequencyUp.GetBindingExpression(Button.IsEnabledProperty)); bindingExpressions.Add(buttonFrequencyDown.GetBindingExpression(Button.IsEnabledProperty)); bindingExpressions.Add(groupBoxCompensation.GetBindingExpression(GroupBox.IsEnabledProperty)); bindingExpressions.Add(groupBoxCompensation.GetBindingExpression(GroupBox.IsEnabledProperty)); bindingExpressions.Add(groupBoxTrigger.GetBindingExpression(GroupBox.IsEnabledProperty)); bindingExpressions.Add(groupBoxModel.GetBindingExpression(GroupBox.IsEnabledProperty)); bindingExpressions.Add(groupBoxAveraging.GetBindingExpression(GroupBox.IsEnabledProperty)); bindingExpressions.Add(groupBoxSpeed.GetBindingExpression(GroupBox.IsEnabledProperty)); bindingExpressions.Add(gridFrequencyInner.GetBindingExpression(Grid.IsEnabledProperty)); bindingExpressions.Add(labelSweepRepeatsRemaining.GetBindingExpression(Label.ContentProperty)); bindingExpressions.Add(menuItemFileClose.GetBindingExpression(MenuItem.IsEnabledProperty)); bindingExpressions.Add(viewBoxInstrument.GetBindingExpression(Viewbox.VisibilityProperty)); bindingExpressions.Add(viewBoxInstrument.GetBindingExpression(Viewbox.ToolTipProperty)); bindingExpressions.Add(textBoxBiasVoltage.GetBindingExpression(TextBox.IsEnabledProperty)); bindingExpressions.Add(textBoxBiasCurrent.GetBindingExpression(TextBox.IsEnabledProperty)); bindingExpressions.Add(checkBoxConstantVoltage.GetBindingExpression(CheckBox.IsEnabledProperty)); bindingExpressions.Add(gridBiasVoltageSetting.GetBindingExpression(Grid.VisibilityProperty)); bindingExpressions.Add(gridBiasCurrentSetting.GetBindingExpression(Grid.VisibilityProperty)); }
public void takeDamage(int amount) { health = health - amount; calculateHealthPercentage(); GUIDelegate.updateHealthUI(this); }
public void DoGUIUpdate(string paramString) { if (this.InvokeRequired) { GUIDelegate delegateMethod = new GUIDelegate(this.DoGUIUpdate); this.Invoke(delegateMethod, new object[] { paramString }); } else { if (!this.textBox1.Focused) { this.textBox1.Text = paramString; } this.pictureBox1.BackColor = Color.GhostWhite; this.pictureBox2.BackColor = Color.GhostWhite; this.pictureBox3.BackColor = Color.GhostWhite; this.pictureBox4.BackColor = Color.GhostWhite; this.pictureBox5.BackColor = Color.GhostWhite; this.pictureBox6.BackColor = Color.GhostWhite; this.pictureBox7.BackColor = Color.GhostWhite; this.pictureBox8.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut1.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut2.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut3.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut4.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut5.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut6.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut7.BackColor = Color.GhostWhite; this.pictureBoxDigitalOut8.BackColor = Color.GhostWhite; if (ucModule.digitalInput[0] == 1) { this.pictureBox1.BackColor = Color.Green; } if (ucModule.digitalInput[1] == 1) { this.pictureBox2.BackColor = Color.Green; } if (ucModule.digitalInput[2] == 1) { this.pictureBox3.BackColor = Color.Green; } if (ucModule.digitalInput[3] == 1) { this.pictureBox4.BackColor = Color.Green; } if (ucModule.digitalInput[4] == 1) { this.pictureBox5.BackColor = Color.Green; } if (ucModule.digitalInput[5] == 1) { this.pictureBox6.BackColor = Color.Green; } if (ucModule.digitalInput[6] == 1) { this.pictureBox7.BackColor = Color.Green; } if (ucModule.digitalInput[7] == 1) { this.pictureBox8.BackColor = Color.Green; } if (ucModule.digitalOutput[0] == 1) { this.pictureBoxDigitalOut1.BackColor = Color.Green; } if (ucModule.digitalOutput[1] == 1) { this.pictureBoxDigitalOut2.BackColor = Color.Green; } if (ucModule.digitalOutput[2] == 1) { this.pictureBoxDigitalOut3.BackColor = Color.Green; } if (ucModule.digitalOutput[3] == 1) { this.pictureBoxDigitalOut4.BackColor = Color.Green; } if (ucModule.digitalOutput[4] == 1) { this.pictureBoxDigitalOut5.BackColor = Color.Green; } if (ucModule.digitalOutput[5] == 1) { this.pictureBoxDigitalOut6.BackColor = Color.Green; } if (ucModule.digitalOutput[6] == 1) { this.pictureBoxDigitalOut7.BackColor = Color.Green; } if (ucModule.digitalOutput[7] == 1) { this.pictureBoxDigitalOut8.BackColor = Color.Green; } } }