Beispiel #1
0
        public static async Task <string> PopupOutput(string fileName)
        {
            string outputsFile = Path.Combine(outputsPath, fileName);
            var    result      = await Task.Run(() =>
            {
                DirFileHelper.ExistsFile(outputsFile);
                var jsonInfos = DirFileHelper.ReadLastLines(outputsFile);
                return(jsonInfos);
            });

            return(result);
        }
Beispiel #2
0
 public static async void SaveOutputs(string fileName, string content)
 {
     string outputsFile = Path.Combine(outputsPath, fileName);
     await Task.Run(() =>
     {
         lock (_locker)
         {
             DirFileHelper.ExistsFile(outputsFile);
             DirFileHelper.WriteText(outputsFile, content);
         }
     });
 }
Beispiel #3
0
        private async void ReadJobs()
        {
            var result = await Task.Run(() =>
            {
                DirFileHelper.ExistsFile(jobsFile);
                var jsonInfos = DirFileHelper.ReadFile(jobsFile);
                if (jsonInfos != null)
                {
                    var jobInfoList = JsonConvert.DeserializeObject <List <JobInfo> >(jsonInfos);
                    return(jobInfoList);
                }
                else
                {
                    return(null);
                }
            });

            JobInfos = result != null ? new ObservableCollection <JobInfo>(result) : new ObservableCollection <JobInfo>();
            JobInfos.CollectionChanged += JobInfos_CollectionChanged;
            ReadFinishedEvent.Invoke(this, EventArgs.Empty);
        }