Inheritance: INotifyPropertyChanged
 public RecentAccountViewModel(ViewModelBase parent, Account account, string accountName, Amount balance)
     : base(parent)
 {
     Account = account;
     AccountName = accountName;
     Balance = balance;
 }
        public RecentAccountViewModel(ViewModelBase parent, Account account, AccountProperties properties)
            : base(parent)
        {
            if (parent == null)
                throw new ArgumentNullException(nameof(parent));
            if (properties == null)
                throw new ArgumentNullException(nameof(properties));

            Account = account;
            AccountName = properties.AccountName;
            Balance = properties.TotalBalance;
        }
Beispiel #3
0
 /// <summary>
 /// Optionally handles a specific message posted by a child view model.
 /// </summary>
 /// <param name="message">Child message to handle.</param>
 /// <returns>Returns true if the message was handled and should not be propigated to a parent view model.</returns>
 protected virtual bool OnRoutedMessage(ViewModelBase sender, ViewModelMessage message)
 {
     return false;
 }
Beispiel #4
0
 public ViewModelBase(ViewModelBase parent = null)
 {
     _parentViewModel = parent;
 }
Beispiel #5
0
        protected override bool OnRoutedMessage(ViewModelBase sender, ViewModelMessageBase message)
        {
            var showTx = message as ShowTransactionMessage;
            if (showTx != null)
            {
                ShowTransaction(showTx.Transaction);
                return true;
            }

            var showAccount = message as ShowAccountMessage;
            if (showAccount != null)
            {
                ShowAccount(showAccount.Account);
                return true;
            }

            var openDialog = message as OpenDialogMessage;
            if (openDialog != null && sender == VisibleContent)
            {
                VisibleDialogContent = openDialog.Dialog;
                return true;
            }

            var hideDialog = message as HideDialogMessage;
            if (hideDialog != null && sender == VisibleDialogContent)
            {
                VisibleDialogContent = null;
                return true;
            }

            return false;
        }