Skip to content

Instantly share code, notes, and snippets.

@Veretax
Created July 17, 2019 20:36
Show Gist options
  • Save Veretax/0d018ed300cae64b6c4ed346c0b3987d to your computer and use it in GitHub Desktop.
Save Veretax/0d018ed300cae64b6c4ed346c0b3987d to your computer and use it in GitHub Desktop.
Runtime debugging that skips login validation
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Caliburn.Micro;
using TRMDesktopUI.EventModels;
namespace TRMDesktopUI.ViewModels
{
public class ShellViewModel : Conductor<object>, IHandle<LogOnEvent>, IHandle<string>
{
private SalesViewModel _salesVM;
private IEventAggregator _events;
private SimpleContainer _container;
public ShellViewModel(IEventAggregator events, SalesViewModel salesVM, SimpleContainer container)
{
_events = events;
_salesVM = salesVM;
_container = container;
_events.Subscribe(this);
if (Debugger.IsAttached)
{
ActivateItem(_container.GetInstance<SalesViewModel>());
}
else
{
ActivateItem(_container.GetInstance<LoginViewModel>());
}
}
public void Handle(LogOnEvent message)
{
ActivateItem(_salesVM);
}
public void Handle(string message)
{
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment