Inheritance: GalaSoft.MvvmLight.Messaging.MessageBase
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Help)
            {
                this.messageBox.Show("This will clone an existing budget, the currently shown budget, to a new budget that is future dated.  The budget must have an effective date in the future.");
                return;
            }

            EventHandler handler = Ready;
            if (handler != null)
            {
                if (message.Response == ShellDialogButton.Cancel)
                {
                }
                else
                {
                    handler(this, EventArgs.Empty);
                }
            }
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId)) return;
            if (this.removedRules.Any())
            {
                foreach (MatchingRule rule in this.removedRules)
                {
                    this.ruleService.RemoveRule(rule);
                }
                this.dbService.NotifyOfChange(ApplicationDataType.MatchingRules);
            }

            Reset();
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Cancel)
            {
                Reset();
                return;
            }

            TransferFundsRequested?.Invoke(this, EventArgs.Empty);
            Reset();
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (!IsReadOnly)
            {
                this.reconciliationService.UpdateRemarks(LedgerEntryLine, Remarks);
            }

            LedgerEntryLine = null;
            Remarks = null;

            EventHandler handler = Completed;
            handler?.Invoke(this, EventArgs.Empty);
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (!IsReadOnly)
            {
                LedgerEntryLine.UpdateRemarks(Remarks);
            }

            LedgerEntryLine = null;
            Remarks = null;

            EventHandler handler = Completed;
            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Ok)
            {
                if (this.ShowAddingNewTransactionPanel)
                {
                    OnAddNewTransactionCommandExecuted();
                }

                Save();
            }

            if (message.Response == ShellDialogButton.Cancel)
            {
                this.isAddDirty = false;
            }

            EventHandler<LedgerTransactionEventArgs> handler = Complete;
            if (handler != null)
            {
                handler(this, new LedgerTransactionEventArgs(this.wasChanged));
            }

            Reset();
            this.wasChanged = false;
        }
Exemplo n.º 7
0
        private void OnPopUpResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            var viewModel = (BudgetSelectionViewModel) message.Content;
            if (viewModel.Selected == null || viewModel.Selected == CurrentBudget.Model)
            {
                return;
            }

            ShowOtherBudget(viewModel.Selected);
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Help)
            {
                this.messageBox.Show(
                    "Using this feature you can create a special temporary budget bucket with a fixed total budget amount.  There is no monthly budget contribution, just a fixed total. This allows tracking of a specific project against a budget, and will show a bar chart as the budget gets lower.  Transactions must be tagged with the bucket code using the bucket code in the Transactions view.  All tagged transactions are still considered as surplus (in fact this new bucket will inherit from the Surplus bucket).");
                return;
            }

            EventHandler<DialogResponseEventArgs> handler = Complete;
            handler?.Invoke(this, new DialogResponseEventArgs(this.dialogCorrelationId, message.Response == ShellDialogButton.Cancel));
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            try
            {
                if (message.Response == ShellDialogButton.Help)
                {
                    this.messageBox.Show(
                        "Use your actual pay day as the date, this signifies the closing of the previous month, and opening a new month on your pay day showing available funds in each ledger for the new month. The date used will also be used to select transactions from the statement to calculate the ledger balance. The date is set from the current date range filter (on the dashboard page), using the day after the end date. Transactions will be found by searching one month prior to the given date, excluding the given date. The transactions are used to show how the current ledger balance is calculated. The bank balance is the balance as at the date given, after your pay has been credited.");
                    return;
                }
                if (message.Response == ShellDialogButton.Cancel)
                {
                    Canceled = true;
                }
                else
                {
                    if (BankBalances.None())
                    {
                        if (CanExecuteAddBankBalanceCommand())
                        {
                            // User may have entered some data to add a new bank balance to the collection, but not clicked the add button, instead they just clicked save.
                            OnAddBankBalanceCommandExecuted();
                        }
                        else
                        {
                            throw new InvalidOperationException("Failed to add any bank balances to Ledger Book reconciliation.");
                        }
                    }
                }

                EventHandler<EditBankBalancesEventArgs> handler = Complete;
                handler?.Invoke(this, new EditBankBalancesEventArgs { Canceled = Canceled });
            }
            finally
            {
                Reset();
            }
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            // StatementController processes the request to add the two new transactions.
            this.dialogCorrelationId = Guid.Empty;
            OriginalTransaction = null;
        }
Exemplo n.º 11
0
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.shellDialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Cancel)
            {
                return;
            }

            if (Bucket == null)
            {
                this.messageBoxService.Show("Bucket cannot be null.");
                return;
            }

            NewRule = this.rulesService.CreateNewRule(
                Bucket.Code,
                Description.Applicable ? Description.Value : null,
                new[]
                {
                    Reference1.Applicable ? Reference1.Value : null,
                    Reference2.Applicable ? Reference2.Value : null,
                    Reference3.Applicable ? Reference3.Value : null
                },
                TransactionType.Applicable ? TransactionType.Value : null,
                Amount.Applicable ? Amount.Value : null,
                AndChecked);

            EventHandler handler = RuleCreated;
            handler?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 12
