53 lines
1.7 KiB
Plaintext
53 lines
1.7 KiB
Plaintext
|
@page "/"
|
||
|
@using Timelapse.Data;
|
||
|
@inject RecentFileService Recent;
|
||
|
@using ElectronNET.API;
|
||
|
@inject ExtensionProjectService EPS;
|
||
|
@inject NavigationManager NavigationManager
|
||
|
|
||
|
<h4>Start</h4>
|
||
|
<ul style="list-style-type:none">
|
||
|
<li> <a href="newproject">New Project</a></li>
|
||
|
<li> <a href="#" @onclick="OpenProject">Open Project</a></li>
|
||
|
<li><a href="preview">Preview Window</a></li>
|
||
|
</ul>
|
||
|
<h4>Recent</h4>
|
||
|
|
||
|
@if(RecentFiles == null)
|
||
|
{
|
||
|
<p>Loading...</p>
|
||
|
}else{
|
||
|
<ul style="list-style-type:none">
|
||
|
@foreach(var item in RecentFiles)
|
||
|
{
|
||
|
<li><a href="#" @onclick="@(e => Open(item.Fullpath))">@item.Filename</a> @item.Fullpath</li>
|
||
|
}
|
||
|
</ul>
|
||
|
}
|
||
|
@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");
|
||
|
}
|
||
|
}
|