public void OnNavigatedTo(NavigationContext navigationContext)
        {
            var reasondata = new Reason();

            AuthenticatedUser = (!string.IsNullOrEmpty((string)navigationContext.Parameters["AuthenticatedUser"]) ?
                                 (string)navigationContext.Parameters["AuthenticatedUser"] : string.Empty);

            var id = GetRequestedReasonID(navigationContext);

            if (id.HasValue)
            {
                var reason = ReasonServices.GetReason(id.Value);
                if (reason != null)
                {
                    if (!string.IsNullOrEmpty(ReasonDescAlias))
                    {
                        IsEnabled = false;
                    }

                    ReasonDescAlias       = reason.ReasonDesc;
                    reasondata.ID         = reason.ID;
                    reasondata.ReasonDesc = reason.ReasonDesc;
                    reasondata.ModifiedOn = reason.ModifiedOn;
                    reasondata.ModifiedBy = reason.ModifiedBy;
                }
            }
            else
            {
                IsEnabled = true;
            }

            this.ReasonData = reasondata;

            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
Beispiel #2
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            AuthenticatedUser = (!string.IsNullOrEmpty((string)navigationContext.Parameters["AuthenticatedUser"]) ?
                                 (string)navigationContext.Parameters["AuthenticatedUser"] : string.Empty);

            var id = GetRequestedId(navigationContext);

            if (id.HasValue)
            {
                this.AHU = ahuServices.GetAHU(id.Value);

                if (AHU.SectionReceived == null)
                {
                    AHU.ShipStatus = false;
                }
                else
                {
                    if (AHU.SectionReceived == AHU.Section)
                    {
                        AHU.ShipStatus = true;
                    }
                    else if (AHU.SectionReceived < AHU.Section)
                    {
                        AHU.ShipStatus = null;
                    }
                }

                this.EventAggregator.GetEvent <AHUSelectedEvent>().Publish(id.Value);
            }

            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            // todo: 09 - SystemStatus OnNavigatedTo : Accessing navigation context.
            // When this view model is navigated to it gains access to the
            // NavigationContext to determine if we are composing a new SystemStatus
            // or replying to an existing one.
            //
            // The navigation context offers the context information through
            // the Parameters property that is a string/value dictionary
            // built using the NavigationParameters class.
            //
            // In this example, we look for the 'ReplyTo' value to
            // determine if we are replying to an SystemStatus and, if so,
            // retrieving it's relevant information from the SystemStatus service
            // to pre-populate response values.
            //
            var SystemStatusDocument = new SystemStatusDocument();

            var parameters = navigationContext.Parameters;

            var  replyTo = parameters[ReplyToParameterKey];
            Guid replyToId;

            if (replyTo != null)
            {
                if (replyTo is Guid)
                {
                    replyToId = (Guid)replyTo;
                }
                else
                {
                    replyToId = Guid.Parse(replyTo.ToString());
                }

                var replyToSystemStatus = this.SystemStatusService.GetSystemStatusDocument(replyToId);
                if (replyToSystemStatus != null)
                {
                    SystemStatusDocument.Name = Resources.ResponseMessagePrefix + replyToSystemStatus.Name;

                    SystemStatusDocument.Message =
                        Environment.NewLine +
                        replyToSystemStatus.Message
                        .Split(Environment.NewLine.ToCharArray())
                        .Select(l => l.Length > 0 ? Resources.ResponseLinePrefix + l : l)
                        .Aggregate((l1, l2) => l1 + Environment.NewLine + l2);
                }
            }

            this.SystemStatusDocument = SystemStatusDocument;

            // todo: 10 - SystemStatus OnNaviatedTo : Capture the navigation service journal
            // You can capture the navigation service or navigation service journal
            // to navigate the region you're placed in without having to expressly
            // know which region to navigate.
            //
            // This is useful if you need to navigate 'back' at some point after this
            // view model closes.
            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
Beispiel #4
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _joirnal = navigationContext.NavigationService.Journal;

            var configuration = _configurationService.GetConfiguration();

            _mapper.Map(configuration, this);
        }
