private void PickerTypeStatsChanged(object sender, EventArgs e) { try { if (!(sender is Picker pk)) { return; } currentFequencyUsedToCalculate = HelperShuffle.ParseEnum <FrequencyOfIncomeExpenses>(pk.Items[pk.SelectedIndex]); CalculateTotals(currentFequencyUsedToCalculate); var fre = pk.Items[pk.SelectedIndex]; if (fre == "Annually") { CurrentViewModel.BreakDownText = "(per Year)"; return; } CurrentViewModel.BreakDownText = $"(per {pk.Items[pk.SelectedIndex].Trim(new char[] { 'l', 'y' })})"; } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void PickerTypeChanged(object sender, EventArgs e) { if (!(sender is Picker pk)) { return; } CurrentViewModel.CurrentBudgetItem.Frequency = HelperShuffle.ParseEnum <FrequencyOfIncomeExpenses>(pk.Items[pk.SelectedIndex]); }
private async void PickerTypeChanged(object sender, EventArgs e) { try { if (!(sender is Picker picker)) { return; } //save the selected frequency await SaveFrequencyOfIncomeExpenses(picker.Items[picker.SelectedIndex]); //set the selected frequency CurrentViewModel.FrequencyData = HelperShuffle.ParseEnum <FrequencyOfIncomeExpenses>(picker.Items[picker.SelectedIndex]); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private async void PickerChanged(object sender, EventArgs e) { try { if (!(sender is Picker picker)) { return; } //don't want to load the first item on initialization - let the onappearing figure it out, otherwise select default - 0 if (IsLoading) { return; } if (Device.RuntimePlatform == Device.Android) { picker.TextColor = picker.SelectedIndex == 0 ? Color.FromHex("#C0C0C0") : Color.Black; } else if (Device.RuntimePlatform == Device.iOS) { picker.TextColor = picker.SelectedIndex == 0 ? Color.FromHex("b3b3b3") : Color.Black; } switch (picker.StyleId) { case "WeightPickerStyle": if (picker.SelectedIndex != 0) { CurrentViewModel.MyData = HelperShuffle.ParseEnum <WeightType>(picker.Items[picker.SelectedIndex]); } await CurrentViewModel.SaveAnyString(picker.Items[picker.SelectedIndex], Constants.ProductOneVolumePicker); break; case "WeightBulkPicker": if (picker.SelectedIndex != 0) { CurrentViewModel.BulkData = HelperShuffle.ParseEnum <WeightType>(picker.Items[picker.SelectedIndex]); } await CurrentViewModel.SaveAnyString(picker.Items[picker.SelectedIndex], Constants.ProductBulkVolumePicker); break; case "WeightPickerTwoStyle": if (picker.SelectedIndex != 0) { CurrentViewModel.MyDataTwo = HelperShuffle.ParseEnum <WeightType>(picker.Items[picker.SelectedIndex]); } await CurrentViewModel.SaveAnyString(picker.Items[picker.SelectedIndex], Constants.ProductTwoVolumePicker); break; await CurrentViewModel.SaveAnyString(picker.Items[picker.SelectedIndex], Constants.ProductOneVolumePicker); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }