예제 #1
0
        public async Task <List <Job> > GetJobListAsync(IInputDLer inputDLer, IJobListParser jobListParser)
        {
            _inputDLer     = inputDLer;
            _jobListParser = jobListParser;

            string inpFileString = await _inputDLer.DownloadPostingsAsync().ConfigureAwait(false);

            List <Job> parsedJobList = new List <Job>();

            parsedJobList = await _jobListParser.ParseJobListAsync(inpFileString).ConfigureAwait(false);

            return(parsedJobList);
        }
예제 #2
0
        public MainViewModel()
        {
            status = new Status()
            {
                process = "", percent = 0, isBusy = false
            };
            inputDLer     = null;
            jobListParser = null;

            LoadListCommand = new RelayCommand(LoadList, CanLoad);
            SaveListCommand = new RelayCommand(SaveList, CanSave);
            ExitCommand     = new RelayCommand(Exit, CanExit);

            canLoad = true;
            canSave = false;

            Messenger.Default.Register <Status>(this, SetStatus);
        }
예제 #3
0
        private void LoadList()
        {
            canLoad = false;
            LoadListCommand.RaiseCanExecuteChanged();
            if (txtChk)
            {
                Debug.WriteLine("a txt file must be loaded");
                canLoad = true;
                LoadListCommand.RaiseCanExecuteChanged();
            }
            else if (xmlChk)
            {
                jobList = new ObservableCollection <Job>()
                {
                    new Job()
                    {
                        title = "Sorry, this function is not implemented yet",
                    }
                };
                canLoad = true;
                LoadListCommand.RaiseCanExecuteChanged();
            }
            else
            {
                jl = new List <Job>();
                string jobsURL = @"";
                inputDLer     = new JsonJobListDLer(jobsURL);
                jobListParser = new JsonJobListParser();

                status.percent  = 0;
                status.process  = "Process started";
                status.isBusy   = true;
                isIndeterminate = true;

                GetJobList getJobs = new GetJobList();
                fileDLDone = NotifyTaskCompletion.Create(getJobs.GetJobListAsync(inputDLer, jobListParser));
                fileDLDone.PropertyChanged += FileDLDone_PropertyChanged;
            }
        }