Beispiel #5
0
 /// <summary>
 /// 当导航到当前页面的时候
 /// </summary>
 /// <param name="navigationContext"></param>
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     CurrentPageRegionType   = navigationContext.NavigationService.Region.Name;
     CurrentPageName         = navigationContext.Uri.OriginalString;
     regionNavigationJournal = navigationContext.NavigationService.Journal;
     navigationParameters    = navigationContext.Parameters["param"];
     App_OnNavigatedTo?.Invoke(navigationContext);
 }
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            if (navigationContext.Parameters.ContainsKey("person"))
            {
                SelectedPerson = navigationContext.Parameters.GetValue <Person>("person");
            }
        }
Beispiel #7
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            if (navigationContext.Parameters["person"] is Person person)
            {
                SelectedPerson = person;
            }
        }
Beispiel #8
0
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            base.OnNavigatedTo(navigationContext);

            journal = navigationContext.NavigationService.Journal;

            selectedGroup = navigationContext.Parameters["group"] as Group;

            Load();
        }
Beispiel #9
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _navService = navigationContext.NavigationService;
            //Get Navigation journal reference
            _journal = navigationContext.NavigationService.Journal;
            //Change command status
            GoAddItemCommand.RaiseCanExecuteChanged();

            //this.ItemsCV = CollectionViewSource.GetDefaultView(ToDoItemList);
            this.ItemsCV.Refresh();
        }
Beispiel #10
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            var songItem = navigationContext.Parameters["song"] as AllJoinedTable;

            if (songItem != null)
            {
                SelectedSong = songItem;
            }
        }
Beispiel #11
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            var person = navigationContext.Parameters["person"] as Person;

            if (person != null)
            {
                SelectedPerson = person;
            }
        }
 public NavigationManager(IContainer container, IMessanger messanger, IRegionManager regionManager,
                          IShellWindow shell, ILog loger, IMenuService menuService, IRegionNavigationJournal regionNavigationJournal)
 {
     this.menuService             = menuService;
     this.loger                   = loger;
     this.container               = container;
     this.shell                   = shell;
     this.messanger               = messanger;
     this.regionManager           = regionManager;
     this.regionNavigationJournal = regionNavigationJournal;
     subscription                 = messanger.Subscribe <NavigationRequest>(OnMessageArrived);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegionNavigationService"/> class.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="regionNavigationContentLoader">The navigation target handler.</param>
        /// <param name="journal">The journal.</param>
        public RegionNavigationService(IServiceLocator serviceLocator, IRegionNavigationContentLoader regionNavigationContentLoader, IRegionNavigationJournal journal)
        {
            if (serviceLocator == null) throw new ArgumentNullException("serviceLocator");
            if (regionNavigationContentLoader == null) throw new ArgumentNullException("regionNavigationContentLoader");
            if (journal == null) throw new ArgumentNullException("journal");
            Contract.EndContractBlock();

            this.serviceLocator = serviceLocator;
            this.regionNavigationContentLoader = regionNavigationContentLoader;
            this.journal = journal;
            this.journal.NavigationTarget = this;
        }
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            var item = navigationContext.Parameters["ToDoItem"] as ToDoItem;

            if (item != null)
            {
                SelectedItem = item;
                TempItem     = null;
                TempItem     = SelectedItem.DeepCopy();
                contentDirty = false;
            }
        }
