Skip to content

Commit

Permalink
some more engine
Browse files Browse the repository at this point in the history
  • Loading branch information
LeversonCarlos committed Nov 7, 2018
1 parent dc7d154 commit 33fe65d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 0 additions & 4 deletions ComicsShelf/Engine/SearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ private async Task SearchComicFiles()
this.ComicFolders = this.ComicFolders
.OrderBy(x => x.FullPath)
.ToList();
App.HomeData.NoComics = (this.ComicFiles == null || this.ComicFiles.Count == 0);

}
catch (Exception ex) { throw; }
Expand Down Expand Up @@ -323,9 +322,6 @@ private async Task ExtractComicData()
var progress = ((double)fileIndex / (double)filesQuantity);
this.Notify(fileData.FullText, progress);

// VALIDATE
// if (fileData.FullPath.ToLower().EndsWith(".cbr")) { continue; }

// EXECUTE
// await Task.Factory.StartNew(async () => {
//Parallel.Invoke(async () => {
Expand Down
19 changes: 14 additions & 5 deletions ComicsShelf/Engine/StartupEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,28 @@ public static async Task Execute()
{
var engine = new Startup();
{
engine.Notify(R.Strings.STARTUP_ENGINE_CHECK_PERMISSIONS_MESSAGE);
engine.FileSystem.CheckPermissions(
engine.CheckPermissions(
async () =>
{
App.HomeData = new Views.Home.HomeData();
await engine.LoadSettings();
await engine.LoadDatabase();
await engine.LoadInitialView();
},
() => { Environment.Exit(0); });
});
}
}
catch (Exception ex) { await App.ShowMessage(ex); }
}

private void CheckPermissions(Action action)
{
this.Notify(R.Strings.STARTUP_ENGINE_CHECK_PERMISSIONS_MESSAGE);
Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
{
this.FileSystem.CheckPermissions(action, () => { Environment.Exit(0); });
});
}

private async Task LoadSettings()
{
try
Expand Down Expand Up @@ -61,7 +68,9 @@ private async Task LoadInitialView()

// SHOW HOME VIEW
// TODO: REMOVE THIS INVOKE, JUST PUSH THE VIEW AND, STARTS THE FOLLOWING SEARCH.EXECUTE ON A BACKGROUND NOT BLOCKING THREAD
Xamarin.Forms.Device.BeginInvokeOnMainThread(async () => await Helpers.NavVM.PushAsync<Views.Home.HomeVM>(true, App.HomeData));
// Xamarin.Forms.Device.BeginInvokeOnMainThread(async () =>
await Helpers.NavVM.PushAsync<Views.Home.HomeVM>(true, App.HomeData);
// );

// START SEARCH ENGINE
await Task.Factory.StartNew(Engine.Search.Execute, TaskCreationOptions.LongRunning);
Expand Down

0 comments on commit 33fe65d

Please sign in to comment.