41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
|
@page "/newproject"
|
||
|
@using Timelapse.Api;
|
||
|
@using ElectronNET.API;
|
||
|
@using Timelapse.Data;
|
||
|
@inject ExtensionProjectService EPS;
|
||
|
@inject NavigationManager NavigationManager
|
||
|
|
||
|
<h1>New Project</h1>
|
||
|
|
||
|
<ProjectComponent Value="@Project" />
|
||
|
|
||
|
<button class="btn btn-primary" @onclick="CreateProject">Create</button>
|
||
|
|
||
|
@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");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|