@page "/newproject"
@using Timelapse.Api;
@using ElectronNET.API;
@using Timelapse.Data;
@inject ExtensionProjectService EPS;
@inject NavigationManager NavigationManager
New Project
@code {
public TimelapseProject Project {get;set;}
protected override void OnInitialized()
{
Project = new TimelapseProject();
Project.Estimated=false;
Project.EstimatedProjectLength = new TimeSpan(0,2,0);
Project.EstimatedVideoLength = new TimeSpan(0,0,10);
Project.Interval = new TimeSpan(0,0,4);
Project.CurrentSection="Default";
Project.Width = 1280;
Project.Height=720;
}
private async Task CreateProject()
{
string filename=await Electron.Dialog.ShowSaveDialogAsync(Electron.WindowManager.BrowserWindows.First(),new SaveDialogOptions() { Filters = new ElectronNET.API.Entities.FileFilter[] {new ElectronNET.API.Entities.FileFilter() {Name="TimelapseNow Project", Extensions=new string[] {"tln"}}}});
if(!string.IsNullOrWhiteSpace(filename))
{
EPS.SaveProject(filename,Project);
EPS.LoadProject(filename);
await InvokeAsync(StateHasChanged);
NavigationManager.NavigateTo("preview");
}
}
}