internal static void SetTourRun(ITourRun run) { var currentRun = theCurrentTourRun; currentRun?.Close(); theCurrentTourRun = run; }
public void TestSetFactoryMethod() { ITourRun tourRun = null; FeatureTouring.Navigation.FeatureTour.SetViewModelFactoryMethod( run => { tourRun = run; return(new TestTourViewModel(run)); }); var tour = new Tour() { Name = "Test", Steps = new[] { new Step("ID1", "Header", "Content") }, }; tour.Start(); Assert.IsNotNull(tourRun, "TourRun should not be null - ViewModelFactoryMethod was not called."); //BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; //FieldInfo field = typeof(TourRun).GetField("myTourViewModel", bindFlags); //var vm = field.GetValue(tourRun) as TestTourViewModel; var vm = tourRun.GetPrivateField <TestTourViewModel>("myTourViewModel"); Assert.IsNotNull(vm, "ViewModel should not be null. Custom view model creation failed."); }
/// <summary> /// Creates a new instance of the class. /// </summary> /// <param name="tourRun"> /// The <see langword="sealed"/> /// ITourRun object to be used by the view model to interact with the tour. /// May not be null. /// </param> protected internal TourViewModel(ITourRun tourRun) { if (tourRun == null) { throw new ArgumentNullException(nameof(tourRun)); } myTourRun = tourRun; CmdDoIt = new RelayCommand(o => myTourRun.DoIt(), o => myTourRun.CanDoIt()); CmdClose = new RelayCommand(o => myTourRun.Close()); CmdNext = new RelayCommand(o => { if (ButtonText == myClose) { myTourRun.Close(); } else { myTourRun.NextStep(false); } }, o => ButtonText == myClose || myTourRun.CanNextStep()); ButtonText = myNext; }
public TestTourViewModel(ITourRun run) : base(run) { }
public CustomTourViewModel(ITourRun run) : base(run) { }
public TourNavigator(ITourRun run) { myRun = run; }
internal static void SetCurrentRunNull() { theCurrentTourRun = null; }