public TickSliderBar(BindableBeatDivisor beatDivisor, params int[] divisors) { CurrentNumber.BindTo(this.beatDivisor = beatDivisor); availableDivisors = divisors; Padding = new MarginPadding { Horizontal = 5 }; }
public TickSliderBar(BindableBeatDivisor beatDivisor) { CurrentNumber.BindTo(this.beatDivisor = beatDivisor); Padding = new MarginPadding { Horizontal = 5 }; }
protected override void LoadComplete() { base.LoadComplete(); CurrentNumber.BindValueChanged(div => { marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint); marker.Flash(); }, true); }
private void Input_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { Compute(); return; } if (char.IsDigit(e.KeyChar) || e.KeyChar == '.') { Button btn = new Button(); btn.Text = e.KeyChar.ToString(); Digit_Click(btn, e); e.Handled = true; } else if (char.IsControl(e.KeyChar)) //backspace { try { if (char.IsSymbol(Input.Text[Input.TextLength - 1])) // handle deleting operation { OperationIsSet = false; Operation = ' '; CurrentNumber = String.Copy(Input.Text.Substring(0, Input.TextLength - 1)); } else if (CurrentNumber.Length != 0) { CurrentNumber = CurrentNumber.Substring(0, CurrentNumber.Length - 1); } } catch { } } else if (IsMathSymbol(e.KeyChar)) { Button btn = new Button(); btn.Text = e.KeyChar.ToString(); Operation_Click(btn, e); e.Handled = true; } else { e.Handled = true; } Input.Select(Input.TextLength, 0); }
public void Update() { if (CurrentNumber != desiredNumber) { if (InitialNumber < desiredNumber) { CurrentNumber += (animationTime * Time.deltaTime) * (desiredNumber - InitialNumber); if (CurrentNumber >= desiredNumber) { CurrentNumber = desiredNumber; } } else { CurrentNumber += (animationTime * Time.deltaTime) * (InitialNumber - desiredNumber); if (CurrentNumber <= desiredNumber) { CurrentNumber = desiredNumber; } } if (InitialNumber2 < desiredNumber2) { CurrentNumber2 += (animationTime * Time.deltaTime) * (desiredNumber2 - InitialNumber2); if (CurrentNumber2 >= desiredNumber2) { CurrentNumber2 = desiredNumber2; } } else { CurrentNumber2 += (animationTime * Time.deltaTime) * (InitialNumber2 - desiredNumber2); if (CurrentNumber2 <= desiredNumber2) { CurrentNumber2 = desiredNumber2; } } Score.text = CurrentNumber.ToString("0"); Coins.text = CurrentNumber2.ToString("0"); } }
private void updateDivisors() { ClearInternal(); CurrentNumber.ValueChanged -= moveMarker; foreach (int divisor in beatDivisor.ValidDivisors.Value.Presets) { AddInternal(new Tick(divisor) { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, Colour = BindableBeatDivisor.GetColourFor(divisor, colours), X = getMappedPosition(divisor), }); } AddInternal(marker = new Marker()); CurrentNumber.ValueChanged += moveMarker; CurrentNumber.TriggerChange(); }
private string GetCoordText(Point3d pt) { string text = ""; if (AutoNumbering) { text = "{\\L" + Prefix + CurrentNumber.ToString() + "}"; } else { string format = "0." + new string('0', Precision); if (Precision == 0) { format = "0"; } string xtext = "X=" + pt.X.ToString(format); string ytext = "Y=" + pt.Y.ToString(format); string ztext = "Z=" + pt.Z.ToString(format); int maxlen = Math.Max(xtext.Length, ytext.Length); xtext += new string(' ', maxlen - xtext.Length); ytext += new string(' ', maxlen - ytext.Length); ztext += new string(' ', maxlen - ztext.Length); if (ShowZCoordinate) { text = "\\P" + "{\\L" + xtext + "}" + "\\P" + ytext + "\\P" + ztext; } else { text = "{\\L" + xtext + "}" + "\\P" + ytext; } } return(text); }
private void Digit_Click(object sender, EventArgs e) { Button btn = sender as Button; char charDigit = btn.Text[0]; if (charDigit == '.') { if (CurrentNumber.Contains('.')) { return; } else { CurrentNumber += '.'; Input.Text += '.'; } } if (char.IsDigit(charDigit)) { CurrentNumber += charDigit; Input.Text += charDigit; } }
protected override void LoadComplete() { base.LoadComplete(); CurrentNumber.BindValueChanged(current => updateTooltipText(current.NewValue), true); }
private void SetLabels() { lblCurrentMove.Text = CurrentNumber.ToString(); lblWaitingsCount.Text = People.Count.ToString(); }
public void Coord() { if (!CheckLicense.Check()) { return; } Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Autodesk.AutoCAD.DatabaseServices.Database db = doc.Database; if (!init) { if (!ShowSettings()) { return; } } bool flag = true; ObjectId textStyleId = ObjectId.Null; using (Transaction tr = db.TransactionManager.StartTransaction()) using (TextStyleTable tt = (TextStyleTable)tr.GetObject(db.TextStyleTableId, OpenMode.ForRead)) { if (tt.Has(TextStyleName)) { textStyleId = tt[TextStyleName]; } tr.Commit(); } Matrix3d ucs2wcs = AcadUtility.AcadGraphics.UcsToWcs; while (flag) { PromptPointResult pointRes = null; if (AutoNumbering) { PromptPointOptions pointOpts = new PromptPointOptions("\n" + CurrentNumber.ToString() + ". Koordinat yeri: [Reset/Liste/Seç]", "Reset List Select"); pointRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint(pointOpts); } else { PromptPointOptions pointOpts = new PromptPointOptions("\nKoordinat yeri: [Reset/Seç]", "Reset Select"); pointRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint(pointOpts); } if (pointRes.Status == PromptStatus.Cancel) { return; } else if (pointRes.Status == PromptStatus.Keyword && pointRes.StringResult == "Reset") { Reset(); return; } else if (pointRes.Status == PromptStatus.Keyword && pointRes.StringResult == "List") { PromptPointOptions listOpts = new PromptPointOptions("\nListe yeri: "); PromptPointResult listRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint(listOpts); ShowList(listRes.Value); return; } else if (pointRes.Status == PromptStatus.Keyword && pointRes.StringResult == "Select") { using (SelectObjectsForm form = new SelectObjectsForm()) { if (Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(form) == System.Windows.Forms.DialogResult.OK) { // Select objects List <TypedValue> tvs = new List <TypedValue>(); switch (form.SelectObjects) { case SelectObjectsForm.SelectCoordinateObjects.Polyline: tvs.Add(new TypedValue((int)DxfCode.Operator, "<OR")); tvs.Add(new TypedValue((int)DxfCode.Start, "LWPOLYLINE")); tvs.Add(new TypedValue((int)DxfCode.Start, "POLYLINE")); tvs.Add(new TypedValue((int)DxfCode.Operator, "OR>")); break; case SelectObjectsForm.SelectCoordinateObjects.Circle: tvs.Add(new TypedValue((int)DxfCode.Operator, "<OR")); tvs.Add(new TypedValue((int)DxfCode.Start, "CIRCLE")); tvs.Add(new TypedValue((int)DxfCode.Start, "ARC")); tvs.Add(new TypedValue((int)DxfCode.Start, "ELLIPSE")); tvs.Add(new TypedValue((int)DxfCode.Operator, "OR>")); break; case SelectObjectsForm.SelectCoordinateObjects.Block: tvs.Add(new TypedValue((int)DxfCode.Start, "INSERT")); break; case SelectObjectsForm.SelectCoordinateObjects.Point: tvs.Add(new TypedValue((int)DxfCode.Start, "POINT")); break; case SelectObjectsForm.SelectCoordinateObjects.Line: tvs.Add(new TypedValue((int)DxfCode.Start, "LINE")); break; } SelectionFilter filter = new SelectionFilter(tvs.ToArray()); PromptSelectionResult selRes = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetSelection(filter); if (selRes.Status == PromptStatus.OK) { using (Transaction tr = db.TransactionManager.StartTransaction()) using (BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)) { TextPositioner positioner = new TextPositioner(ucs2wcs, TextRotation * Math.PI / 180, LineLength); // Read object coordinates List <TextPositioner.SelectedObjectCoordinate> objectPoints = new List <TextPositioner.SelectedObjectCoordinate>(); foreach (ObjectId id in selRes.Value.GetObjectIds()) { if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.Polyline))) { Autodesk.AutoCAD.DatabaseServices.Polyline obj = tr.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Polyline; positioner.ClearPoints(); for (int i = 0; i < obj.NumberOfVertices; i++) { positioner.AddPoint(obj.GetPoint3dAt(i)); } objectPoints.AddRange(positioner.GetPositions()); } else if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.Circle))) { Circle obj = tr.GetObject(id, OpenMode.ForRead) as Circle; objectPoints.Add(positioner.GetPosition(obj.Center)); } else if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.Arc))) { Arc obj = tr.GetObject(id, OpenMode.ForRead) as Arc; objectPoints.Add(positioner.GetPosition(obj.Center)); } else if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.Ellipse))) { Ellipse obj = tr.GetObject(id, OpenMode.ForRead) as Ellipse; objectPoints.Add(positioner.GetPosition(obj.Center)); } else if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.BlockReference))) { BlockReference obj = tr.GetObject(id, OpenMode.ForRead) as BlockReference; objectPoints.Add(positioner.GetPosition(obj.Position)); } else if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.DBPoint))) { DBPoint obj = tr.GetObject(id, OpenMode.ForRead) as DBPoint; objectPoints.Add(positioner.GetPosition(obj.Position)); } else if (id.ObjectClass == Autodesk.AutoCAD.Runtime.RXObject.GetClass(typeof(Autodesk.AutoCAD.DatabaseServices.Line))) { Line obj = tr.GetObject(id, OpenMode.ForRead) as Line; positioner.ClearPoints(); positioner.AddPoint(obj.StartPoint); positioner.AddPoint(obj.EndPoint); objectPoints.AddRange(positioner.GetPositions()); } } // Sort coordinates objectPoints.Sort((p1, p2) => { switch (form.Ordering) { case SelectObjectsForm.CoordinateOrdering.IncreasingX: return(p1.BasePoint.X < p2.BasePoint.X ? -1 : 1); case SelectObjectsForm.CoordinateOrdering.IncreasingY: return(p1.BasePoint.Y < p2.BasePoint.Y ? -1 : 1); case SelectObjectsForm.CoordinateOrdering.DecreasingX: return(p1.BasePoint.X > p2.BasePoint.X ? -1 : 1); case SelectObjectsForm.CoordinateOrdering.DecreasingY: return(p1.BasePoint.Y > p2.BasePoint.Y ? -1 : 1); default: return(0); } }); // Write coordinates foreach (TextPositioner.SelectedObjectCoordinate coord in objectPoints) { MText mtext = CreateText(textStyleId, coord.TextPoint); btr.AppendEntity(mtext); tr.AddNewlyCreatedDBObject(mtext, true); // Rotate text if (coord.TextToLeft) { mtext.Attachment = (AutoNumbering ? AttachmentPoint.BottomRight : AttachmentPoint.MiddleRight); } else { mtext.Attachment = (AutoNumbering ? AttachmentPoint.BottomLeft : AttachmentPoint.MiddleLeft); } Line line = new Line(); line.StartPoint = coord.BasePoint; line.EndPoint = coord.TextPoint; btr.AppendEntity(line); tr.AddNewlyCreatedDBObject(line, true); points.Add(new CoordPoint(CurrentNumber, coord.BasePoint)); if (AutoNumbering) { CurrentNumber = CurrentNumber + 1; } } tr.Commit(); } } } } return; } else { Point3d pCoord = pointRes.Value.TransformBy(ucs2wcs); using (Transaction tr = db.TransactionManager.StartTransaction()) using (BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)) { MText mtext = CreateText(textStyleId, pCoord); btr.AppendEntity(mtext); tr.AddNewlyCreatedDBObject(mtext, true); if (CoordinateJig.Jig(pointRes.Value, mtext, AutoLine, LineLength, AutoRotateText, TextRotation)) { points.Add(new CoordPoint(CurrentNumber, pCoord)); if (AutoNumbering) { CurrentNumber = CurrentNumber + 1; } Line line = new Line(); line.StartPoint = pCoord; line.EndPoint = mtext.Location; btr.AppendEntity(line); tr.AddNewlyCreatedDBObject(line, true); tr.Commit(); } else { mtext.Dispose(); tr.Abort(); return; } } } } }
private void CustomNumeric_Paint(object sender, PaintEventArgs e) { //metroTextBoxValue.Text = numberCurrent.ToString(); labelNumValue.Text = CurrentNumber.ToString(); }
public void DrawWheel() { //Draws Two Rows of Current Color for each bin for room above number for (int k = 0; k < 2; k++) { Console.BackgroundColor = ConsoleColor.Black; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[PreviousNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[CurrentNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[NextNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" \n"); } //Draws a border and the ball in the bin Console.BackgroundColor = ConsoleColor.Black; Console.Write(" "); Console.ForegroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.White; Console.Write("| | @ | |\n"); Console.ForegroundColor = ConsoleColor.White; //Displays a row of the associated color bin to give space above number Console.BackgroundColor = ConsoleColor.Black; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[PreviousNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[CurrentNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[NextNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" \n"); //Draws number and color of bin Console.BackgroundColor = ConsoleColor.Black; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[PreviousNumber.Trim()]; Console.Write($" {PreviousNumber} "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[CurrentNumber.Trim()]; Console.Write($" {CurrentNumber} "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[NextNumber.Trim()]; Console.Write($" {NextNumber} "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" \n"); //Provides some space below the number Console.BackgroundColor = ConsoleColor.Black; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[PreviousNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[CurrentNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); Console.BackgroundColor = Bin.NumberColor[NextNumber.Trim()]; Console.Write(" "); Console.BackgroundColor = ConsoleColor.White; Console.Write(" \n"); }