コード例 #1
0
        public CodeCampService(string baseUrl, string campKey)
        {
            // ideally each app would just send in its folder path or helper instead of doing it this way
            // including this as a example of how to use compiler directives in shared layers
#if WINDOWS_PHONE
            _fileHelper = new IsolatedStorageFileSystemHelper();
#elif __ANDROID__
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../cache");
            _fileHelper = new StandardFileSystemHelper(folderPath);
#else
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../Library/Caches");
            _fileHelper = new StandardFileSystemHelper(folderPath);
#endif

            _fileName  = campKey + ".xml";
            Repository = new CodeCampRepository(null);
            _client    = new CodeCampDataClient(baseUrl, campKey);

            if (!_fileHelper.FileExists(_fileName))
            {
                downloadNewXmlFile();
            }
            else
            {
                Repository = new CodeCampRepository(_fileHelper.ReadFile(_fileName));
            }
        }
コード例 #2
0
        public CodeCampService(string baseUrl, string campKey)
        {
            // ideally each app would just send in its folder path or helper instead of doing it this way
            // including this as a example of how to use compiler directives in shared layers
            #if WINDOWS_PHONE
            _fileHelper = new IsolatedStorageFileSystemHelper();
            #elif __ANDROID__
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../cache");
            _fileHelper = new StandardFileSystemHelper(folderPath);
            #else
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../Library/Caches");
            _fileHelper = new StandardFileSystemHelper(folderPath);
            #endif

            _fileName = campKey + ".xml";
            Repository = new CodeCampRepository(null);
            _client = new CodeCampDataClient(baseUrl, campKey);

            if (!_fileHelper.FileExists(_fileName))
            {
                downloadNewXmlFile();
            }
            else
            {
                Repository = new CodeCampRepository(_fileHelper.ReadFile(_fileName));
            }
        }