public void OnNavigatedTo(INavigationParameters parameters)
        {
            var param = (ETypeApplication)parameters[$"{ConfigPageUri.NextPage}"];

            Publisher = param.ToString();
            switch (Publisher)
            {
            case "DC":
            {
                PublisherSecond = "Warner Brothers";
                PublisherThird  = "Dynamite Entertainment";
                break;
            }

            case "Marvel":
            {
                PublisherSecond = "Disney";
                PublisherThird  = "Atlas";
                PublisherFourth = "Fawcett Publications";
                break;
            }

            default:
                break;
            }
            LoadListCommand.Execute();
        }
Beispiel #2
0
        private void FileDLDone_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (fileDLDone.IsSuccessfullyCompleted && e.PropertyName == "IsSuccessfullyCompleted")
            {
                var tmpList = fileDLDone.Result;
                tmpList = tmpList.OrderBy(p => p.title).ToList();
                jobList = new ObservableCollection <Job>(tmpList);



                canLoad = true;
                LoadListCommand.RaiseCanExecuteChanged();
                canSave = true;
                SaveListCommand.RaiseCanExecuteChanged();
            }
        }
Beispiel #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;
            }
        }
        public MainPageViewModel(IAppNavigation appNav)
        {
            _appNav = appNav;

            LoadListCommand    = ReactiveCommand.CreateFromTask <List <StationInfoModel> >(execute: () => LoadListAsync(), outputScheduler: RxApp.MainThreadScheduler);
            LoadSensorsCommand = ReactiveCommand.CreateFromTask <StationInfoModel, List <SensorInfoModel> >(station => LoadStationSensorsAsync(station), outputScheduler: RxApp.MainThreadScheduler);
            LoadDataCommand    = ReactiveCommand.CreateFromTask <SensorInfoModel, SensorDataEntry>(sensor => LoadSensorDataAsync(sensor), outputScheduler: RxApp.MainThreadScheduler);

            _stationsInfoList = LoadListCommand.ToProperty(this, x => x.StationsList, new List <StationInfoModel>());
            _sensorInfoModels = LoadSensorsCommand.ToProperty(this, x => x.SensorsList, new List <SensorInfoModel>());
            _sensorData       = LoadDataCommand.ToProperty(this, x => x.SensorData, new SensorDataEntry());

            this.ObservableForProperty(x => x.IsBeingNavigated)
            .Select(e => new Unit())
            .InvokeCommand(LoadListCommand);

            this.ObservableForProperty(x => x.SelectedStation)
            .Select(e => e.Value)
            .InvokeCommand(LoadSensorsCommand);

            this.ObservableForProperty(x => x.SensorsList)
            .Select(e => e.Value)
            .Subscribe(x => SelectedSensor = x?.FirstOrDefault());

            this.ObservableForProperty(x => x.SelectedSensor)
            .Select(e => e.Value)
            .InvokeCommand(LoadDataCommand);


            _filteredStationsInfoList = this.WhenAnyValue(
                x => x.Filter,
                x => x.StationsList,
                (f, l) => l.CreateDerivedCollection(x => x,
                                                    x => x.StationName.Contains(string.IsNullOrEmpty(f) ? "" : f)
                                                    ).ToList()
                )
                                        .ToProperty(this, x => x.FilteredStationsList, new List <StationInfoModel>());
        }