private void ReDraw(object sender, EventArgs e) { DrawDelegate delegate2; int num; if (this.ViewStylemy == ViewStyle.Spec) { delegate2 = new DrawDelegate(this.Draw); num = ((this.btnGetSpecClickNum - 1) < 0) ? 0 : (this.btnGetSpecClickNum - 1); if (Spectrometer.DataGet.Length > 0) { base.BeginInvoke(delegate2, new object[] { "光谱图", Spectrometer.DataGet, num }); } } else if (this.ViewStylemy == ViewStyle.Energy) { delegate2 = new DrawDelegate(this.Draw); num = ((this.btnGetSpecClickNum - 1) < 0) ? 0 : (this.btnGetSpecClickNum - 1); if (Spectrometer.DataGet != null) { base.BeginInvoke(delegate2, new object[] { "能量图", Spectrometer.DataGet, num }); } } else if (this.ViewStylemy == ViewStyle.Mean) { this.btnMeanView_Click(sender, e); } else if (this.ViewStylemy == ViewStyle.StdErr) { this.btnStdErrView_Click(sender, e); } }
public static void IfChangedThen(DrawDelegate ifChanged, ChangeDelegate then) { if (ChangeCheck(ifChanged) && then != null) { then(); } }
public void DrawAtWord(string word, DrawDelegate drawDelegate, IAdornmentLayer layer, IWpfTextView view, IWpfTextViewLineCollection textViewLines, Brush brush, Pen pen) { string str = ToString(); int startIndex = 0; while (true) { if (startIndex >= str.Length) { break; } var tmp = str.Substring(startIndex); int index = tmp.IndexOf(word); if (index == -1) { break; } for (int i = startIndex + index; i < startIndex + index + word.Length; i++) { Chars[i].DrawDelegate = drawDelegate; Chars[i].Draw(layer, view, textViewLines, brush, pen, Chars[i].IndexInLine); } startIndex += index + word.Length; } }
private void DrawEnergyValue() { for (int i = 0; i < SpInfo.numPixls; i++) { if (SpInfo.WavelengthArray[i] > 10000000000) { SpInfo.WavelengthArray[i] = SpInfo.WavelengthArray[i - 1]; } if (SpInfo.DataA[i] > 10000000000) { SpInfo.DataA[i] = SpInfo.DataA[i - 1]; } } SpInfo.DataX = SpInfo.WavelengthArray; SpInfo.w1 = Math.Floor((double)(SpInfo.DataX[0] / 100.0)) * 100.0; SpInfo.w2 = Math.Ceiling((double)(SpInfo.DataX[SpInfo.DataX.Length - 1] / 100.0)) * 100.0; Spectrometer.Data[] dataGet = new Spectrometer.Data[1]; dataGet[0].DataX = SpInfo.WavelengthArray; dataGet[0].DataE = SpInfo.DataA; this.ViewStylemy = ViewStyle.Energy; DrawDelegate delegate2 = new DrawDelegate(this.Draw); this.Draw("能量图", dataGet, 0); this.txtMeanErr.Text = this.DataHandlingmy.MeanValue(dataGet[0].DataE).ToString("0.000e0"); this.txtMaxStdErr.Text = this.DataHandlingmy.MaxValue(dataGet[0].DataE).ToString("0.000e0"); }
private HighscoreManager(GameState gameState, bool onlyHighscore) { _gameState = gameState; _pixelWhite = Main.ContentManager.Load<Texture2D>("images/pixelWhite"); _highscore = Main.ContentManager.Load<Texture2D>("images/highscore/highscore"); _score = Main.ContentManager.Load<Texture2D>("images/highscore/score"); if (!onlyHighscore) { _updateDelegate = UpdateScore; _drawDelegate = DrawScore; } else { _updateDelegate = UpdateHighscore; _drawDelegate = DrawHighscore; } _font = Main.ContentManager.Load<SpriteFont>(Configuration.Get("defaultFont")); // Koordinaten DrawHelper.AddDimension("Score_Name", 300, 411); DrawHelper.AddDimension("Score_Gesamt", 1, 175); DrawHelper.AddDimension("Score_LineHeight", 1, 60); DrawHelper.AddDimension("Score_XKoods", 160, 560); DrawHelper.AddDimension("Highscore_XKoods", 200, 500); }
public void Draw() { var font = ImGui.GetFont(); if (Children.Count <= 0) { DrawDelegate?.Invoke(); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } return; } for (var i = 0; i < 5; i++) { ImGui.Spacing(); } ImGui.BeginGroup(); var contentRegionAvail = ImGui.GetContentRegionAvail(); var firstCursorPos = ImGui.GetCursorPos().Translate(10, font.FontSize * -0.66f); ImGui.BeginChild(Unique, new Vector2(contentRegionAvail.X, font.FontSize * 2 * (Children.Count + 0.2f)), true); foreach (var child in Children) { child.Draw(); } var secondCursorPos = ImGui.GetCursorPos().Translate(0, font.FontSize); ImGui.EndChild(); ImGui.SetCursorPos(firstCursorPos); ImGui.Text(Name); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } ImGui.SetCursorPos(secondCursorPos); ImGui.EndGroup(); DrawDelegate?.Invoke(); }
public static bool ToggleGroup(string label, bool toggle, DrawDelegate draw) { toggle = EditorGUILayout.BeginToggleGroup(label, toggle); EditorGUILayoutHelper.Indent(draw); EditorGUILayout.EndToggleGroup(); return(toggle); }
/// <summary> /// Draws to any window by drawing delegate and handler /// </summary> /// <param name="drawFunct"></param> /// <param name="hWnd"></param> public static void DrawToWnd(this DrawDelegate drawFunct, IntPtr hWnd) { using (Graphics g = Graphics.FromHwnd(hWnd)) { drawFunct(g); } }
public Projectile(Vector2 vo, Vector2 pos0, DrawDelegate drawAction) { V0 = vo; V = V0; _pos0 = pos0; Pos = _pos0; _drawAction = drawAction; }
static void OverrideDraw(GLib.GType gtype) { if (DrawCallback == null) { DrawCallback = new DrawDelegate(Draw_cb); } gnomesharp_canvas_item_override_draw(gtype.Val, DrawCallback); }
void visualize2() { if (temppostList == null) { temppostList = postList1; drawDelegate = new DrawDelegate(drawLine); pictureBox1.Invoke(drawDelegate, 1, Color.FromArgb(50, 170, 160, 255), 400, 0, ymax - K * ymax / 4.0 - 200, xmax, ymax - K * ymax / 4.0 - 200); drawDelegate = new DrawDelegate(drawLine); pictureBox1.Invoke(drawDelegate, 1, Color.FromArgb(50, 255, 255, 255), 5, 0, ymax - ymax / 4.0, xmax, ymax - ymax / 4.0); drawStringDelegate = new DrawStringDelegate(drawString); pictureBox1.Invoke(drawStringDelegate, 1, "K=1", 15, 0, ymax - ymax / 4.0); drawStringDelegate = new DrawStringDelegate(drawString); pictureBox1.Invoke(drawStringDelegate, 1, "K=2", 15, 0, ymax - 2 * ymax / 4.0); drawStringDelegate = new DrawStringDelegate(drawString); pictureBox1.Invoke(drawStringDelegate, 1, "K=3", 15, 0, ymax - 3 * ymax / 4.0); drawStringDelegate = new DrawStringDelegate(drawString); pictureBox1.Invoke(drawStringDelegate, 1, "K=4", 15, 0, ymax - 4 * ymax / 4.0); } else { r = new Random(); int inc = 1; // var sortedGroupList = getSortedGroups(groupList); foreach (Group group in groupList) { drawDelegate = new DrawDelegate(drawLine); pictureBox1.Invoke(drawDelegate, 1, group.color, 20, xmax - 150, inc * 15, xmax - 100, inc * 15); drawStringDelegate = new DrawStringDelegate(drawString); pictureBox1.Invoke(drawStringDelegate, 1, group.name, 10, xmax - 100, inc * 15 - 10); foreach (Post post in postList1) { if (post.K != 0 && group.domain == post.domain) { if (post.item.MarkedAsAds == 0) { foreach (Post tpost in temppostList) { if (tpost.id == post.id && tpost.groupId == post.groupId) { drawDelegate = new DrawDelegate(drawLine); pictureBox1.Invoke(drawDelegate, 1, group.color, 1, tempX, ymax - tpost.K * ymax / 50.0, tempX + Xinterval, ymax - post.K * ymax / 50.0); } } } } } inc++; } tempX = tempX + Xinterval; temppostList = postList1; } }
public static void FlexibleSpace(DrawDelegate draw) { GUILayout.FlexibleSpace(); if (draw != null) { draw(); } GUILayout.FlexibleSpace(); }
public static void Horizontal(DrawDelegate draw, params GUILayoutOption[] opts) { EditorGUILayout.BeginHorizontal(opts); if (draw != null) { draw(); } EditorGUILayout.EndHorizontal(); }
public static bool Foldout(bool foldout, string content, DrawDelegate draw) { foldout = EditorGUILayout.Foldout(foldout, content); if (foldout) { EditorGUILayoutHelper.Indent(draw); } return(foldout); }
/***********************************************/ void Indent(int in_amount, DrawDelegate in_draw) { GUILayout.BeginHorizontal(); GUILayout.Space(in_amount * 10.0f); if (in_draw != null) { in_draw(); } GUILayout.EndHorizontal(); }
void draw_START() { time_of_start = total_time; stringDelegate = new AutoMiner.StringDelegate(log); richTextBox1.Invoke(stringDelegate, DateTime.Now.TimeOfDay.ToString().Substring(0, 8) + " started", Color.MediumSpringGreen); drawDelegate = new AutoMiner.DrawDelegate(drawLine); picBox.Invoke(drawDelegate, Color.Black, time_of_stop, 10 + day * 20 + day, total_time, 10 + day * 20 + day); }
public void AddUserObject(string name, int x, int y, int width, int height, DrawDelegate drawFunc) { objects.Add(name, new GUIObject() { Name = name, Location = new Point(x, y), Size = new Size(width, height), UserData = drawFunc, Type = GUIObjectType.UserDrawn }); }
// Consider moving since this is not necessarily EditorGUI public static void SetColor(Color color, DrawDelegate draw) { var c = GUI.color; GUI.color = color; if (draw != null) { draw(); } GUI.color = c; }
public static bool ChangeCheck(DrawDelegate draw) { EditorGUI.BeginChangeCheck(); if (draw != null) { draw(); } return(EditorGUI.EndChangeCheck()); }
public static void HorizontalFlexibleRight(DrawDelegate draw) { Horizontal(() => { if (draw != null) { draw(); } GUILayout.FlexibleSpace(); }); }
public ConcurrentRenderer( Func <Action, Task> queueDrawFunc, DrawDelegate drawAction, Action drawCompleteAction ) { _drawAction = drawAction; _drawCompleteAction = drawCompleteAction; _queueDrawFunc = queueDrawFunc; _snapshotHandler = new SnapshotHandler(this); }
public FormDisplay() { InitializeComponent(); base.FormClosing += new FormClosingEventHandler(ViewClosing); base.Load += new EventHandler(FormLoad); textInput.KeyDown += new KeyEventHandler(InputKeyDown); _clear = new ClearDelegate(Clear); _draw = new DrawDelegate(Draw); _print = new PrintDelegate(Print); }
void draw_STOP() { time_of_stop = total_time; mining_time = (time_of_stop - time_of_start); stringDelegate = new AutoMiner.StringDelegate(log); richTextBox1.Invoke(stringDelegate, DateTime.Now.TimeOfDay.ToString().Substring(0, 8) + " stop", Color.SkyBlue); var ts = TimeSpan.FromSeconds(Math.Round(mining_time * 240.0)); richTextBox1.Invoke(stringDelegate, " mining time = " + ts.ToString().Substring(0, 8), Color.White); drawDelegate = new AutoMiner.DrawDelegate(drawLine); picBox.Invoke(drawDelegate, Color.FromArgb(255, 0, 255, 0), time_of_start, 10 + day * 20 + day, total_time, 10 + day * 20 + day); }
private void btnBackGrd_Click(object sender, EventArgs e) { byte[] buffer; this.timer1.Enabled = false; try { if (!Home.serialPortSetDevice.IsOpen) { Home.serialPortSetDevice.Open(); } buffer = Home.SPControlWord["LightOn"]; Home.serialPortSetDevice.Write(buffer, 0, buffer.Length); Thread.Sleep(500); buffer = Home.SPControlWord["ReferenceOn"]; Home.serialPortSetDevice.Write(buffer, 0, buffer.Length); Thread.Sleep(500); } catch (Exception exception1) { MessageBox.Show(exception1.ToString()); return; } this.prgsBarGetEnergy.Visible = true; this.MySpectrometer._ProgressBar = this.prgsBarGetEnergy; this.MySpectrometer.GetSingleBeam(Spectrometer.spectrometerIndex, ref SpInfo, true); SpInfo.DataAB = SpInfo.DataA; SpInfo.DataA = null; this.DataIOmy.TXTSaveData(Application.StartupPath.ToString() + @"\background", SpInfo.DataX, SpInfo.DataAB); Spectrometer.Data[] dataGet = new Spectrometer.Data[1]; dataGet[0].DataX = SpInfo.WavelengthArray; dataGet[0].DataE = SpInfo.DataA; this.ViewStylemy = ViewStyle.Energy; DrawDelegate method = new DrawDelegate(this.Draw); base.BeginInvoke(method, new object[] { "能量图", dataGet, 0 }); this.Draw("背景能量图", dataGet, 0); this.MySpectrometer.ReadDK(ref SpInfo); MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); try { if (!Home.serialPortSetDevice.IsOpen) { Home.serialPortSetDevice.Open(); } buffer = Home.SPControlWord["ReferenceOff"]; Home.serialPortSetDevice.Write(buffer, 0, buffer.Length); } catch (Exception exception2) { MessageBox.Show(exception2.ToString()); } }
public void Draw() { // load ortho projection GL.MatrixMode(MatrixMode.Projection); GL.PushMatrix(); GL.LoadMatrix(ref orthoMatrix); GL.PushAttrib(AttribMask.CurrentBit | AttribMask.DepthBufferBit | AttribMask.LightingBit); GL.MatrixMode(MatrixMode.Modelview); GL.PushMatrix(); { GL.Disable(EnableCap.Lighting); GL.LoadIdentity(); GL.Disable(EnableCap.DepthTest); if (isDirty) { UpdateTexture(); } // draw user objects foreach (KeyValuePair <string, GUIObject> kvp in objects) { if (kvp.Value.Type == GUIObjectType.UserDrawn) { DrawDelegate func = (DrawDelegate)kvp.Value.UserData; if (func != null) { func(new Rectangle( kvp.Value.Location.X, kvp.Value.Location.Y, kvp.Value.Size.Width, kvp.Value.Size.Height), fullScreenQuad); } } } canvas.Bind(); fullScreenQuad.Position = new Vector3(0, 0, -1.0f); fullScreenQuad.Draw(); fullScreenQuad.Position = new Vector3(0, 0, 0); canvas.Unbind(); } GL.PopMatrix(); GL.PopAttrib(); // pop ortho projection and set mode back to modelview GL.MatrixMode(MatrixMode.Projection); GL.PopMatrix(); GL.MatrixMode(MatrixMode.Modelview); }
public static void Depth(int depth, DrawDelegate draw) { int old = GUI.depth; GUI.depth = depth; if (draw != null) { draw(); } GUI.depth = old; }
public static void MixedValue(bool mixedValue, DrawDelegate draw) { var old = EditorGUI.showMixedValue; EditorGUI.showMixedValue = mixedValue; if (draw != null) { draw(); } EditorGUI.showMixedValue = old; }
public static void HorizontalFlexible(DrawDelegate draw) { Horizontal(() => { FlexibleSpace(() => { if (draw != null) { draw(); } }); }); }
public static void Enabled(bool enabled, DrawDelegate draw) { var old = GUI.enabled; // Make sure that we can't have enable true in case of already being not enabled GUI.enabled = enabled && old; if (draw != null) { draw(); } GUI.enabled = old; }
public static void Indent(DrawDelegate draw) { if (draw != null) { // ++EditorGUI.indentLevel; EditorGUILayout.BeginHorizontal(); GUILayout.Space(EditorGUIHelper.INDENT_WIDTH); EditorGUILayout.BeginVertical(); draw(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); // --EditorGUI.indentLevel; } }
private void btnClear_Click(object sender, EventArgs e) { this.comboBox1.Items.Clear(); this.btnGetSpecClickNum = 0; this.txtSpName.Text = ""; Spectrometer.DataGet = new Spectrometer.Data[20]; this.MeanY = new double[20, SpInfo.numPixls]; this.StdErrY = new double[20, SpInfo.numPixls]; this.ViewStylemy = ViewStyle.Spec; DrawDelegate method = new DrawDelegate(this.Draw); base.BeginInvoke(method, new object[] { "光谱图", Spectrometer.DataGet, this.btnGetSpecClickNum }); this.timer1.Enabled = true; }
public void Draw(DrawDelegate drawDelegate, IBoard board) { this.Initialize(); Console.Clear(); if (drawDelegate != null) { drawDelegate(board); this.WriteAt($"There is {drawDelegate.GetInvocationList().Count().ToString()} objects on canvas!", 0, 28); } else { this.WriteAt($"Canvas is clean!", 0, 28); } }
static PythonEngine() { Evaluator = delegate(bool dirty, string script, IEnumerable<Binding> bindings) { if (dirty) { engine.ProcessCode(script); dirty = false; } return engine.Evaluate(PythonBindings.Bindings.Concat(bindings)); }; Drawing = delegate(FScheme.Value val, RenderDescription rd) { }; }
static PythonEngine() { Evaluator = delegate(bool dirty, string script, IEnumerable<KeyValuePair<string, dynamic>> bindings) { if (dirty) { Engine.ProcessCode(script); dirty = false; } return Engine.Evaluate(PythonBindings.Bindings.Concat(bindings)); }; Drawing = delegate { }; }
public GenericDrawableComponent(DrawDelegate d) { DrawFunction = d; }
// *********************************************************************** private void UpdateScore() { // Text eingabe verwalten if (Keyboard.GetState().IsKeyUp(lastKey)) { lastKey = Keys.None; } if (Keyboard.GetState().GetPressedKeys().Length > 0 && lastKey == Keys.None) { lastKey = Keyboard.GetState().GetPressedKeys()[0]; if (lastKey == Keys.Back) { if (_inputText.Length != 0) _inputText = _inputText.Substring(0, _inputText.Length - 1); } else if (_inputText.Length < 16) { char input = (char)lastKey.GetHashCode(); if (char.IsLetterOrDigit(input) || input == ' ') _inputText += (char)lastKey.GetHashCode(); } if (lastKey == Keys.Enter) { // Highscore eintragen Score newScore = new Score(); newScore.Name = _inputText; newScore.Points = _gameState.GameStatistic.Highscore; newScore.Round = _gameState.GameStatistic.Round; HighscoreHelper.Add(newScore); // Zu Highscore wechseln _updateDelegate = UpdateHighscore; _drawDelegate = DrawHighscore; } } }
private void draw(DrawDelegate func) { this.func = func; manual = true; this.Invalidate(); }