Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
1006 B

using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.ClientSimulation.Snapshot;
namespace Volo.ClientSimulation.Pages.ClientSimulation
{
public class SimulationAreaModel : PageModel
{
public SimulationSnapshot Snapshot { get; private set; }
protected Simulation Simulation { get; }
public SimulationAreaModel(Simulation simulation)
{
Simulation = simulation;
}
public virtual Task<IActionResult> OnGetAsync()
{
Snapshot = Simulation.CreateSnapshot();
return Task.FromResult<IActionResult>(Page());
}
public virtual async Task<IActionResult> OnPostStartAsync()
{
Simulation.Start();
return new NoContentResult();
}
public virtual async Task<IActionResult> OnPostStopAsync()
{
Simulation.Stop();
return new NoContentResult();
}
}
}