Beispiel #15
0
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            this.PolicyId = claimsNavigator.GetRequestedPolicyId(navigationContext);
            int?claimId = claimsNavigator.GetRequestedClaimId(navigationContext);

            // When this view model is navigated to, it gathers the
            // requested ClaimId from the navigation context's parameters.
            if (claimId != null)
            {
                this.Claim = this.claimDataService.GetClaim(claimId.Value);
            }

            this.regionNavigationJournal = navigationContext.NavigationService.Journal;
        }
        public void WhenNavigationFromViewThatIsNavigationAware_OnlyNotifiesOnNavigateFromForActiveViews()
        {
            // Arrange

            bool navigationFromInvoked = false;

            var region = new Region();

            var viewMock = new Mock <View>();

            viewMock
            .As <IRegionAware>()
            .Setup(x => x.OnNavigatedFrom(It.IsAny <INavigationContext>())).Callback(() => navigationFromInvoked = true);
            var view = viewMock.Object;

            region.Add(view);

            var targetViewMock = new Mock <StackLayout>();

            targetViewMock.As <IRegionAware>();
            region.Add(targetViewMock.Object);

            var activeViewMock = new Mock <Grid>();

            activeViewMock.As <IRegionAware>();
            region.Add(activeViewMock.Object);

            region.Activate(activeViewMock.Object);

            var containerMock = new Mock <IContainerExtension>();

            containerMock.Setup(x => x.Resolve(typeof(IRegionNavigationJournalEntry))).Returns(new RegionNavigationJournalEntry());

            var navigationUri                = new Uri(targetViewMock.Object.GetType().Name, UriKind.Relative);
            IContainerExtension container    = containerMock.Object;
            var contentLoader                = new Mock <RegionNavigationContentLoader>(container).Object;
            IRegionNavigationJournal journal = Mock.Of <IRegionNavigationJournal>();

            var target = new RegionNavigationService(container, contentLoader, journal)
            {
                Region = region
            };

            // Act
            target.RequestNavigate(navigationUri, nr => { });

            // Verify
            Assert.False(navigationFromInvoked);
        }
        public void WhenRequestNavigateAwayOnBindingContextRejectsThroughCallback_ThenNavigationDoesNotProceed()
        {
            // Prepare
            var region = new Region();

            var view1BindingContextMock = new Mock <IConfirmRegionNavigationRequest>();

            view1BindingContextMock
            .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny <INavigationContext>(), It.IsAny <Action <bool> >()))
            .Callback <INavigationContext, Action <bool> >((nc, c) => c(false))
            .Verifiable();

            var view1Mock = new Mock <View>();
            var view1     = view1Mock.Object;

            view1.BindingContext = view1BindingContextMock.Object;

            var view2 = new StackLayout();

            region.Add(view1);
            region.Add(view2);

            region.Activate(view1);

            var navigationUri = new Uri(view2.GetType().Name, UriKind.Relative);

            var containerMock = new Mock <IContainerExtension>();

            containerMock.Setup(x => x.Resolve(typeof(IRegionNavigationJournalEntry))).Returns(new RegionNavigationJournalEntry());

            IContainerExtension container    = containerMock.Object;
            var contentLoader                = new Mock <RegionNavigationContentLoader>(container).Object;
            IRegionNavigationJournal journal = Mock.Of <IRegionNavigationJournal>();

            var target = new RegionNavigationService(container, contentLoader, journal)
            {
                Region = region
            };

            // Act
            var navigationFailed = false;

            target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Result == false; });

            // Verify
            view1BindingContextMock.VerifyAll();
            Assert.True(navigationFailed);
            Assert.Equal(new object[] { view1 }, region.ActiveViews.ToArray());
        }
Beispiel #18
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            var toAddress = navigationContext.Parameters["To"];

            if (!string.IsNullOrWhiteSpace(toAddress))
            {
                To = toAddress;
            }
            else
            {
                To = "Email not provided.";
            }
        }
Beispiel #19
0
        public virtual void OnNavigatedTo(NavigationContext navigationContext)
        {
            journal = navigationContext.NavigationService.Journal;

            PageViews++;

            if (navigationContext.Parameters[NavigationParameterName] is string parameter)
            {
                NavigationParameter = parameter;
            }
            else
            {
                NavigationParameter = string.Empty;
            }
        }
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;
            var customer = navigationContext.Parameters["customer"] as CustomerModel;

            if (customer != null)
            {
                Customer = customer;
                IsEnable = true;
            }
            else
            {
                Customer = new CustomerModel();
                IsEnable = false;
            }
        }
Beispiel #21
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;
            var category = navigationContext.Parameters["category"] as CategoryModel;

            if (category != null)
            {
                Category = category;
                IsEnable = true;
            }
            else
            {
                Category = new CategoryModel();
                IsEnable = false;
            }
        }
