Esempio n. 1
0
        public async void SettingDetailCommand(SettingsViewModel SettingDetail)
        {
            string action;
            var    api = new MediaFarmerApi();

            if (SettingDetail.DataType == 1)
            {
                action = await CoreMethods.DisplayActionSheet(string.Concat("Change value for ", SettingDetail.SettingName), "Cancel", null, "10", "30", "50", "70", "100");

                if (action == "Cancel")
                {
                    return;
                }
                SettingDetail.SettingValue = int.Parse(action);
            }
            else if (SettingDetail.DataType == 2)
            {
                action = await CoreMethods.DisplayActionSheet(string.Concat("Change value for ", SettingDetail.SettingName), "Cancel", null, "true", "false");

                if (action == "Cancel")
                {
                    return;
                }
                SettingDetail.Active = bool.Parse(action);
            }
            else
            {
                return;
            }
            await api.UpdateSettings(SettingDetail);

            PopulateSettingsList();
        }
        public async void ExecuteGetQueued()
        {
            var             api = new MediaFarmerApi();
            List <QueModel> res = await api.GetQueued();

            if (res.Count > 0)
            {
                CurrentlyQueued = new ObservableCollection <QueModel>(res);
            }
        }
Esempio n. 3
0
        private async void PopulateSettingsList()
        {
            var api = new MediaFarmerApi();
            List <SettingsViewModel> settings = await api.GetSettings();

            if (settings.Count > 0)
            {
                SettingsList = new ObservableCollection <SettingsViewModel>(settings);
            }
        }
Esempio n. 4
0
        public async void ExecuteSearch()
        {
            if (!Settings.HostValidSetting)
            {
                await CoreMethods.DisplayAlert("Invalid Host", "Please check your Host and Port settings on the Settings Tab", "Ok");

                return;
            }

            var trackSearch           = TrackSearch ?? "";
            var api                   = new MediaFarmerApi();
            List <TrackViewModel> res = await api.GetTracks(trackSearch);

            if (res.Count > 0)
            {
                Tracks = new ObservableCollection <TrackViewModel>(res);
            }
        }
Esempio n. 5
0
        public async void QueSelectedTrack(TrackViewModel Track)
        {
            var confirmed = await CoreMethods.DisplayAlert("Queue this track?", "Would you like to queue this track", "Yes", "No");

            if (!confirmed)
            {
                return;
            }

            var           api         = new MediaFarmerApi();
            ResponseModel QueResponse = await api.QueTrack(Track.TrackId);

            if (QueResponse.Success)
            {
                await CoreMethods.DisplayAlert("Success", "Track has been successfully Queued", "Ok");
            }
            else
            {
                await CoreMethods.DisplayAlert("Failed", "Track has not been queued", "Ok");
            }
        }
Esempio n. 6
0
        public async void ExecuteChangeHost()
        {
            var IsHostValid = await PingHost();

            if (!IsHostValid)
            {
                return;
            }

            Settings.HostKeySettings = Host;
            Settings.PortKeySettings = Port;

            var           api = new MediaFarmerApi();
            ResponseModel res = await api.Ping();

            if (res.Success)
            {
                Settings.HostValidSetting = true;
                SettingsButtonText        = "Connected!!!";
                PopulateSettingsList();
            }
        }