Beispiel #1
0
 public void JournalBackExecute()
 {
     if (_navigationJournal.CanGoBack)
     {
         _navigationJournal.GoBack();
     }
 }
 /// <summary>
 /// Closes the view by:
 /// 1. Assigning the <see cref="_keepAliveState"/> field to false.
 ///    This field's value is returned when the <see cref="IRegionMemberLifetime.KeepAlive"/> property is
 ///    access during navigation.  If false, the navigation system will remove this object from the region.
 ///    The navigation system is smart.  It checks both the View and View's ViewModel to see if they implement
 ///    this interface.  So, even if the ViewModel is the only object to provide implementation, the View/ViewModel
 ///    pair will still be removed from the region.
 ///
 /// 2. Using the journal to navigate back.
 /// </summary>
 void CloseExecute()
 {
     if (_navigationJournal.CanGoBack)
     {
         _keepAliveState = false;
         _logger.Log(Logger.Scenario.CloseView, Constants.Global.CloseJournalBackInitiated);
         _navigationJournal.GoBack();
     }
 }
Beispiel #3
0
        private void AddFields()
        {
            foreach (var selectedField in Fields.Where(f => f.IsSelected))
            {
                selectedField.Field.Add();
            }

            _journal.GoBack();
        }
        public AccountViewModel(IRegionManager regionManager, IDialogService dialogService) : base(dialogService)
        {
            _regionManager = regionManager;
            _dialogService = dialogService;
            OnSave         = new DelegateCommand(Save, CanSave)
                             .ObservesProperty(() => this.Account.FirstName)
                             .ObservesProperty(() => this.Account.LastName);

            GoBackCommand = new DelegateCommand(() => _journal.GoBack(), () => _journal?.CanGoBack ?? false);
            //ConfirmationRequest = new InteractionRequest<IConfirmation>();
        }
Beispiel #5
0
 public void GoBack()
 {
     if (_journal.CanGoBack)
     {
         _journal.GoBack();
     }
 }
Beispiel #6
0
 /// <summary>
 /// 上一步
 /// </summary>
 private void MovePrev()
 {
     if (journal != null && journal.CanGoBack)
     {
         journal.GoBack();
     }
 }
 private void Save()
 {
     if (!this.HasErrors)
     {
         Action a = async() =>
         {
             var content = new Dictionary <string, object> {
                 { "Barcode", Product.Barcode },
                 { "Name", Product.Name },
                 { "Price", Product.Price },
                 { "CategoryId", Product.CategorySelected.Id },
                 { "SupplierId", Product.SupplierSelected.Id },
                 { "Pin", Product.Pin },
                 { "ExpirationDate", Product.ExpirationDate },
                 { "Unit", Product.Unit },
                 { "Img", Product.Img }
             };
             bool isSuccess = false;
             if (IsEnable)
             {
                 isSuccess = await RestApiUtils.Instance.Post("api/product/update", content);
             }
             else
             {
                 isSuccess = await RestApiUtils.Instance.Post("api/product/add", content);
             }
             if (isSuccess)
             {
                 _journal.GoBack();
             }
         };
         ExecuteAction(a);
     }
 }
 private void Save()
 {
     if (!this.HasErrors)
     {
         Action a = async() =>
         {
             var content = new Dictionary <string, object> {
                 { "Id", Customer.Id },
                 { "Name", Customer.Name },
                 { "Address", Customer.Address },
                 { "Contact", Customer.Contact },
             };
             bool isSuccess = false;
             if (IsEnable)
             {
                 isSuccess = await RestApiUtils.Instance.Post("api/customer/update", content);
             }
             else
             {
                 isSuccess = await RestApiUtils.Instance.Post("api/customer/add", content);
             }
             if (isSuccess)
             {
                 _journal.GoBack();
             }
         };
         ExecuteAction(a);
     }
 }
Beispiel #9
0
        void OnCommit()
        {
            DbConversation.UsingTransaction(() =>
            {
                if (EditMode == EditMode.Add)
                {
                    DbConversation.Insert(CurrentEdit);
                    EventAggregator.GetEvent <UserAddedEvent>().Publish(CurrentEdit);
                }
                else
                {
                    foreach (var user in _editedUsers)
                    {
                        if (CurrentEdit.Name != null)
                        {
                            user.Name = CurrentEdit.Name;
                        }
                        if (CurrentEdit.UserRole != null)
                        {
                            user.UserRole = CurrentEdit.UserRole;
                        }
                        EventAggregator.GetEvent <UserChangedEvent>().Publish(user);
                    }
                }
            });

            if (_navigationJournal != null)
            {
                _navigationJournal.GoBack();
            }
        }
Beispiel #10
0
 private void NavigateBack()
 {
     if (_journal.CanGoBack)
     {
         _journal.GoBack();
         return;
     }
     throw new InvalidOperationException("NavigationBack cannot be done");
 }
 private void GoBack()
 {
     if (_journal.CanGoBack == false)
     {
         RegionManager.RequestNavigate("MainRegion", "HomeTilesView");
     }
     else
     {
         _journal.GoBack();
     }
 }