Beispiel #22
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            AuthenticatedUser = (!string.IsNullOrEmpty((string)navigationContext.Parameters["AuthenticatedUser"]) ?
                                 (string)navigationContext.Parameters["AuthenticatedUser"] : string.Empty);

            var ID = GetRequestedUserID(navigationContext);

            if (ID.HasValue)
            {
                this.User = UserServices.GetUser(ID.Value);

                this.EventAggregator.GetEvent <UserSelectedEvent>().Publish(ID.Value);
            }

            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
Beispiel #23
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;

            CategoryVO category = navigationContext.Parameters["To"] as CategoryVO;

            if (category != null)
            {
                Title       = category.Title;
                Description = category.Description;
            }
            else
            {
                Title = "No Category info provided";
            }
        }
        public void WhenNavigatingWithNoRegionSet_ThenMarshallExceptionToCallback()
        {
            var navigationUri                = new Uri("/", UriKind.Relative);
            IContainerExtension container    = new Mock <IContainerExtension>().Object;
            var contentLoader                = new Mock <RegionNavigationContentLoader>(container).Object;
            IRegionNavigationJournal journal = Mock.Of <IRegionNavigationJournal>();

            var target = new RegionNavigationService(container, contentLoader, journal);

            Exception error = null;

            target.RequestNavigate(navigationUri, nr => error = nr.Error);

            Assert.NotNull(error);
            Assert.IsType <InvalidOperationException>(error);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegionNavigationService"/> class.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="regionNavigationContentLoader">The navigation target handler.</param>
        /// <param name="journal">The journal.</param>
        public RegionNavigationService(IServiceLocator serviceLocator, IRegionNavigationContentLoader regionNavigationContentLoader, IRegionNavigationJournal journal)
        {
            if (serviceLocator == null)
                throw new ArgumentNullException(nameof(serviceLocator));

            if (regionNavigationContentLoader == null)
                throw new ArgumentNullException(nameof(regionNavigationContentLoader));

            if (journal == null)
                throw new ArgumentNullException(nameof(journal));

            this.serviceLocator = serviceLocator;
            this.regionNavigationContentLoader = regionNavigationContentLoader;
            this.journal = journal;
            this.journal.NavigationTarget = this;
        }
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            //MessageBox.Show("从CreateAccount导航到LoginMainContent");
            _journal = navigationContext.NavigationService.Journal;

            var loginId = navigationContext.Parameters["loginId"] as string;

            if (loginId != null)
            {
                this.CurrentUser = new User()
                {
                    LoginId = loginId
                };
            }
            LoginCommand.RaiseCanExecuteChanged();
        }
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            _journal = navigationContext.NavigationService.Journal;
               
            CategoryVO category = navigationContext.Parameters["To"] as CategoryVO;

            if (category != null)
            {
                Title = category.Title;
                Description = category.Description;
            }
            else
            {
                Title = "No Category info provided";
            }

        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RegionNavigationService"/> class.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="regionNavigationContentLoader">The navigation target handler.</param>
        /// <param name="journal">The journal.</param>
        public CustomRegionNavigationService(IServiceLocator serviceLocator, IRegionNavigationContentLoader regionNavigationContentLoader, IRegionNavigationJournal journal)
        {
            if (serviceLocator == null)
            {
                throw new ArgumentNullException("serviceLocator");
            }

            if (regionNavigationContentLoader == null)
            {
                throw new ArgumentNullException("regionNavigationContentLoader");
            }

            if (journal == null)
            {
                throw new ArgumentNullException("journal");
            }

            this.serviceLocator = serviceLocator;
            this.regionNavigationContentLoader = regionNavigationContentLoader;
            this.journal = journal;
            this.journal.NavigationTarget = this;
        }
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     if (navigationJournal == null)
     {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
     }
 }
Beispiel #30
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
           mJournal =   navigationContext.NavigationService.Journal;
            ID = Convert.ToInt64( navigationContext.Parameters[ParameterKeys.ID]);
            this.JubenType = (JubenType) navigationContext.Parameters[ParameterKeys.JUBEN_TYPE] ;
            this.Juben = navigationContext.Parameters[ParameterKeys.JUBEN] as RunJuben;

            TestParameters.Clear();
            var pars = JubenType.GetCustomAttribute<InputParametersAttribute>();
            TestParameters.AddRange(pars.Parms.Select(a => new TestParameter() { Key = a.ToString(), Description = a.GetDescription() }));
  
        }
