public MainViewModel()
        {
            _selectAccount = new SelectAccount(this);
            SelectAccount  = new RelayCommand <object>((parameter) => SwitchAccount(parameter));

            _save = new Save(this);
            Save  = new RelayCommand(SaveAccounts);

            _EditTransactionModel = new EditTransactionModel(this);
            _ChartModel           = new ChartUserControlModel(this);
            _TransactionListModel = new TransactionListModel(this);
            _EditAccountModel     = new EditAccountModel(this);

            CurrentViewModel = _TransactionListModel;

            TransactionListUserControlCommand = new RelayCommand(() => ExecuteTransactionListUserControlCommand());
            ChartUserControlCommand           = new RelayCommand(() => ExecuteChartUserControlCommand());
            EditAccountControlCommand         = new RelayCommand <object>((parameter) => ExecuteEditAccountControlCommand(parameter));

            var xml = ObjextXMLSerializer.GetInstance;

            Accounts = new ObservableCollection <Account>();
            try
            {
                Accounts = new ObservableCollection <Account>(xml.LoadAccounts());
            }
            catch (Exception)
            {
            }
            if ((Accounts == null) || Accounts.Count == 0)
            {
                Accounts = new ObservableCollection <Account>()
                {
                    new Account()
                    {
                        Name = "Main", Color = Colors.DarkCyan
                    },
                };
            }
            CurrentAccount = Accounts[0];
        }
        public MainViewModel()
        {
            _selectAccount = new SelectAccount(this);
            SelectAccount = new RelayCommand<object>((parameter) => SwitchAccount(parameter));

            _save = new Save(this);
            Save = new RelayCommand(SaveAccounts);

            _EditTransactionModel = new EditTransactionModel(this);
            _ChartModel = new ChartUserControlModel(this);
            _TransactionListModel = new TransactionListModel(this);
            _EditAccountModel = new EditAccountModel(this);

            CurrentViewModel = _TransactionListModel;

            TransactionListUserControlCommand = new RelayCommand(() => ExecuteTransactionListUserControlCommand());
            ChartUserControlCommand = new RelayCommand(() => ExecuteChartUserControlCommand());
            EditAccountControlCommand = new RelayCommand<object>((parameter) => ExecuteEditAccountControlCommand(parameter));

            var xml = ObjextXMLSerializer.GetInstance;
            Accounts = new ObservableCollection<Account>();
            try
            {
                Accounts = new ObservableCollection<Account>(xml.LoadAccounts());
            }
            catch (Exception)
            {
            }
            if ((Accounts == null) || Accounts.Count == 0)
            {
                Accounts = new ObservableCollection<Account>() {
                    new Account() { Name = "Main",    Color = Colors.DarkCyan},
                };
            }
            CurrentAccount = Accounts[0];
        }
예제 #3
0
 public Sort(TransactionListModel viewmodel)
 {
     ViewModel = viewmodel;
 }
예제 #4
0
 public Search(TransactionListModel viewmodel)
 {
     ViewModel = viewmodel;
 }