コード例 #1
0
        private void SetType()
        {
            Common.IFileAccessorFactory fileAccessorFactory = Mvx.Resolve <Common.IFileAccessorFactory>();

            switch (_model.Type)
            {
            case "dict":
                Type                = PBaseTypes.Dictionary;
                _fileAccessor       = fileAccessorFactory.GetLocalFileAccessor();
                _baseFileNameFormat = "{0}.sdc";
                break;

            case "sound":
                Type                = PBaseTypes.Sound;
                _fileAccessor       = fileAccessorFactory.GetLocalFileAccessor();
                _baseFileNameFormat = "{0}.sdc";
                break;

            case "morphology":
                Type                = PBaseTypes.Morphology;
                _fileAccessor       = fileAccessorFactory.GetResourceFileAccessor();
                _baseFileNameFormat = "Bases\\{0}.sdc";
                break;

            case "demo_dict":
                Type                = PBaseTypes.Demo;
                _fileAccessor       = fileAccessorFactory.GetResourceFileAccessor();
                _baseFileNameFormat = "Bases\\{0}.sdc";
                break;

            default:
                Debug.WriteLine(string.Format("Unknown base type: {0}", _model.Type));
                Type                = PBaseTypes.Unknown;
                _fileAccessor       = fileAccessorFactory.GetResourceFileAccessor();
                _baseFileNameFormat = "Bases\\{0}.sdc";
                break;
            }

            _baseFileName = string.Format(_baseFileNameFormat, _model.Id);
        }
コード例 #2
0
 private async void ReadHtmlTemplate()
 {
     _locker.Reset();
     await Task.Factory.StartNew(async() =>
     {
         try
         {
             Common.IFileAccessorFactory fileAccessorFactory = Mvx.Resolve <Common.IFileAccessorFactory>();
             Common.IFileAccessor fileAccessor = fileAccessorFactory.GetResourceFileAccessor();
             _htmlTemplate = await fileAccessor.ReadFile(new Uri("Assets\\ArticleHtmlTemplate.html", UriKind.Relative));
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex.Message);
         }
         finally
         {
             _locker.Set();
         }
     });
 }