0
        private async void OnShellDiaglogResponseMessageReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId)) return;

            if (message.Response == ShellDialogButton.Cancel)
            {
                this.password?.Dispose();
                return;
            }

            try
            {
                if (EncryptFileMode)
                {
                    await EncryptFiles();
                    return;
                }

                if (DecryptFileMode)
                {
                    await DecryptFiles();
                    return;
                }

                if (EnterPasswordMode)
                {
                    this.appDbService.SetCredential(this.password);
                    MessengerInstance.Send(new PasswordSetMessage { DatabaseStorageKey = FileName });
                    // Incorrect password is handled by calling code.
                }
            }
            finally
            {
                this.password = null;
            }
        }
        private async void OnShellDialogMessageReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.correlationId)) return;

            try
            {
                if (message.Response == ShellDialogButton.Cancel) return;
                var changed = AccessKeyId != this.widget.LedgerBook.MobileSettings.AccessKeyId;
                changed |= AccessKeySecret != this.widget.LedgerBook.MobileSettings.AccessKeySecret;
                changed |= AmazonRegion != this.widget.LedgerBook.MobileSettings.AmazonS3Region;
                if (changed)
                {
                    this.widget.LedgerBook.MobileSettings.AccessKeyId = AccessKeyId;
                    this.widget.LedgerBook.MobileSettings.AccessKeySecret = AccessKeySecret;
                    this.widget.LedgerBook.MobileSettings.AmazonS3Region = AmazonRegion;
                    this.appDbService.NotifyOfChange(ApplicationDataType.Ledger);
                }
                await AttemptUploadAsync();
            }
            finally
            {
                this.widget = null;
            }
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            ResetFilter();
            if (message.Response == ShellDialogButton.Cancel)
            {
                Selected = null;
            }

            CompleteSelection();
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            EventHandler<BudgetBucketChosenEventArgs> handler = Chosen;
            if (handler != null)
            {
                if (message.Response == ShellDialogButton.Cancel)
                {
                    handler(this, new BudgetBucketChosenEventArgs(this.dialogCorrelationId, true));
                }
                else
                {
                    handler(this, new BudgetBucketChosenEventArgs(this.dialogCorrelationId, Selected, StoreInThisAccount));
                }
            }

            Reset();
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Help)
            {
                this.messageBox.Show(
                    "Using this feature you can create a widget to show upcoming months where that require more than usual weekly or fortnightly payments. This is because there is an uneven number of weeks per month, so occasionally there will be 5 weekly payments in one month and 3 fortnightly payments. This widget will show the months where this will occur for the given Budget Bucket.");
                return;
            }

            EventHandler<DialogResponseEventArgs> handler = Complete;
            handler?.Invoke(this, new DialogResponseEventArgs(this.dialogCorrelationId, message.Response == ShellDialogButton.Cancel));
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (this.filterMode == FilterMode.AccountType)
            {
                Criteria.AccountType = SelectedAccountType;
            }

            var validationMessages = new StringBuilder();
            if (!Criteria.Validate(validationMessages))
            {
                this.userMessageBox.Show(validationMessages.ToString(), "Invalid Filter Values!");
                return;
            }

            SendFilterAppliedMessage();
        }
Exemplo n.º 18
0
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.shellDialogCorrelationId))
            {
                return;
            }

            var newRule = this.ruleFactory.CreateRule(Bucket.Code); //new MatchingRule(this.budgetBucketRepository) { Bucket = Bucket };

            if (Bucket == null)
            {
                MessageBox.Show("Bucket cannot be null.");
                return;
            }

            if (UseDescription)
            {
                newRule.Description = Description;
            }

            if (UseReference1)
            {
                newRule.Reference1 = Reference1;
            }

            if (UseReference2)
            {
                newRule.Reference2 = Reference2;
            }

            if (UseReference3)
            {
                newRule.Reference3 = Reference3;
            }

            if (UseTransactionType)
            {
                newRule.TransactionType = TransactionType;
            }

            NewRule = newRule;
            var handler = RuleCreated;
            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
Exemplo n.º 19
0
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Cancel)
            {
                Reset();
                this.fileSelectionTask.Start();
                return;
            }

            // FileName is already set by data binding.

            // Use the task to signal completion.
            this.fileSelectionTask.Start();
        }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.correlationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Cancel)
            {
                return;
            }

            if (message.Response == ShellDialogButton.Help)
            {
                this.messageBox.Show(
                    "Ledgers within the Ledger Book track the actual bank balance over time of a single Bucket.  This is especially useful for budget items that you need to save up for. For example, annual vehicle registration, or car maintenance.  It can also be useful to track Spent-Monthly Buckets. Even though they are always spent down to zero each month, (like rent or mortgage payments), sometimes its useful to have an extra payment, for when there are five weekly payments in a month instead of four.");
                return;
            }

            try
            {
                if (this.ledger.StoredInAccount == StoredInAccount)
                {
                    return;
                }

                this.ledgerService.MoveLedgerToAccount(this.ledger, StoredInAccount);
                EventHandler handler = Updated;
                handler?.Invoke(this, EventArgs.Empty);
            }
            finally
            {
                Reset();
            }
        }
 private void OnShellDialogResponseMessageReceived(ShellDialogResponseMessage message)
 {
     if (message.Content is EditingTransactionController)
     {
         ListBoxItem listBoxItem = GetSelectedListBoxItem();
         if (listBoxItem != null)
         {
             listBoxItem.Focus();
         }
     }
 }
        private void OnShellDialogResponseReceived(ShellDialogResponseMessage message)
        {
            if (!message.IsItForMe(this.dialogCorrelationId))
            {
                return;
            }

            if (message.Response == ShellDialogButton.Cancel)
            {
                Canceled = true;
            }
            else
            {
                if (!BankBalances.Any())
                {
                    if (CanExecuteAddBankBalanceCommand())
                    {
                        OnAddBankBalanceCommandExecuted();
                    }
                    else
                    {
                        throw new InvalidOperationException("Failed to add any bank balances to Ledger Book reconciliation.");
                    }
                }
            }

            EventHandler<EditBankBalancesEventArgs> handler = Complete;
            if (handler != null)
            {
                handler(this, new EditBankBalancesEventArgs { Canceled = Canceled });
            }
        }