示例#1
0
        public DownloadViewModel()
        {
            FileSource = new FileSourceViewModel();

            this.RegisterFileSource(FileSource);
            this.RegisterProperty(() => TargetPath, Tx.T("TasksCommon:Commands.Download.Properties.TargetPath"),
                                  Tx.T("TasksCommon:Commands.Download.Properties.TargetPath.Description"), Tx.T("TasksCommon:Categories.Common"));
            this.RegisterProperty(() => FileExistsBehavior, Tx.T("TasksCommon:Commands.Download.Properties.FileExistsBehavior"),
                                  Tx.T("TasksCommon:Commands.Download.Properties.FileExistsBehavior.Description"), Tx.T("TasksCommon:Categories.Behavior"));
        }
示例#2
0
        public async Task <IActionResult> LoadFileAndAnalyze([FromForm] FileSourceViewModel fileSourceViewModel)
        {
            try
            {
                var memorySource = await _fileSourceLoader.LoadData(fileSourceViewModel);

                var metrics = _metricsCreator.CreateMetrics(memorySource);
                return(new JsonResult(new { success = true, metrics }, new JsonSerializerSettings()
                {
                    Converters = new List <JsonConverter>()
                    {
                        new StringEnumConverter()
                    }
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new { success = false, exception = ex.ToString() }));
            }
        }
        public async Task <IActionResult> LoadFromFile([FromBody] FileSourceViewModel source)
        {
            try
            {
                var memorySource = await _fileSourceLoader.LoadData(source);

                await _fileProjectWorker.SaveProject(memorySource, source.Project);

                return(new JsonResult(new
                {
                    success = true
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(new
                {
                    success = false,
                    exception = ex.ToString()
                }));
            }
        }
示例#4
0
 public DownloadAndExecuteViewModel()
 {
     FileSource = new FileSourceViewModel();
     this.RegisterFileSource(FileSource);
 }