Beispiel #31
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     moduleManager = ServiceLocator.Current.GetInstance<IModuleManager>();
       moduleCatalog = ServiceLocator.Current.GetInstance<IModuleCatalog>();
       regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
       container = ServiceLocator.Current.GetInstance<IUnityContainer>();
       if (navigationJournal == null)
       {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
       }
 }
Beispiel #32
0
 private void OnSendOprationNavigation(NavigationEvent e)
 {
     if (e.IsSkip == true)
     {
         if (navigationJournal == null)
             navigationJournal = regionManager.Regions[RegionNames.MainRegion].NavigationService.Journal;
         if (navigationJournal != null)
         {
             if (navigationJournal.CanGoBack)
             {
                 navigationJournal.GoBack();
             }
             else
             {
                 Uri uri = new Uri("HomeView", UriKind.Relative);
                 this.regionManager.RequestNavigate(RegionNames.MainRegion, uri);
             }
             this.FuncName = lastFuncName;
         }
     }
     else
     {
         this.FuncName = lastFuncName;
     }
 }
Beispiel #33
0
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            // todo: 09 - Email OnNavigatedTo : Accessing navigation context.
            // When this view model is navigated to it gains access to the
            // NavigationContext to determine if we are composing a new email
            // or replying to an existing one.
            //
            // The navigation context offers the context information through
            // the Parameters property that is a string/value dictionairy
            // built from the navigation Uri.
            //
            // In this example, we look for the 'ReplyTo' value to 
            // determine if we are replying to an email and, if so, 
            // retrieving it's relevant information from the email service
            // to pre-populate response values.
            //
            var emailDocument = new EmailDocument();

            var parameters = navigationContext.Parameters;

            var replyTo = parameters[ReplyToParameterKey];
            Guid replyToId;
            if (replyTo != null && Guid.TryParse(replyTo, out replyToId))
            {
                var replyToEmail = _emailService.GetEmailDocument(replyToId);
                if (replyToEmail != null)
                {
                    emailDocument.To = replyToEmail.From;
                    emailDocument.Subject = "RE: " + replyToEmail.Subject;

                    emailDocument.Text =
                        Environment.NewLine +
                        replyToEmail.Text
                            .Split(Environment.NewLine.ToCharArray())
                            .Select(l => l.Length > 0 ? ">> " + l : l)
                            .Aggregate((l1, l2) => l1 + Environment.NewLine + l2);
                }
            }
            else
            {
                var to = parameters[ToParameterKey];
                if (to != null)
                {
                    emailDocument.To = to;
                }
            }

            EmailDocument = emailDocument;

            // todo: 10 - Email OnNaviatedTo : Capture the navigation service journal
            // You can capture the navigation service or navigation service journal
            // to navigate the region you're placed in without having to expressly 
            // know which region to navigate.
            //
            // This is useful if you need to navigate 'back' at some point after this
            // view model closes.
            _navigationJournal = navigationContext.NavigationService.Journal;
        }
Beispiel #34
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     youTubeSearch("dog");
     regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
     if (navigationJournal == null)
     {
       navigationJournal = navigationContext.NavigationService.Journal;
       navigationJournalEntry = navigationJournal.CurrentEntry;
     }
 }
Beispiel #35
0
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            // When we're navigated to see if there is an emailId
            // associated with the request.  If so, retrieve the email document.
            var emailId = GetRequestedEmailId(navigationContext);
            if (emailId.HasValue)
            {
                this.Email = this.emailService.GetEmailDocument(emailId.Value);
            }

            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
 public void OnNavigatedTo (NavigationContext navigationContext)
 {
     mJournal = navigationContext.NavigationService.Journal;
     Log = (string)navigationContext.Parameters[ParameterKeys.LOG]; 
 }
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     SelectedRegularExpression = null;
     this.navigationJournal = navigationContext.NavigationService.Journal;
 }
