private RenderFragment BuildSVG_hourShadow(options opt) => builder => { //radius,value,klasa,transform // Console.WriteLine($"opt.value {opt.value}"); if (opt.value > 0) { var x = Math.Cos((2 * Math.PI) / (100 / opt.value)); var y = Math.Sin((2 * Math.PI) / (100 / opt.value)); //should the arc go the long way round? var longArc = (opt.value <= 50) ? 0 : 1; //d is a string that describes the path of the slice. var d = "M" + opt.radius + "," + opt.radius + " L" + opt.radius + "," + 0 + " A" + opt.radius + "," + opt.radius + " 0 " + longArc + ",1 " + (int)Math.Round(opt.radius + (y * opt.radius), 0) + "," + (int)Math.Round(opt.radius - (x * opt.radius), 0) + " z"; // Console.WriteLine($"d: {d}"); var m = new metrics { Name = "hourhandShadow", klasa = opt.klasa, number = 1 }; builder.OpenElement(0, "path"); builder.AddAttribute(1, "id", "hourhandShadow"); builder.AddAttribute(2, "d", d); builder.AddAttribute(3, "class", opt.klasa); builder.AddAttribute(4, "transform", opt.transform); builder.AddAttribute(5, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create <MouseEventArgs>(this, (MouseEventArgs e) => IncrementBuilder(e, m))); builder.CloseElement(); } };
public ActionResult DeleteConfirmed(int id) { //TODO: This action need to be deeply reviewed metrics metric = db.metrics.Find(id); db.metrics.Remove(metric); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,name,tips, direction, upperBound, lowerBound ")] metrics metricentry) { //TODO: This action need to be deeply reviewed if (ModelState.IsValid) { db.Entry(metricentry).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(metricentry)); }
public ActionResult Create([Bind(Include = "ID,name,tips, direction, upperBound, lowerBound ")] metrics metricentry) { //1. Convert the entry to Db Model if (ModelState.IsValid == false) { db.metrics.Add(metricentry); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(metricentry)); }
protected void IncrementBuilder(MouseEventArgs arg, metrics def) { Thresholdcounter += 1; Console.WriteLine($"invoked threshold {def.Name}, {def.klasa}, {arg.ClientX}, {arg.ClientY}"); ThresholdReachedEventArgs args = new ThresholdReachedEventArgs(); args.Threshold = Thresholdcounter; args.TimeReached = DateTime.Now; args.Name = def.Name; if (ThresholdcounterTotal <= Thresholdcounter) { OnThresholdReached(args); } }
/// <summary> /// /// </summary> public static void SaveSettings() { metrics overview = new metrics(); overview.Metrics_MachineName = app_metrics.GetMachineName(); overview.Metrics_OSVersion = app_metrics.GetOSVersion(); System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(metrics)); var path = app_vars_metrics.json_settings_path.ToString(); FileStream file = File.Create(path); writer.Serialize(file, overview); file.Close(); }
// GET: metrics/Edit/5 public ActionResult Edit(int?id) { //TODO: This action need to be deeply reviewed if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } metrics metric = db.metrics.Find(id); if (metric == null) { return(HttpNotFound()); } return(View(metric)); }
private RenderFragment BuildSVG_minutehand(string transform = "") => builder => { // <line id="minutehand" x1="50" y1="50" x2="50" y2="20" /> var m = new metrics { Name = "minutehand", klasa = "n/a", number = 203 }; builder.OpenElement(0, "line"); builder.AddAttribute(1, "id", "minutehand"); builder.AddAttribute(2, "x1", "50"); builder.AddAttribute(3, "y1", "50"); builder.AddAttribute(4, "x2", "50"); builder.AddAttribute(5, "y2", "20"); builder.AddAttribute(6, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create <MouseEventArgs>(this, (MouseEventArgs e) => IncrementBuilder(e, m))); // builder.AddAttribute(6, "stroke", min_color); builder.AddAttribute(7, "transform", transform); builder.CloseElement(); };