Files
LaDOSE/LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/ShellViewModel.cs
Darkstack 2fe08f938a REST to a .Net Standard Library
Test REST in discord bot and WPF
Small improvements
2019-03-16 12:22:52 +01:00

52 lines
1.5 KiB
C#

using System;
using System.Configuration;
using System.Windows;
using System.Windows.Media.Imaging;
using Caliburn.Micro;
using LaDOSE.REST;
namespace LaDOSE.DesktopApp.ViewModels
{
public class ShellViewModel : Conductor<IScreen>.Collection.AllActive
{
protected override void OnInitialize()
{
this.DisplayName = "LaDOSE";
this.AppIcon = BitmapFrame.Create(Application.GetResourceStream(new Uri("/LaDOSE.DesktopApp;component/Resources/64x64.png",
UriKind.RelativeOrAbsolute)).Stream);
var appSettings = ConfigurationManager.AppSettings;
string url = (string)appSettings["ApiUri"];
string user = (string)appSettings["ApiUser"];
string password = (string)appSettings["ApiPassword"];
Uri uri = new Uri(url);
var restService = IoC.Get<RestService>();
restService.Connect(uri, user, password);
var wordPressViewModel = new WordPressViewModel(IoC.Get<RestService>());
ActivateItem(wordPressViewModel);
base.OnInitialize();
}
public BitmapFrame AppIcon { get; set; }
public void LoadEvent()
{
ActivateItem(new WordPressViewModel(IoC.Get<RestService>()));
}
public void LoadGames()
{
ActivateItem(new GameViewModel(IoC.Get<RestService>()));
}
public void OpenWeb()
{
ActivateItem(new WebNavigationViewModel("www.google.com"));
}
}
}