コード例 #1
0
        /// <summary>
        /// Might throw an exception if it cannot read the file.
        /// </summary>
        /// <param name="filePath"></param>
        public void Load(string filePath) // TODO should be a command
        {
            // Read file
            ListCasesXmlReaderParser fileParser = new ListCasesXmlReaderParser(new FileInfo(filePath));
            ListCases loadedFileData            = fileParser.Read();

            DoCommand(new LoadCommand(this, filePath, loadedFileData));
        }
コード例 #2
0
        /*public FileInfo DataFilePath
         * {
         *  get
         *  {
         *      return mDataFilePath;
         *  }
         *  set
         *  {
         *      mDataFilePath = value;
         *      OnPropertyChanged("DataFilePath");
         *  }
         * }
         * private FileInfo mDataFilePath = new FileInfo(Path.Combine(
         *                                              Directory.GetCurrentDirectory(),
         *                                              "d_accounting_data.xml"));*/

        /// <summary>
        /// Default constructor of the main VM
        /// </summary>
        public MainViewModel()
        {
            try
            {
                ListCasesXmlReaderParser readParser = new ListCasesXmlReaderParser(mSettings.DataFilePath);
                mCases = readParser.Read();
            }
            catch (Exception)
            {
                mCases = new ListCases();
            }
        }