Beispiel #38
0
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (navigationJournal == null)
            {
                navigationJournal = navigationContext.NavigationService.Journal;
                navigationJournalEntry = navigationJournal.CurrentEntry;
            }
            allowKeyPressMonitoring = true;

            _mediaSource = navigationContext.Parameters["mediaSource"];

            InitializeComponent();
            initVLCPlayer();

            if (localVlcControl.Media != null)
            {
                localVlcControl.Media.ParsedChanged -= MediaOnParsedChanged;
            }
            else
            {
                localVlcControl.VideoProperties.Scale = 2.0f;
                localVlcControl.PositionChanged += VlcControlOnPositionChanged;
                localVlcControl.TimeChanged += VlcControlOnTimeChanged;
            }

            localVlcControl.Media = new PathMedia(_mediaSource);
            localVlcControl.Media.ParsedChanged += MediaOnParsedChanged;
            localVlcControl.Play();
        }
Beispiel #39
0
 public StatusView(IRegionNavigationJournal journal)
 {
     _journal = journal;
     InitializeComponent();
 }
Beispiel #40
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     Messenger.Default.Register<string>(this, AppClosing);
       regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
       if (navigationJournal == null)
       {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
       }
 }
 public MefRegionNavigationService(IServiceLocator serviceLocator, IRegionNavigationContentLoader navigationContentLoader, IRegionNavigationJournal journal)
     : base(serviceLocator, navigationContentLoader, journal)
 { }
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            // todo: 09 - SystemStatus OnNavigatedTo : Accessing navigation context.
            // When this view model is navigated to it gains access to the
            // NavigationContext to determine if we are composing a new SystemStatus
            // or replying to an existing one.
            //
            // The navigation context offers the context information through
            // the Parameters property that is a string/value dictionary
            // built using the NavigationParameters class.
            //
            // In this example, we look for the 'ReplyTo' value to 
            // determine if we are replying to an SystemStatus and, if so, 
            // retrieving it's relevant information from the SystemStatus service
            // to pre-populate response values.
            //
            var SystemStatusDocument = new SystemStatusDocument();

            var parameters = navigationContext.Parameters;

            var replyTo = parameters[ReplyToParameterKey];
            Guid replyToId;
            if (replyTo != null)
            {
                if (replyTo is Guid)
                {
                    replyToId = (Guid)replyTo;
                }
                else
                {
                    replyToId = Guid.Parse(replyTo.ToString());
                }

                var replyToSystemStatus = this.SystemStatusService.GetSystemStatusDocument(replyToId);
                if (replyToSystemStatus != null)
                {
                    SystemStatusDocument.Name = Resources.ResponseMessagePrefix + replyToSystemStatus.Name;

                    SystemStatusDocument.Message =
                        Environment.NewLine +
                        replyToSystemStatus.Message
                            .Split(Environment.NewLine.ToCharArray())
                            .Select(l => l.Length > 0 ? Resources.ResponseLinePrefix + l : l)
                            .Aggregate((l1, l2) => l1 + Environment.NewLine + l2);
                }
            }

            this.SystemStatusDocument = SystemStatusDocument;

            // todo: 10 - SystemStatus OnNaviatedTo : Capture the navigation service journal
            // You can capture the navigation service or navigation service journal
            // to navigate the region you're placed in without having to expressly 
            // know which region to navigate.
            //
            // This is useful if you need to navigate 'back' at some point after this
            // view model closes.
            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     var id = navigationContext.Parameters["Edit"];
     if (id != null)
     {
         var exp = libraryRepository.GetRegularExpressionById(id.ToString());
         this.RegularExpression = exp;
         this.IsAddingNewItem = false;
     }
     else
     {
         var regexPattern = navigationContext.Parameters["Add"];
         if (regexPattern != null)
         {
             var exp = new RegularExpression
             {
                 Expression = regexPattern.ToString()
             };
             this.RegularExpression = exp;
             this.IsAddingNewItem = true;
         }
     }
     this.navigationJournal = navigationContext.NavigationService.Journal;
 }
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            // todo: 15 - Orient to the right context
            //
            // When this view model is navigated to, it gathers the
            // requested EmailId from the navigation context's parameters.
            //
            // It also captures the navigation Journal so it
            // can offer a 'go back' command.
            var emailId = GetRequestedEmailId(navigationContext);
            if (emailId.HasValue)
            {
                this.Email = this.emailService.GetEmailDocument(emailId.Value);
            }

            this.navigationJournal = navigationContext.NavigationService.Journal;
        }
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     navigationJournal = navigationContext.NavigationService.Journal;
 }
        public void Initialise()
        {
            this.canSave = false;
            this.journal = this.regionManager.Regions[RegionNames.MainRegion].NavigationService.Journal;
            this.regionManager.Regions[RegionNames.MainRegion].NavigationService.Navigated += (sender, args) =>
                {
                    this.CanGoBack = this.journal.CanGoBack;
                    this.CanGoForward = this.journal.CanGoForward;

                    // this.CanCreateNew = true;
                    this.CanGoToSearch = this.journal.CanGoBack;
                };

            this.navigationService.NavigationCleared += (x, y) =>
                {
                    this.CanGoBack = this.journal.CanGoBack;
                    this.CanGoForward = this.journal.CanGoForward;

                    // this.CanCreateNew = true;
                    this.CanGoToSearch = false;
                };

            WindowPosition.Reposition();
        }
