NOT SERIALIZABLE!!! No public default constructor. Not marked as serializable. I note this because I foresee the possibility of having to change this if I ever need to Csla-ize this class.
상속: IHaveUri
예제 #1
0
        /// <summary>
        /// Injects the page.ContentViewModel into the
        /// ShellViewModel, publishing event messages
        /// along the way.
        /// </summary>
        public bool NavigateTo(IPage targetPage)
        {
            var navWasSuccessful = false;

            //PUBLISH THE REQUEST EVENT MESSAGE
            var navId   = Guid.NewGuid();
            var navInfo = new NavigationInfo(navId, targetPage);

            NavigationRequestedEventMessage.Publish(navInfo);

            //PUBLISH THE NAVIGATING EVENT MESSAGE
            NavigatingEventMessage.Publish(navInfo);
            try
            {
                //INJECT THE PAGE VIEWMODEL INTO THE SHELL
                var shellVM = GetShellViewModel();
                shellVM.Main = targetPage.ContentViewModel;

                //PUBLISH THE NAVIGATED EVENT MESSAGE
                NavigatedEventMessage.Publish(navInfo);

                //ADD THE PAGE TO THE HISTORY
                PageHistory.Add(targetPage);

                //SET THE RETURN VARIABLE
                navWasSuccessful = true;
            }
            catch
            {
                //PUBLISH THE FAILED EVENT MESSAGE
                NavigationFailedEventMessage.Publish(navInfo);

                //SET THE RETURN VARIABLE
                navWasSuccessful = false;
            }

            //RETURN OUR SUCCESS
            return(navWasSuccessful);
        }
예제 #2
0
    /// <summary>
    /// Injects the page.ContentViewModel into the
    /// ShellViewModel, publishing event messages
    /// along the way.
    /// </summary>
    public bool NavigateTo(IPage targetPage)
    {
      var navWasSuccessful = false;

      //PUBLISH THE REQUEST EVENT MESSAGE
      var navId = Guid.NewGuid();
      var navInfo = new NavigationInfo(navId, targetPage);
      NavigationRequestedEventMessage.Publish(navInfo);

      //PUBLISH THE NAVIGATING EVENT MESSAGE
      NavigatingEventMessage.Publish(navInfo);
      try
      {
        //INJECT THE PAGE VIEWMODEL INTO THE SHELL
        var shellVM = GetShellViewModel();
        shellVM.Main = targetPage.ContentViewModel;

        //PUBLISH THE NAVIGATED EVENT MESSAGE
        NavigatedEventMessage.Publish(navInfo);

        //ADD THE PAGE TO THE HISTORY
        PageHistory.Add(targetPage);

        //SET THE RETURN VARIABLE
        navWasSuccessful = true;


      }
      catch
      {
        //PUBLISH THE FAILED EVENT MESSAGE
        NavigationFailedEventMessage.Publish(navInfo);

        //SET THE RETURN VARIABLE
        navWasSuccessful = false;
      }

      //RETURN OUR SUCCESS
      return navWasSuccessful;
    }