public IActionResult PutHelp(int id, [FromBody] HelpLines help) { if (id != help.HelpId) { return(BadRequest()); } try { _database.Entry(help).State = EntityState.Modified; _database.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HelpExists(id)) { return(NotFound()); } else { throw; } } return(new JsonResult(new { message = "Updated" })); }
/// <summary> /// Initialize Phiddle to run. This means creating all UI compontents and make /// the service provider ready to serve. /// </summary> public void Initialize() { lastPos = SKPoint.Empty; // Setup services InitializeServices(Services); ServiceProvider = Services.BuildServiceProvider(); screenService = ServiceProvider.GetRequiredService <IScreenService>(); logService = ServiceProvider.GetRequiredService <ILogService>(); appSettingsService = ServiceProvider.GetRequiredService <SettingsService <AppSettings> >(); appStateService = ServiceProvider.GetRequiredService <SettingsService <AppState> >(); // Actions appActions = InitializeActions(); // Screen var s = screenService.Dimensions(); // Tools appTools = new AppTools(s, appStateService.Settings, appSettingsService.Settings); helpLines = new HelpLines(s, appStateService.Settings, appSettingsService.Settings.PaintHelpLines); WindowsSizeFactor = appSettingsService.Settings.WindowSizeFactor; WindowZoomFactor = appSettingsService.Settings.WindowZoomFactor; // Windows windowApp = new Window(SKPoint.Empty, ToolWindowSize, appSettingsService.Settings.WindowApp); windowInfo = new WindowTextInfo(SKPoint.Empty, InfoWindowSize, appSettingsService.Settings.WindowInfo); windowZoom = new WindowZoom(SKPoint.Empty, ZoomWindowSize, appSettingsService.Settings.WindowZoom) { CrosshairVisible = !helpLines.Visible } ; // Calculate initial locations of windows with relative positions #if DEBUG var wm = appSettingsService.Settings.WindowMargin + windowApp.PaintBorder.StrokeWidth; #else var wm = appSettingsService.Settings.WindowMargin; #endif var zx = s.Right - windowZoom.Bounds.Width - wm * 2; var zy = s.Bottom - windowZoom.Bounds.Height - wm * 2; ZoomWindowLocation = new SKPoint(zx, zy); var ix = s.Right - windowInfo.Bounds.Width - wm * 2; var iy = s.Bottom - windowInfo.Bounds.Height - windowZoom.Bounds.Height - wm * 4; InfoWindowLocation = new SKPoint(ix, iy); // Setup refresh timer timer = new Timer(50) { AutoReset = true }; timer.Elapsed += new ElapsedEventHandler(TimerElapsed); logService.Debug("Initialize", $"Core initialized with refresh rate = {1000 / timer.Interval:0} FPS"); }
public IActionResult AddHelp([FromBody] HelpLines help) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var created = _database.HelpLines.Add(help); _database.HelpLines.Add(help); _database.SaveChanges(); } catch (Exception) { throw; } return(CreatedAtAction("GetHelp", new { id = help.HelpId }, help)); }