@page "/"
@using Timelapse.Data;
@inject RecentFileService Recent;
@using ElectronNET.API;
@inject ExtensionProjectService EPS;
@inject NavigationManager NavigationManager
Start
Recent
@if(RecentFiles == null)
{
Loading...
}else{
}
@code {
public RecentFile[] RecentFiles {get;set;}
protected override async Task OnInitializedAsync()
{
RecentFiles = (await Recent.GetRecentFilesAsync()).Reverse().ToArray();
RecentFileService.RFS=Recent;
ExtensionProjectService.RecentFile = Recent;
}
public async Task OpenProject()
{
string[] proj=await Electron.Dialog.ShowOpenDialogAsync(Electron.WindowManager.BrowserWindows.First(),new ElectronNET.API.Entities.OpenDialogOptions() {
Filters = new ElectronNET.API.Entities.FileFilter[] {new ElectronNET.API.Entities.FileFilter() {Name="TimelapseNow Project", Extensions=new string[] {"tln"}}}
});
if(proj.Length > 0)
{
EPS.LoadProject(proj[0]);
StateHasChanged();
NavigationManager.NavigateTo("preview");
}
}
public void Open(string v)
{
EPS.LoadProject(v);
StateHasChanged();
NavigationManager.NavigateTo("preview");
}
}