public UniversalControlVm(KeeperDb db, BalanceDuringTransactionHinter balanceDuringTransactionHinter,
                           AccNameSelectionControlInitializer accNameSelectionControlInitializer, AssociationFinder associationFinder)
 {
     _db = db;
     _accNameSelectionControlInitializer = accNameSelectionControlInitializer;
     _associationFinder = associationFinder;
     _balanceDuringTransactionHinter = balanceDuringTransactionHinter;
 }
Exemple #2
0
        public AccountTreeViewModel(KeeperDb keeperDb, IWindowManager windowManager,
                                    AskDragAccountActionViewModel askDragAccountActionViewModel)
        {
            WindowManager = windowManager;
            AskDragAccountActionViewModel = askDragAccountActionViewModel;

            _keeperDb = keeperDb;
            FillInTheTree();
        }
 public OfficialRatesViewModel(IWindowManager windowManager, KeeperDb keeperDb,
                               UsdAnnualDiagramViewModel usdAnnualDiagramViewModel,
                               BasketDiagramViewModel basketDiagramViewModel)
 {
     _windowManager             = windowManager;
     _rates                     = keeperDb.OfficialRates;
     _usdAnnualDiagramViewModel = usdAnnualDiagramViewModel;
     _basketDiagramViewModel    = basketDiagramViewModel;
     Task.Factory.StartNew(Init);
     IsDownloadEnabled = true;
 }
Exemple #4
0
        public ShellViewModel(ILifetimeScope globalScope, IWindowManager windowManager, KeeperDb keeperDb,
                              MainMenuViewModel mainMenuViewModel, AccountTreeViewModel accountTreeViewModel)
        {
            _globalScope   = globalScope;
            _windowManager = windowManager;

            MainMenuViewModel    = mainMenuViewModel;
            AccountTreeViewModel = accountTreeViewModel;

            _keeperDb = keeperDb;
        }
Exemple #5
0
        protected async override void OnStartup(object sender, System.Windows.StartupEventArgs e)
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule <AutofacKeeper>();

            KeeperDb keeperDb = await DbLoader.Load();

            builder.RegisterInstance(keeperDb);


            _container = builder.Build();

            DisplayRootViewFor <IShell>();
        }
Exemple #6
0
        public static async Task <KeeperDb> Load()
        {
            var keeperDb = await DbSerializer.Deserialize();

            if (keeperDb == null)
            {
                keeperDb = new KeeperDb();

//                keeperDb.Accounts = Accounts2018Txt.LoadFromTxt();
                keeperDb.AccountPlaneList = AccountsOldTxt.LoadFromOldTxt().ToList();
                keeperDb.OfficialRates    = await NbRbRatesOldTxt.LoadFromOldTxtAsync();

                keeperDb.Transactions = await TransactionsOldTxt.LoadFromOldTxtAsync(keeperDb.AccountPlaneList);
            }
            return(keeperDb);
        }
Exemple #7
0
 public FilterModel(KeeperDb db, AccNameSelectionControlInitializer accNameSelectionControlInitializer)
 {
     AvailableAccNames = new List <AccName>
     {
         new AccName().PopulateFromAccount(db.SeekAccount("Мои"), new List <string>())
     };
     IsAccNamePosition12  = true;
     AmountEqualTo        = true;
     IsCurrencyPosition12 = true;
     MyTagPickerVm        = new TagPickerVm {
         TagSelectorVm = accNameSelectionControlInitializer.ForFilter(), Tags = MyTags
     };
     IsTagsJoinedByAnd = true;
     CleanAll();
     MyTags.CollectionChanged += MyTags_CollectionChanged;
 }
Exemple #8
0
        public TransModel(KeeperDb db)
        {
            Db          = db;
            _tranFilter = new TranFilter();

            Rows = WrapTransactions(db.Transactions);
            Rows.CollectionChanged += Rows_CollectionChanged;

            SortedRows         = CollectionViewSource.GetDefaultView(Rows);
            SortedRows.Filter += Filter;
            SortedRows.SortDescriptions.Add(new SortDescription("Tran.Timestamp", ListSortDirection.Ascending));

            SortedRows.MoveCurrentToLast();
            SelectedTranWrappedForDatagrid            = (TranWrappedForDatagrid)SortedRows.CurrentItem;
            SelectedTranWrappedForDatagrid.IsSelected = true;

            IsCollectionChanged = false;
        }
Exemple #9
0
        public static async Task <bool> Serialize(KeeperDb db)
        {
            var path = DbUtils.GetTxtFullPath("KeeperDb.bin");

            MadeDbxBackup(path);
            try
            {
                using (Stream fStream = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    var binaryFormatter = new BinaryFormatter();
                    binaryFormatter.Serialize(fStream, db);
                }
                await Task.Delay(1);

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
        }
 public ComboboxCaterer(KeeperDb db)
 {
     _db = db;
 }
 public TransactionsViewModel(KeeperDb keeperDb)
 {
     _keeperDb = keeperDb;
 }