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]; }
public Sort(TransactionListModel viewmodel) { ViewModel = viewmodel; }
public Search(TransactionListModel viewmodel) { ViewModel = viewmodel; }