mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Some UI stuff
This commit is contained in:
1 parent
6b8a8b6b4e
commit
0f3c85db6b
9 files changed
+111
-15
No files matched your search
@@ -0,0 +1,10 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.ViewModels.Interfaces
|
||||
{
|
||||
public interface IArtemisViewModel : IRoutableViewModel
|
||||
{
|
||||
string Title { get; }
|
||||
string Icon { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,26 @@
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.ViewModels.Interfaces;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.ViewModels
|
||||
{
|
||||
public class MainViewModel : ReactiveObject, IMainViewModel
|
||||
{
|
||||
public MainViewModel(IScreen screen)
|
||||
public MainViewModel(IScreen screen, ISidebarViewModel sidebarViewModel)
|
||||
{
|
||||
HostScreen = screen;
|
||||
OpenUrl = ReactiveCommand.CreateFromTask<string>(OpenUrlAsync);
|
||||
|
||||
// Add this view as a menu item
|
||||
sidebarViewModel.MenuItems.Add(this);
|
||||
}
|
||||
|
||||
public IScreen HostScreen { get; }
|
||||
public string UrlPathSegment => "Home";
|
||||
public string UrlPathSegment => Title.ToLower();
|
||||
public string Title => "Home";
|
||||
public string Icon => "Home";
|
||||
|
||||
public ReactiveCommand OpenUrl { get; }
|
||||
|
||||
private async Task OpenUrlAsync(string url)
|
||||
@@ -22,7 +29,7 @@ namespace Artemis.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public interface IMainViewModel : IRoutableViewModel
|
||||
public interface IMainViewModel : IArtemisViewModel
|
||||
{
|
||||
ReactiveCommand OpenUrl { get; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.UI.ViewModels.Interfaces;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.ViewModels
|
||||
{
|
||||
public class SidebarViewModel : ReactiveObject, ISidebarViewModel
|
||||
{
|
||||
public SidebarViewModel(IScreen screen)
|
||||
{
|
||||
HostScreen = screen;
|
||||
MenuItems = new ObservableCollection<IArtemisViewModel>();
|
||||
}
|
||||
|
||||
public IScreen HostScreen { get; }
|
||||
public ObservableCollection<IArtemisViewModel> MenuItems { get; set; }
|
||||
}
|
||||
|
||||
public interface ISidebarViewModel
|
||||
{
|
||||
ObservableCollection<IArtemisViewModel> MenuItems { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user