Skip to content

Commit

Permalink
Merge pull request #11 from J0nnyI/itemviewer_setup
Browse files Browse the repository at this point in the history
start with dir setup when none are present
  • Loading branch information
J0nnyI authored Sep 10, 2021
2 parents c77c515 + b5b6d3e commit b111375
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public NavigationService()
_pages.AddRange(
DependencyInjectionHelper.GetServicesByType<INavigationPage>().Where(s=>s != null)// filter vm utilities
);
CurrentPage = _pages.Items.OrderBy(m=>m.Position.Value).First();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
namespace TableTopCrucible.Domain.Library.Wpf.Pages.ViewModels
{
[Singleton(typeof(LibraryPageVm))]
public interface ILibraryPage
public interface ILibraryPage: INavigationPage
{

}
public class LibraryPageVm:ReactiveObject, IActivatableViewModel, ILibraryPage, INavigationPage
public class LibraryPageVm:ReactiveObject, IActivatableViewModel, ILibraryPage
{
public ViewModelActivator Activator { get; } = new();
public PackIconKind? Icon => PackIconKind.Bookshelf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace TableTopCrucible.Domain.Settings.Wpf.PageViewModels
{
[Transient(typeof(DirectorySetupPageVm))]
[Singleton(typeof(DirectorySetupPageVm))]
public interface IDirectorySetupPage : INavigationPage
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ public int CompareTo(DirectorySetup other)

public DirectorySetup(string name, string path, DirectorySetupId Id = null):this(vtName.From(name), DirectorySetupPath.From(path), Id)
{ }
public DirectorySetup(vtName name, DirectorySetupPath path, DirectorySetupId Id = null)
public DirectorySetup(vtName name, DirectorySetupPath path, DirectorySetupId Id = null):base(Id??DirectorySetupId.New())
{
this.Id = Id ?? DirectorySetupId.New();
this.Name = name;
this.Path = path;
}
Expand Down
15 changes: 14 additions & 1 deletion TableTopCrucible.Starter/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
using Splat;
using System.Reactive.Linq;
using Splat;

using System.Windows;

using TableTopCrucible.Core.Wpf.Engine.Pages.ViewModels;
using TableTopCrucible.Core.Wpf.Engine.Services;
using TableTopCrucible.Domain.Library.Wpf.Pages.ViewModels;
using TableTopCrucible.Domain.Settings.Wpf.PageViewModels;
using TableTopCrucible.Infrastructure.Repositories;

namespace TableTopCrucible.Starter
{
Expand All @@ -16,6 +21,14 @@ public MainWindow()
InitializeComponent();
this.MainPageContainer.ViewModel = Locator.Current.GetService<IMainPage>();


var navigationService = Locator.Current.GetService<INavigationService>();
var directorySetupRepository = Locator.Current.GetService<IDirectorySetupRepository>();

if (directorySetupRepository.Data.Count == 0)
navigationService.CurrentPage = Locator.Current.GetService<IDirectorySetupPage>();
else
navigationService.CurrentPage = Locator.Current.GetService<ILibraryPage>();
}
}
}

0 comments on commit b111375

Please sign in to comment.