void setupRx()
        {
            if (rxObjectsSetup)
            {
                return;
            }

            NavigateBack = new ReactiveCommand(
                NavigationStack.CollectionCountChanged.StartWith(_NavigationStack.Count).Select(x => x > 1));
            NavigateBack.Subscribe(_ =>
                                   NavigationStack.RemoveAt(NavigationStack.Count - 1));

            Navigate = new NavigationCommand();
            Navigate.Subscribe(x => {
                var vm = x as IRoutableViewModel;
                if (vm == null)
                {
                    throw new Exception("Navigate must be called on an IRoutableViewModel");
                }

                NavigationStack.Add(vm);
            });

            NavigateAndReset = new NavigationCommand();
            NavigateAndReset.Subscribe(x => {
                NavigationStack.Clear();
                Navigate.Execute(x);
            });

            rxObjectsSetup = true;
        }
 protected void TransferToTargetView()
 {
     PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("TransferToTargetView", () =>
     {
         if (NavigationCommand != null)
         {
             NavigationCommand.Execute();
         }
     });
 }
 public static void Go <T>(this NavigationCommand This, string key = null)
     where T : IRoutableViewModel
 {
     This.Execute(RxApp.GetService <T>(key));
 }