protected virtual void BackExecute(object o) { Assert.IsTrue(this.Steps.Count > 0, "Steps stack is corrupted. Can't be less than 1"); var contentVMtoDestroy = this.ContentVM as IDisposable; if (contentVMtoDestroy != null) { contentVMtoDestroy.Dispose(); } this.Steps.Pop(); this.CanBack = this.Steps.Count > 1; if (this.CanBack) { WindowStepState windowStepState = this.Steps.Where((state, index) => index == 1).FirstOrDefault(); if (windowStepState != null) { this.BackToTitle = windowStepState.ShortName; } else { this.BackToTitle = "hell :)"; } } this.NotifyPublicVisibleChanged(); }
public static void GoAheadWithBackIfPossible(WindowStepState newState) { if (GoAheadTargets != null) { GoAheadTargets(newState); } }
public virtual void ReplaceInitialState(WindowStepState newHomeState) { this.ClearStepsStackWithDisposing(); this.Steps.Push(newHomeState); this.CanBack = false; this.NotifyPublicVisibleChanged(); }
protected virtual void GoAheadWithBack(WindowStepState newState) { Assert.IsNotNull(newState, "New state cannot be null"); this.BackToTitleInternal = this.CurrentState.ShortName; this.Steps.Push(newState); this.CanBack = true; this.NotifyPublicVisibleChanged(); }
static WindowStepState() { EmptyState = new WindowStepState(); EmptyState.SuperAction = new ActionCommandVM( new RelayCommand(delegate { throw new InvalidOperationException("Command can't be executed!"); }, false), string.Empty); EmptyState.StateSpecificHelpActions = new List<ActionCommandVM>(); EmptyState.ContentVM = DependencyProperty.UnsetValue; }
static WindowStepState() { EmptyState = new WindowStepState(); EmptyState.SuperAction = new ActionCommandVM( new RelayCommand(delegate { throw new InvalidOperationException("Command can't be executed!"); }, false), string.Empty); EmptyState.StateSpecificHelpActions = new List <ActionCommandVM>(); EmptyState.ContentVM = DependencyProperty.UnsetValue; }
protected virtual WindowStepState GetInitialStep(GetMainVMPipelineArgs args) { var step = new WindowStepState( this.GlobalTitle.GetValueOrDefault("Tray Garden -- Plants configuration"), this.Header.GetValueOrDefault("Here you configure plants"), this.ShortName.GetValueOrDefault("plants config"), args.PlantsConfigVM, args.SuperAction, args.StateSpecificHelpActions); return step; }
protected virtual void ClearStepsStackWithDisposing() { while (this.Steps.Count > 0) { WindowStepState currentStep = this.Steps.Pop(); var currentStepContentVM = currentStep.ContentVM as IDisposable; if (currentStepContentVM != null) { currentStepContentVM.Dispose(); } } }
protected virtual void GoAheadWithBack(WindowStepState newState) { Assert.IsNotNull(newState, "New state cannot be null"); this.BackToTitleInternal = this.CurrentState.ShortName; this.Steps.Push(newState); this.CanBack = true; this.NotifyPublicVisibleChanged(); }
public virtual void ReplaceInitialState(WindowStepState newHomeState) { this.ClearStepsStackWithDisposing(); this.Steps.Push(newHomeState); this.CanBack = false; this.NotifyPublicVisibleChanged(); }
public static void GoAheadWithBackIfPossible(WindowStepState newState) { if (GoAheadTargets != null) { GoAheadTargets(newState); } }