Beispiel #12
0
        public AccountCreateViewModel(IRegionManager regionManager, IDialogService dialogService,
                                      IEventAggregator ea) : base(dialogService)
        {
            _regionManager = regionManager;
            _ea            = ea;
            OnSave         = new DelegateCommand(Save, CanSave)
                             .ObservesProperty(() => this.Account.FirstName)
                             .ObservesProperty(() => this.Account.LastName);

            OnBackCommand = new DelegateCommand(() => _journal.GoBack(), () => _journal?.CanGoBack ?? false);
        }
Beispiel #13
0
 void GoBack()
 {
     // todo: 15 - Using the journal to navigate back.
     //
     // This view model offers a GoBack command and uses
     // the journal captured in OnNavigatedTo to
     // navigate back to the prior view.
     if (_navigationJournal != null)
     {
         _navigationJournal.GoBack();
     }
 }
 private void GoBack()
 {
     BatsmenTotalPoints        = null;
     BowlingTotalPoints        = null;
     FielderNameDupPoints      = null;
     FielderBonousPoints       = null;
     FielderTotalPoints        = null;
     NameCollectionTotalPoints = null;
     FPLteamTotalPoints        = null;
     FPLTotal_Points           = null;
     // _journal.Clear();
     _journal.GoBack();
 }
Beispiel #15
0
        /// <summary>
        /// Goes back.
        /// </summary>
        public void GoBack()
        {
            // Save current entry
            var currentEntry = CurrentEntry;

            // try and go back
            _regionNavigationJournal.GoBack();
            // if currententry isn't equal to previous entry then we moved back
            if (CurrentEntry != currentEntry)
            {
                _backStack.Pop();
            }
        }
Beispiel #16
0
        private void SendEmail()
        {
            SendState = SendingStateKey;
            _emailService.BeginSendEmailDocument(
                _emailDocument,
                r => _synchronizationContext.Post(
                    s =>
            {
                SendState = SentStateKey;

                // todo: 05 - Send Email: Navigating back
                // After the email has been 'sent' (we're using a mock mail service
                // in this application), the view model uses the navigation journal
                // it captured when it was navigated to (see the OnNavigatedTo in
                // this class) to navigate the region to the prior view.
                if (_navigationJournal != null)
                {
                    _navigationJournal.GoBack();
                }
            },
                    null),
                null);
        }
Beispiel #17
0
        private void Save()
        {
            if (!this.HasErrors)
            {
                Action a = async() =>
                {
                    var content = new Dictionary <string, object> {
                        { "Id", Category.Id },
                        { "Name", Category.Name },
                        { "Description", Category.Description },
                    };
                    //Update
                    if (IsEnable && await RestApiUtils.Instance.Post("api/category/update", content))
                    {
                        _journal.GoBack();
                    }
                    //Add
                    var addedData = await RestApiUtils.Instance.Post <CategoryModel>("api/category/add", content);

                    if (addedData != null)
                    {
                        var parameters = new NavigationParameters();
                        parameters.Add("categoryAdd", addedData);
                        _regionManager.RequestNavigate(RegionNames.ContentRegion, nameof(CategoryListView), parameters);
                    }
                    //bool isSuccess = false;
                    //if (IsEnable)
                    //    isSuccess = await RestApiUtils.Instance.Post("api/category/update", content);
                    //else
                    //    isSuccess = await RestApiUtils.Instance.Post("api/category/add", content);
                    //if (isSuccess)
                    //{
                    //    if(IsEnable)
                    //        _journal.GoBack();
                    //    else
                    //    {
                    //        var parameters = new NavigationParameters();
                    //        parameters.Add("category", content);
                    //    }

                    //}
                };
                ExecuteAction(a);
            }
        }
Beispiel #18
0
 private void GoBack()
 {
     journal.GoBack();
 }
Beispiel #19
0
 private void goBack()
 {
     _journal.GoBack();
 }
Beispiel #20
0
 private void Close() => journal?.GoBack();
Beispiel #21
0
 public void Back()
 {
     journal.GoBack();
 }
Beispiel #22
0
 private void Cancel()
 {
     _joirnal.GoBack();
 }
Beispiel #23
0
 private void gb()
 {
     j.GoBack();
 }
 private void GoBack()
 {
     // 导航到返回导航历史记录中的最新条目,或者如果后面导航中没有条目,则什么也不做。
     _journal.GoBack();
 }
Beispiel #25
0
        private void Cancel()
        {
            Item.RefreshFromModel();

            _journal.GoBack();
        }
Beispiel #26
0
 /// <summary>
 /// Called when [go back] to show the SearchedSongsView
 /// </summary>
 private void OnGoBack()
 {
     Log($"Navigating back from {_journal?.CurrentEntry.Uri}");
     _journal?.GoBack();
 }
 private void GoBack()
 {
     Video = null;
     _journal.GoBack();
 }
 void ExecuteGoBackCommand()
 {
     _journal.GoBack();
 }
Beispiel #29
0
 /// <summary>
 /// 返回
 /// </summary>
 protected void GoBack()
 {
     regionNavigationJournal?.GoBack();
 }
 private void GoBack()
 {
     _eventAggregator.GetEvent <StatusUpdatedEvent>().Publish("You used \"Go Back\" functionality of Navigation Journal.");
     _journal.GoBack();
 }