private bool NavigateToTransactionOutsideOfFilter(Guid transactionId)
        {
            Transaction foundTransaction = ViewModel.Statement.AllTransactions.FirstOrDefault(t => t.Id == transactionId);
            if (foundTransaction != null)
            {
                var result = this.questionBox.Show("The transaction falls outside the current filter. Do you wish to adjust the filter to show the transaction?", "Navigate to Transaction");
                if (result == null || !result.Value)
                {
                    return false;
                }

                GlobalFilterCriteria newCriteria;
                var requestCurrentFilter = new RequestFilterMessage(this);
                MessengerInstance.Send(requestCurrentFilter);

                if (foundTransaction.Date < requestCurrentFilter.Criteria.BeginDate)
                {
                    newCriteria = new GlobalFilterCriteria { BeginDate = foundTransaction.Date, EndDate = requestCurrentFilter.Criteria.EndDate };
                }
                else
                {
                    newCriteria = new GlobalFilterCriteria { BeginDate = requestCurrentFilter.Criteria.BeginDate, EndDate = foundTransaction.Date };
                }

                MessengerInstance.Send(new RequestFilterChangeMessage(this) { Criteria = newCriteria });

                return NavigateToVisibleTransaction(transactionId);
            }

            return false;
        }
        /// <summary>
        ///     Used to start a new Ledger Book reconciliation.  This will ultimately add a new <see cref="LedgerEntryLine" /> to
        ///     the <see cref="LedgerBook" />.
        /// </summary>
        public void ShowCreateDialog([NotNull] Engine.Ledger.LedgerBook ledgerBook)
        {
            if (ledgerBook == null)
            {
                throw new ArgumentNullException(nameof(ledgerBook));
            }

            this.parentBook = ledgerBook;
            BankBalances = new ObservableCollection<BankBalanceViewModel>();
            CreateMode = true;
            AddBalanceVisibility = true;
            Editable = true;

            var requestFilterMessage = new RequestFilterMessage(this);
            MessengerInstance.Send(requestFilterMessage);
            Date = requestFilterMessage.Criteria.EndDate?.AddDays(1) ?? DateTime.Today;

            ShowDialogCommon("New Monthly Reconciliation");
        }
 private void OnGlobalFilterRequested(RequestFilterMessage message)
 {
     message.Criteria = Criteria;
 }
        private async Task<bool> LoadInternal(string fullFileName)
        {
            StatementModel statementModel = null;
            await Task.Run(() => statementModel = this.statementFileManager.LoadAnyStatementFile(fullFileName));

            if (statementModel == null)
            {
                // User cancelled.
                return false;
            }

            await this.dispatcher.BeginInvoke(DispatcherPriority.Normal, () =>
            {
                // Update all UI bound properties.
                ViewModel.Statement = statementModel;
                var requestCurrentFilterMessage = new RequestFilterMessage(this);
                MessengerInstance.Send(requestCurrentFilterMessage);
                if (requestCurrentFilterMessage.Criteria != null)
                {
                    ViewModel.Statement.Filter(requestCurrentFilterMessage.Criteria);
                }

                NotifyOfReset();
                ViewModel.TriggerRefreshTotalsRow();

                MessengerInstance.Send(new StatementReadyMessage(ViewModel.Statement));
            });
            return true;
        }
 private GlobalFilterCriteria RequestCurrentFilter()
 {
     var currentFilterMessage = new RequestFilterMessage(this);
     MessengerInstance.Send(currentFilterMessage);
     return currentFilterMessage.Criteria;
 }
        internal async Task<bool> SyncWithServiceAsync()
        {
            var statementModel = this.transactionService.StatementModel;
            LoadingData = true;
            await Dispatcher.CurrentDispatcher.BeginInvoke(
                DispatcherPriority.Normal,
                () =>
                {
                    // Update all UI bound properties.
                    var requestCurrentFilterMessage = new RequestFilterMessage(this);
                    MessengerInstance.Send(requestCurrentFilterMessage);
                    if (requestCurrentFilterMessage.Criteria != null)
                    {
                        this.transactionService.FilterTransactions(requestCurrentFilterMessage.Criteria);
                    }

                    ViewModel.Statement = statementModel;
                    NotifyOfReset();
                    ViewModel.TriggerRefreshTotalsRow();

                    MessengerInstance.Send(new StatementReadyMessage(ViewModel.Statement));

                    LoadingData = false;
                });

            return true;
        }