Beispiel #47
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
   Messenger.Default.Register<MediaElement>(this, "Main", TV_Rendered);
   Messenger.Default.Register<ContentControl>(this, "Content", CC_Rendered);
   Messenger.Default.Register<string>(this, AppClosing);
   Messenger.Default.Register<string>(this, "TVLoaded", StartTV);
   regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
   if (navigationJournal == null)
   {
     navigationJournal = navigationContext.NavigationService.Journal;
     navigationJournalEntry = navigationJournal.CurrentEntry;
   }
   StartupControl();
 }   
        void INavigationAware.OnNavigatedTo(NavigationContext navigationContext)
        {
            // todo: 09 - Email OnNavigatedTo : Accessing navigation context.
            // When this view model is navigated to it gains access to the
            // NavigationContext to determine if we are composing a new email
            // or replying to an existing one.
            //
            // The navigation context offers the context information through
            // the Parameters property that is a string/value dictionary
            // built using the NavigationParameters class.
            //
            // In this example, we look for the 'ReplyTo' value to 
            // determine if we are replying to an email and, if so, 
            // retrieving it's relevant information from the email service
            // to pre-populate response values.
            //
            var emailDocument = new EmailDocument();

            var parameters = navigationContext.Parameters;

            object replyTo;
            if (parameters.TryGetValue(ReplyToParameterKey, out replyTo))
            {
                Guid replyToId;
                if (replyTo is Guid)
                {
                    replyToId = (Guid)replyTo;
                }
                else 
                {
                    replyToId = Guid.Parse(replyTo.ToString());
                }

                var replyToEmail = this.emailService.GetEmailDocument(replyToId);
                if (replyToEmail != null)
                {
                    emailDocument.To = replyToEmail.From;
                    emailDocument.Subject = Resources.ResponseMessagePrefix + replyToEmail.Subject;

                    emailDocument.Text =
                        Environment.NewLine +
                        replyToEmail.Text
                            .Split(Environment.NewLine.ToCharArray())
                            .Select(l => l.Length > 0 ? Resources.ResponseLinePrefix + l : l)
                            .Aggregate((l1, l2) => l1 + Environment.NewLine + l2);
                }
            }
            else
            {
                object to;
                if (parameters.TryGetValue(ToParameterKey, out to))
                {
                    emailDocument.To = to.ToString();
                }
            }

            this.EmailDocument = emailDocument;

            // todo: 10 - Email OnNaviatedTo : Capture the navigation service journal
            // You can capture the navigation service or navigation service journal
            // to navigate the region you're placed in without having to expressly 
            // know which region to navigate.
            //
            // This is useful if you need to navigate 'back' at some point after this
            // view model closes.
            this.navigationJournal = navigationContext.NavigationService.Journal;
        }