Beispiel #1
0
        public SaveableUSCurrencyRepo LoadRepo(string filePath)
        {
            BinaryFormatter        formatter = new BinaryFormatter();
            FileStream             stream    = new FileStream(filePath, FileMode.Open);
            List <ICoin>           coins     = (List <ICoin>)formatter.Deserialize(stream);
            SaveableUSCurrencyRepo repo      = new SaveableUSCurrencyRepo();

            repo.Coins = coins;
            return(repo);
        }
Beispiel #2
0
 private void SaveRepo()
 {
     if (string.IsNullOrEmpty(FilePath))
     {
         SaveAsRepo();
     }
     else
     {
         SaveableUSCurrencyRepo repo = new SaveableUSCurrencyRepo(repository);
         repo.SaveRepo(FilePath);
     }
 }
Beispiel #3
0
        private void SaveAsRepo()
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "Repository Files(*.repo)|*.repo";

            if (dialog.ShowDialog() == true)
            {
                FilePath = dialog.FileName;
                SaveableUSCurrencyRepo repo = new SaveableUSCurrencyRepo(repository);
                repo.SaveRepo(FilePath);
            }
        }
Beispiel #4
0
        private void OpenRepo()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Repository Files(*.repo)|*.repo";

            if (dialog.ShowDialog() == true)
            {
                SaveableUSCurrencyRepo repo = new SaveableUSCurrencyRepo();
                FilePath   = dialog.FileName;
                repository = repo.LoadRepo(FilePath);
                RaisePropertyChangedEvent("TotalValue");
            }
        }