private void SaveButtonTouchUpInside(object sender, EventArgs e)
        {
            ShowHideCustomName();
            var exerciseType = (PreBuiltExersises)(int)_exerciseTypePicker.SelectedRowInComponent(0);

            if (exerciseType == PreBuiltExersises.Custom && string.IsNullOrWhiteSpace(CustomExerciseName.Text))
            {
                GeneralAlertDialogs.ShowValidationErrorPopUp(this, "Please enter a name for your exercise.");
                return;
            }

            if (_selectedExercise != null)
            {
                _selectedExercise.Name     = exerciseType == PreBuiltExersises.Custom ? CustomExerciseName.Text : string.Empty;
                _selectedExercise.Quantity = (int)_repetitionTypePicker.SelectedRowInComponent(0) + 1;
                _selectedExercise.Type     = exerciseType;
                Data.UpdateExerciseBlock(_selectedExercise);
            }
            else
            {
                Data.InsertExerciseBlock(new ExerciseBlock
                {
                    Name     = exerciseType == PreBuiltExersises.Custom ? CustomExerciseName.Text : string.Empty,
                    Quantity = (int)_repetitionTypePicker.SelectedRowInComponent(0) + 1,
                    Type     = exerciseType,
                    Enabled  = true
                });
            }

            ServiceManager.RestartNotificationServiceIfNeeded();
            NavigationController.PopViewController(true);
        }
Пример #2
0
        /*public override UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
         * {
         * UILabel label = view as UILabel;
         * if(label == null)
         * {
         * label = new UILabel();
         * label.Font = UIFont.SystemFontOfSize(17f);
         * label.Lines = 0;
         * label.TextAlignment = UITextAlignment.Center;
         * }
         *
         * label.Text = GetTitle(pickerView, row, component);
         *
         * return label;
         * }*/

        public override void Selected(UIPickerView pickerView, nint row, nint component)
        {
            int month = (int)pickerView.SelectedRowInComponent(0) + 1;
            int year  = minYear + (int)pickerView.SelectedRowInComponent(1);

            viewModel.ValidityTime = new DateTime(year, month, DateTime.Today.Day);
        }
Пример #3
0
 // Handle the selection event for the picker.
 public override void Selected(UIPickerView pickerView, nint row, nint component)
 {
     // Get the selected RGB values.
     SelectedRed   = (int)pickerView.SelectedRowInComponent(0);
     SelectedGreen = (int)pickerView.SelectedRowInComponent(1);
     SelectedBlue  = (int)pickerView.SelectedRowInComponent(2);
 }
Пример #4
0
 public override void Selected(UIPickerView picker, nint row, nint component)
 {
     textField.Text        = source.ElementAt((int)picker.SelectedRowInComponent(0)) + "";
     element.SelectedItem  = source.ElementAt((int)picker.SelectedRowInComponent(0)) + "";
     element.SelectedIndex = (this.hasPlaceholder) ? ((int)row - 1) : (int)row;
     element.Text          = source.ElementAt((int)picker.SelectedRowInComponent(0)) + "";
 }
Пример #5
0
            public override void Selected(UIPickerView pickerView, nint row, nint component)
            {
                if (component == 0)
                {
                    SelectedIndex = (int)pickerView.SelectedRowInComponent(0);

                    pickerView.ReloadComponent(1);
                }

                // 获取选中的group
                GroupModel p = _pickerView.SelectedSource[SelectedIndex];

                if (p.Property.Count <= 0)
                {
                    return;
                }

                // 获取选中的property
                int index = (int)pickerView.SelectedRowInComponent(1);

                SelectedItem = p.GroupName + "-" + p.Property[index].Name;


                if (!string.IsNullOrEmpty(SelectedItem))
                {
                    _pickerView.OnSelectedPropertyChanged(_pickerView, SelectedItem);
                }
            }
Пример #6
0
        private void SaveButtonTouchUpInside(object sender, EventArgs e)
        {
            _schedule.Period = (SchedulePeriod)(int)_schedulePicker.SelectedRowInComponent(0);
            var startHourTranslatedIndex = _startTimePicker.SelectedRowInComponent(0) == 11 ? 0 : _startTimePicker.SelectedRowInComponent(0) + 1;
            var startHour   = (int)(startHourTranslatedIndex + (12 * _startTimePicker.SelectedRowInComponent(2)));
            var startMinute = (int)_startTimePicker.SelectedRowInComponent(1) * 15;
            var startTime   = new DateTime(1, 1, 1, startHour, startMinute, 0);

            var endHourTranslatedIndex = _endTimePicker.SelectedRowInComponent(0) == 11 ? 0 : _endTimePicker.SelectedRowInComponent(0) + 1;
            var endHour   = (int)(endHourTranslatedIndex + (12 * _endTimePicker.SelectedRowInComponent(2)));
            var endMinute = (int)_endTimePicker.SelectedRowInComponent(1) * 15;
            var endTime   = new DateTime(1, 1, 1, endHour, endMinute, 0);

            if (startTime >= endTime)
            {
                GeneralAlertDialogs.ShowValidationErrorPopUp(this, "Please make sure your start time is before your end time.");
                return;
            }

            _schedule.StartTime = startTime;
            _schedule.EndTime   = endTime;

            Data.SaveExerciseSchedule(_schedule);

            ServiceManager.RestartNotificationServiceIfNeeded();
            NavigationController.PopViewController(true);
        }
Пример #7
0
        private void SetPickerToView()
        {
            _picker_model = new CountryCodePickerView();

            _picker       = new UIPickerView();
            _picker.Model = _picker_model;
            _picker.ShowSelectionIndicator = true;
            _picker.BackgroundColor        = UIColor.White;

            var toolbar = new UIToolbar();

            toolbar.BarStyle    = UIBarStyle.Default;
            toolbar.Translucent = true;
            toolbar.SizeToFit();

            var doneButton = new UIBarButtonItem(Application.LocalizedString("Validate"), UIBarButtonItemStyle.Done, (s, e) =>
            {
                CountryCodeTextField.Text = _picker_model.ValuesPicker[(int)_picker.SelectedRowInComponent(0)].Item1.ToString();
                CountryCodeLabel.Text     = _picker_model.ValuesPicker[(int)_picker.SelectedRowInComponent(0)].Item2.ToString();
                CountryCodeTextField.ResignFirstResponder();
            });

            toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);

            CountryCodeTextField.TouchDown         += SetPicker;
            CountryCodeTextField.InputView          = _picker;
            CountryCodeTextField.InputAccessoryView = toolbar;
        }
Пример #8
0
 // Handle the selection event for the picker.
 public override void Selected(UIPickerView pickerView, nint row, nint component)
 {
     // Get the selected RGB values.
     _selectedRed   = _redValues[pickerView.SelectedRowInComponent(0)];
     _selectedGreen = _greenValues[pickerView.SelectedRowInComponent(1)];
     _selectedBlue  = _blueValues[pickerView.SelectedRowInComponent(2)];
 }
Пример #9
0
 public override void Selected(UIPickerView pickerView, nint row, nint component)
 {
     var selectedHours = pickerView.SelectedRowInComponent(0);
     var selectedMinutes = pickerView.SelectedRowInComponent(2);
     var selectedSeconds = pickerView.SelectedRowInComponent(4);
     var time = new TimeSpan((int)selectedHours, (int)selectedMinutes, (int)selectedSeconds);
     _myTimePicker.SelectedTime = time;
 }
Пример #10
0
            public override void Selected(UIPickerView pickerView, nint row, nint component)
            {
                var mm = 60 + pickerView.SelectedRowInComponent(0) * 10;
                var ss = 60 + pickerView.SelectedRowInComponent(1) * 10;

                textField.Text = mm + "-" + ss;
                textField.SendActionForControlEvents(UIControlEvent.ValueChanged);
            }
Пример #11
0
            public override void Selected(UIPickerView pickerView, nint row, nint component)
            {
                var mm = string.Format("{0:00}", pickerView.SelectedRowInComponent(0));
                var ss = string.Format("{0:00}", pickerView.SelectedRowInComponent(1));

                textField.Text = mm + ":" + ss;
                textField.SendActionForControlEvents(UIControlEvent.ValueChanged);
            }
 public override void Selected(UIPickerView picker, nint row, nint component)
 {
     selectedHour   = Hour[picker.SelectedRowInComponent(0)];
     selectedMinute = Minute[picker.SelectedRowInComponent(1)];
     if (NumberSelected != null)
     {
         NumberSelected(this, EventArgs.Empty);
     }
 }
Пример #13
0
            public override void Selected(UIPickerView picker, nint row, nint component)
            {
                var qbv = (QuartzBlendingView)parent.quartzView;

                qbv.DestinationColor = Colors [picker.SelectedRowInComponent(0)];
                qbv.SourceColor      = Colors [picker.SelectedRowInComponent(1)];
                qbv.BlendMode        = (CGBlendMode)(int)picker.SelectedRowInComponent(2);
                qbv.SetNeedsDisplay();
            }
Пример #14
0
        // Handle the selection event for the picker.
        public override void Selected(UIPickerView pickerView, nint row, nint component)
        {
            // Get the selected symbol key value for each category.
            SelectedSymbolKey1 = _symbolLayerItems1[(int)pickerView.SelectedRowInComponent(0)].Key;
            SelectedSymbolKey2 = _symbolLayerItems2[(int)pickerView.SelectedRowInComponent(1)].Key;
            SelectedSymbolKey3 = _symbolLayerItems3[(int)pickerView.SelectedRowInComponent(2)].Key;

            // Raise an event to notify the selection has changed.
            SymbolSelected?.Invoke(this, new EventArgs());
        }
Пример #15
0
        public override void Selected(UIPickerView pickerView, nint row, nint component)
        {
            if (component == YearComponentIndex)
            {
                SelectedYear = (int)pickerView.SelectedRowInComponent(YearComponentIndex);

                if (this.PickerView.CustomDatePicker?.DatePicker?.HasDay == true)
                {
                    pickerView.ReloadComponent(DayComponentIndex);
                }

                if (this.PickerView.CustomDatePicker?.DatePicker?.HasMonth == true)
                {
                    pickerView.ReloadComponent(MonthComponentIndex);
                }
            }
            else if (component == MonthComponentIndex)
            {
                SelectedMonth = (int)pickerView.SelectedRowInComponent(MonthComponentIndex);

                if (this.PickerView.CustomDatePicker?.DatePicker?.HasDay == true)
                {
                    pickerView.ReloadComponent(DayComponentIndex);
                }
            }
            else
            {
                SelectedDay = (int)pickerView.SelectedRowInComponent(DayComponentIndex);
            }

            YearModel yearModel = this.PickerView.Years[SelectedYear];

            if (yearModel.Months.Count <= 0)
            {
                return;
            }

            MonthModel monthModel = yearModel.Months[SelectedMonth];

            if (monthModel.Days.Count <= 0)
            {
                return;
            }

            SelectedDay = SelectedDay >= monthModel.Days.Count ? monthModel.Days.Count - 1 : SelectedDay;

            DayModel dayModel = monthModel.Days[SelectedDay];

            SelectedItem = yearModel.Year + "-" + monthModel.Month + "-" + dayModel.Day;

            if (!string.IsNullOrEmpty(SelectedItem))
            {
                this.PickerView.SelectedPropertyChanged(SelectedItem);
            }
        }
 public override void Selected(UIPickerView picker, nint row, nint component)
 {
     if (component == 0 && row > picker.SelectedRowInComponent(1))
     {
         picker.Select(row, 1, true);
     }
     if (component == 1 && row < picker.SelectedRowInComponent(0))
     {
         picker.Select(row, 0, true);
     }
 }
Пример #17
0
 public override void Selected(UIPickerView picker, nint row, nint component)
 {
     if(component == 0 && row > picker.SelectedRowInComponent(1))
     {
         picker.Select(row, 1, true);
     }
     if(component == 1 && row < picker.SelectedRowInComponent(0))
     {
         picker.Select(row, 0, true);
     }
 }
Пример #18
0
        public List <string> pickerSelectDone(UIPickerView pickerView)
        {
            List <string> selectedDataList = new List <string>();

            // update CancelSelectedRow & set selected Data List
            for (int i = 0; i < pickerView.NumberOfComponents; i++)
            {
                originalSelectedRow[i] = (int)pickerView.SelectedRowInComponent(i);

                selectedDataList.Add(this.GetTitle(pickerView, pickerView.SelectedRowInComponent(i), i));
            }
            return(selectedDataList);
        }
        // Handle the selection event for the picker to create a statistic definition with the values chosen
        public override void Selected(UIPickerView pickerView, nint row, nint component)
        {
            // Get the field name
            string onFieldName = _fieldNames[pickerView.SelectedRowInComponent(0)];

            // Get the statistic type
            StatisticType statType = (StatisticType)_statTypes.GetValue(pickerView.SelectedRowInComponent(1));

            // Create an output field alias by concatenating the field name and statistic type
            string outAlias = onFieldName + "_" + statType.ToString();

            // Create a new statistic definition (available from the SelectedStatDefinition public property)
            _selectedStatDefinition = new StatisticDefinition(onFieldName, statType, outAlias);
        }
        public static void ToPickerWithValues(this UITextField textField, IList <string> values, int index, Action <int> action)
        {
            var toolBar       = new UIToolbar(new CGRect(0, 0, 320, 44));
            var doneButton    = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            var flexibleSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            toolBar.SetItems(new UIBarButtonItem[] { flexibleSpace, doneButton }, true);

            var model  = new UIPickerViewStringArrayModel();
            var picker = new UIPickerView();

            picker.Model = model;
            foreach (var displayValue in values)
            {
                model.Items.Add(displayValue.ToString());
            }
            picker.Select(index, 0, true);
            textField.InputView          = picker;
            textField.InputAccessoryView = toolBar;
            textField.Text = values[index].ToString();

            doneButton.Clicked += (s, e) =>
            {
                var selectedIndex = (int)picker.SelectedRowInComponent(0);
                textField.Text = values[selectedIndex].ToString();
                textField.EndEditing(true);
                action?.Invoke(selectedIndex);
            };
        }
Пример #21
0
        public override void Selected(UIPickerView picker, nint row, nint component)
        {
            var selected = Settings.LocationResponse.PurposeForFlying[(int)picker.SelectedRowInComponent(0)];

            Settings.PurposeId     = selected.FlyingPurposeId;
            Settings.PurposeString = selected.Purpose;
        }
    public override void Selected(UIPickerView picker, nint row, nint component)
    {
        var selected = Settings.LocationResponse.PilotRating[(int)picker.SelectedRowInComponent(0)];

        //Assign value to registration object
        Settings.PilotTypeId = selected.PilotTypeId;
    }
        public override void Selected(UIPickerView picker, nint row, nint component)
        {
            var selected = Owner.CMMDResonseProperty.ModDesLst[(int)picker.SelectedRowInComponent(0)];

            //Assign value to registration obje
            Settings.DesignationId = selected.DesignationId;
        }
Пример #24
0
        private void ShowAlertPicker()
        {
            var alertView = UIAlertController.Create("Select color", "\n\n\n\n\n", UIAlertControllerStyle.Alert);

            var pickerView = new UIPickerView(new CGRect(0, 50, 260, 115));

            pickerView.DataSource = this;
            pickerView.Delegate   = this;

            alertView.View.AddSubview(pickerView);

            var action = UIAlertAction.Create("OK", UIAlertActionStyle.Default, (obj) =>
            {
                var row = pickerView.SelectedRowInComponent(0);
                colorSelectedView.BackgroundColor = _colors.ElementAt((int)row).Key;
                RefreshSkeleton();
            });

            alertView.AddAction(action);


            var cancelAction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null);

            alertView.AddAction(cancelAction);

            PresentViewController(alertView, false, () =>
            {
                var frame        = pickerView.Frame;
                frame.Width      = alertView.View.Frame.Size.Width;
                pickerView.Frame = frame;
            });
        }
Пример #25
0
        public override void Selected(UIPickerView picker, nint row, nint component)
        {
            //pvc.label.Text = String.Format("{0} - {1}",
            //		names[picker.SelectedRowInComponent(0)],
            //		picker.SelectedRowInComponent(1));
            Console.WriteLine("Selected a value:");
            string           str     = names[picker.SelectedRowInComponent(0)];
            InputTypeBuilder builder = new InputTypeBuilder();


            switch (str)
            {
            case "Integer": builder.createTextforInteger(view);
                break;

            case "String": builder.createTextforString(view);
                break;

            case "Double": builder.createTextforDouble(view);
                break;

            case "Boolean": break;

            case "List": break;

            case "Date": builder.createDatePicker(view);
                break;
            }
            //view.AddSubview(scrollView);
        }
Пример #26
0
        private void CreateOptionView()
        {
            List <string> index = new List <string> {
                "Multiple", "SingleDeselect", "Single", "None"
            };
            var picker = new TreeViewPickerModel(index);

            selectionPicker.Model = picker;
            selectionPicker.SelectedRowInComponent(0);
            selectionPicker.ShowSelectionIndicator = true;
            selectionPicker.Frame = new CGRect(0, 100, this.Frame.Width, this.Frame.Height / 3);
            picker.PickerChanged += (sender, e) =>
            {
                if (e.SelectedValue == "Single")
                {
                    treeView.SelectionMode = SelectionMode.Single;
                }
                else if (e.SelectedValue == "SingleDeselect")
                {
                    treeView.SelectionMode = SelectionMode.SingleDeselect;
                }
                else if (e.SelectedValue == "Multiple")
                {
                    treeView.SelectionMode = SelectionMode.Multiple;
                }
                else if (e.SelectedValue == "None")
                {
                    treeView.SelectionMode = SelectionMode.None;
                }
            };
            this.OptionView.AddSubview(selectionPicker);
        }
Пример #27
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var toolBar       = new UIToolbar(new CGRect(0, 0, 320, 44));
            var doneButton    = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            var flexibleSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            toolBar.SetItems(new UIBarButtonItem[] { flexibleSpace, doneButton }, true);

            var model  = new SelectionModePickerViewModel();
            var picker = new UIPickerView();

            picker.Model = model;
            picker.Select((nint)(int)Grid.SelectionMode, 0, true);
            SelectionModeField.InputView          = picker;
            SelectionModeField.InputAccessoryView = toolBar;
            SelectionModeField.Text = pickerOptionStrings[2];

            doneButton.Clicked += (s, e) =>
            {
                var selectedIndex = (int)picker.SelectedRowInComponent(0);
                var selectedMode  = (GridSelectionMode)selectedIndex;
                SelectionModeField.Text = pickerOptionStrings[selectedIndex];
                Grid.SelectionMode      = selectedMode;
                Grid.BecomeFirstResponder();
            };

            var data = Customer.GetCustomerList(100);

            Grid.ItemsSource       = data;
            Grid.AllowResizing     = GridAllowResizing.Both;
            Grid.SelectionChanged += OnSelectionChanged;
        }
        public override void Selected(UIPickerView picker, nint row, nint component)
        {
            Owner.SelectedLocation = Owner.FilteredLocationList[(int)picker.SelectedRowInComponent(0)];

            //Assign value to registration objec
            Settings.LocationPickerSelectedId = Owner.SelectedLocation.LocationId;
        }
        public string selectAddr(UIPickerView pickerView)
        {
            //這裡用foreach會掛掉
            //foreach (var doneRow in cancelSelectedRow)
            //{
            //	cancelSelectedRow[cancelSelectedRow.IndexOf(doneRow)] = pickerView.SelectedRowInComponent(cancelSelectedRow.IndexOf(doneRow));
            //}
            for (int i = 0; i < cancelSelectedRow.Count; i++)
            {
                cancelSelectedRow[i] = pickerView.SelectedRowInComponent(i);
            }

            return(cityList[(int)pickerView.SelectedRowInComponent(0)]
                   + " "
                   + areaList[(int)pickerView.SelectedRowInComponent(0)][(int)pickerView.SelectedRowInComponent(1)]);
        }
Пример #30
0
            public override void Selected(UIPickerView picker, nint row, nint component)
            {
                var selObjctes = new List <object>();

                var aMsg = String.Empty;

                foreach (var aId in mDataDict.Keys)
                {
                    var selIndex = picker.SelectedRowInComponent(aId);

                    var aList = mDataDict[aId];

                    var aRow = aList.Items[(int)selIndex];

                    selObjctes.Add(aRow.SelectedValue);

                    aMsg += aRow.DisplayValue + mTableViewCell.SeperatorCharacter;
                }

                if (aMsg.EndsWith(mTableViewCell.SeperatorCharacter))
                {
                    aMsg = aMsg.Substring(0, aMsg.LastIndexOf(mTableViewCell.SeperatorCharacter));
                }

                mTableViewCell.RightLabel.Text = aMsg;

                SelectedItems = selObjctes.ToArray();

                mTableViewCell.DidSelectItem(selObjctes.ToArray());
            }
Пример #31
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.


            #region ComboBox
            UIPickerView pickerView = new UIPickerView();

            pickerModel      = new PickerModel(lbldato, emocion);
            pickerView.Model = pickerModel;



            // Instanciar un toolbar
            UIToolbar toolbar = new UIToolbar();
            toolbar.BarStyle = UIBarStyle.Default;

            //Crear un label
            var labelTitulo = new UILabel(new CGRect(x: 0, y: 50, width: 150, height: 20))
            {
                BackgroundColor = UIColor.Clear,
                TextColor       = UIColor.Gray.ColorWithAlpha(0.5f),
                TextAlignment   = UITextAlignment.Left,
                Text            = txtDato.Placeholder
            };
            labelTitulo.SizeToFit();

            // Crear los UIBarButtonItem de nuestra toolbar
            var tituloCajaTexto   = new UIBarButtonItem(labelTitulo);
            var cancelarBoton     = new UIBarButtonItem("Cancelar", UIBarButtonItemStyle.Done, (s, e) => { this.txtDato.ResignFirstResponder(); });
            var espacioEntreBoton = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null, null);
            var listoButton       = new UIBarButtonItem("Listo", UIBarButtonItemStyle.Done,
                                                        (s, e) =>
            {
                this.txtDato.Text = emocion[pickerView.SelectedRowInComponent(0)];
                this.txtDato.ResignFirstResponder();
            });
            toolbar.SetItems(new UIBarButtonItem[] { cancelarBoton, espacioEntreBoton, tituloCajaTexto, espacioEntreBoton, listoButton }, true);

            toolbar.TranslatesAutoresizingMaskIntoConstraints    = false;
            pickerView.TranslatesAutoresizingMaskIntoConstraints = false;

            toolbar.SizeToFit();

            // Tell the textbox to use the picker for input
            this.txtDato.InputView = pickerView;

            // Display the toolbar over the pickers
            this.txtDato.InputAccessoryView = toolbar;
            #endregion


            rootNode = Database.DefaultInstance.GetRootReference();


            btnGuardarDia.TouchUpInside += BtnGuardarDia_TouchUpInside;
            btnImage.TouchUpInside      += BtnImage_TouchUpInside;
        }
Пример #32
0
        public PickerAlert(string[] values, int currentSelected, Action<int> selected)
            : base(new RectangleF(0, 0, 320f, 480f))
        {
            AutosizesSubviews = true;
            this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            _values = values;
            _currentSelected = currentSelected;
            _selected = selected;

            _pickerView = new UIPickerView();
            _pickerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            _pickerView.ShowSelectionIndicator = true;
            _pickerView.Model = new PickerModel(values);
            _pickerView.BackgroundColor = UIColor.FromRGB(244, 244, 244);
            _pickerView.Select(currentSelected, 0, false);

            _toolbar = new UIToolbar();
            _toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;

            _toolbar.Items = new UIBarButtonItem[]
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => {
                    _selected(_pickerView.SelectedRowInComponent(0));
                    Dismiss();
                })
            };

            _innerView = new UIView(new RectangleF(0, Frame.Height, Frame.Width, 44f + _pickerView.Frame.Height));
            _innerView.AutosizesSubviews = true;
            _innerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;

            _toolbar.Frame = new RectangleF(0, 0, Frame.Width, 44f);
            _innerView.Add(_toolbar);

            _pickerView.Frame = new RectangleF(0, 44f, Frame.Width, _pickerView.Frame.Height);
            _innerView.Add(_pickerView);

            Add(_innerView);
        }
Пример #33
0
        public void pickerViewModel(UITextField textFieldItem, List<string> segmentosStrings, UIButton button)
        {
            PickerModel picker_model_Segmentos = new PickerModel (segmentosStrings);
            UIPickerView picker_Segmentos = new UIPickerView ();
            picker_Segmentos.Model = picker_model_Segmentos;
            picker_Segmentos.ShowSelectionIndicator = true;

            UIToolbar toolbar = new UIToolbar ();
            toolbar.BarStyle = UIBarStyle.Black;
            toolbar.Translucent = true;
            toolbar.SizeToFit ();

            var tapRecognizer = new UITapGestureRecognizer ();

            tapRecognizer.AddTarget(() => {
                Console.WriteLine("CLICK");
            });

            tapRecognizer.NumberOfTapsRequired = 2;
            tapRecognizer.NumberOfTouchesRequired = 1;

            picker_Segmentos.AddGestureRecognizer(tapRecognizer);

            UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Bordered,(s, e) => {
                //				Console.WriteLine((int)picker_Segmentos.SelectedRowInComponent);
                Console.WriteLine(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ());
                textFieldItem.Text = picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ();
                if(button.Tag == 2 || button.Tag == 3){
                    Console.WriteLine("longCode ButtonClicked");
                }

                textFieldItem.ResignFirstResponder ();
            });

            UIBarButtonItem cancelButton = new UIBarButtonItem ("cancel", UIBarButtonItemStyle.Bordered, (s, e) => {
                textFieldItem.ResignFirstResponder ();
            });
            toolbar.SetItems (new UIBarButtonItem[]{ doneButton, cancelButton }, true);
            toolbar.TintColor = UIColor.White;
            textFieldItem.InputView = picker_Segmentos;
            this.View.BackgroundColor = UIColor.Clear;
            textFieldItem.InputAccessoryView = toolbar;
            textFieldItem.AddGestureRecognizer (tapRecognizer);
        }
Пример #34
0
 public string GetBoatId(UIPickerView picker)
 {
     return boatIds [picker.SelectedRowInComponent(0)];
 }
Пример #35
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            Console.WriteLine ("PBS VDL");
            this.NavigationController.NavigationBar.TintColor = UIColor.FromRGB (237, 152, 0);
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB (52, 19, 0);

            float sH = UIScreen.MainScreen.Bounds.Height;
            float sW = UIScreen.MainScreen.Bounds.Width;

            var volumeView = new MPVolumeView(new RectangleF(50,sH - 100,200,50));
            volumeView.ShowsVolumeSlider = true;
            volumeView.ShowsRouteButton = true;
            volumeView.TintColor = UIColor.FromRGB (237, 152, 0);
            View.AddSubview (volumeView);

            var volumeUpView = new UIImageView (new RectangleF (260, sH - 104, 26, 26));
            volumeUpView.Image = UIImage.FromFile("volume_up-26.png");
            View.AddSubview (volumeUpView);

            var volumeDownView = new UIImageView (new RectangleF (20, sH - 104, 26, 26));
            volumeDownView.Image = UIImage.FromFile ("volume_down-26.png");
            View.AddSubview (volumeDownView);

            var pickerView = new UIPickerView (new RectangleF (0, sH - 207, sW, 162)); // heigth must be 162, 180, 216
            pickerView.BackgroundColor = UIColor.FromRGB (52, 19, 0);
            pickerView.TintColor = UIColor.FromRGB (237, 152, 0);
            // not adding to the view yet because this is a multipurpose picker and the addition is done per the purpose with the btn delegate

            positionSld.SetThumbImage (UIImage.FromFile ("position.png"), UIControlState.Normal);
            positionSld.MinValue = 0f;

            // disable all the buttons I don't want enabled when not playing
            playPauseBtn.Enabled = false;
            positionSkipBtn.Enabled = false;
            stopBtn.Enabled = false;
            timerBtn.Enabled = false;
            pickerSetBtn.Hidden = true;
            pickerSetBtn.Enabled = false;
            pickerCnlBtn.Hidden = true;
            pickerCnlBtn.Enabled = false;
            pickerLbl.Hidden = true;

            if (resumeCheck == 1) {
                Console.WriteLine ("F: VDL RPA: " + resumePassAuthor);
                ResumeBook (resumePassTitle, resumePassAuthor);
            }

            _musicPlayer = new MPMusicPlayerController ();
            _mediaController = new MPMediaPickerController (MPMediaType.Music);
            _mediaController.AllowsPickingMultipleItems = false;
            _mpDelegate = new MediaPickerDelegate (this);
            _mediaController.Delegate = _mpDelegate;
            infoScreen = new InfoScreen ();

            addMusicBtn.TouchUpInside += delegate {
                this.PresentViewController(_mediaController, true, null);
            };

            infoBtn.TouchUpInside += delegate {
                this.PresentViewController(infoScreen, true, null);
            };

            positionSkipBtn.Clicked += delegate {
                pickerView.Model = new ThePickerViewModel(0);
                View.AddSubview(pickerView);
                pickerLbl.Text = "Skip To";
                pickerLbl.Hidden = false;
                pickerSetBtn.Enabled = true;
                pickerSetBtn.Hidden = false;
                pickerCnlBtn.Enabled = true;
                pickerCnlBtn.Hidden = false;
            };

            timerBtn.Clicked += (object sender, EventArgs e) => {
                pickerView.Model = new ThePickerViewModel(1);
                View.AddSubview(pickerView);
                pickerLbl.Text = "Sleep Timer";
                pickerLbl.Hidden = false;
                pickerSetBtn.Enabled = true;
                pickerSetBtn.Hidden = false;
                pickerCnlBtn.Enabled = true;
                pickerCnlBtn.Hidden = false;

            };
            pickerSetBtn.TouchUpInside += delegate {
                if (pickerLbl.Text == "Skip To"){
                    int hourValue = pickerView.SelectedRowInComponent(0);
                    int minValue = pickerView.SelectedRowInComponent(1);
                    int secValue = pickerView.SelectedRowInComponent(2);
                    double pickedTimeValue = ((hourValue * 3600) + (minValue * 60) + secValue);
                    int pickedTimeInt = Convert.ToInt32(pickedTimeValue);
                    _musicPlayer.CurrentPlaybackTime = pickedTimeValue;
                    string pickerTimeDisplay = string.Format("{0:#0}:{1:00}:{2:00}",pickedTimeInt/3600,(pickedTimeInt/60)%60,pickedTimeInt%60);
                    currentTimeLbl.Text = pickerTimeDisplay;
                    positionSld.SetValue( (float)(pickedTimeValue), true);

                    pickerView.RemoveFromSuperview();
                    pickerLbl.Hidden = true;
                    pickerSetBtn.Hidden = true;
                    pickerSetBtn.Enabled = false;
                    pickerCnlBtn.Hidden = true;
                    pickerCnlBtn.Enabled = false;
                }
                else if (pickerLbl.Text == "Sleep Timer"){
                    int hourValue = pickerView.SelectedRowInComponent(0);
                    int minValue = pickerView.SelectedRowInComponent(1);
                    double timeToSleep = ((hourValue * 3600) + (minValue * 60));
                    StartSleepTimer(timeToSleep);

                    pickerView.RemoveFromSuperview();
                    pickerLbl.Hidden = true;
                    pickerSetBtn.Hidden = true;
                    pickerSetBtn.Enabled = false;
                    pickerCnlBtn.Hidden = true;
                    pickerCnlBtn.Enabled = false;
                }
                else {
                    pickerView.RemoveFromSuperview();
                    pickerLbl.Hidden = true;
                    pickerSetBtn.Hidden = true;
                    pickerSetBtn.Enabled = false;
                    pickerCnlBtn.Hidden = true;
                    pickerCnlBtn.Enabled = false;
                }
            };

            pickerCnlBtn.TouchUpInside += delegate {
                pickerView.RemoveFromSuperview();
                pickerLbl.Hidden = true;
                pickerSetBtn.Hidden = true;
                pickerSetBtn.Enabled = false;
                pickerCnlBtn.Hidden = true;
                pickerCnlBtn.Enabled = false;
            };

            playPauseBtn.Clicked += (object sender, EventArgs e) => {
                // can I use the playback state for this if statement instead PlayPauseSwitch?
                if (PlayPauseSwitch == null || PlayPauseSwitch == "play"){
                    PlayPauseSwitch = "pause";
                    _musicPlayer.CurrentPlaybackTime = ResumePointVault;
                    Console.WriteLine("playcurrentspot: {0}", _musicPlayer.CurrentPlaybackTime);
                    _musicPlayer.Play();
                    stopBtn.Enabled = true;
                    timerBtn.Enabled = true;
                    double fileLengthRaw = _musicPlayer.NowPlayingItem.PlaybackDuration;
                    StartTimer();
                    _musicPlayer.BeginGeneratingPlaybackNotifications();
                    Console.WriteLine("enabled notifications"); // debugging

                }
                else{
                    PlayPauseSwitch = "play";
                    ResumePointVault = _musicPlayer.CurrentPlaybackTime;
                    _musicPlayer.Pause();
                    refreshTimer.Invalidate();
                }
            };

            positionSld.ValueChanged += delegate {
                _musicPlayer.CurrentPlaybackTime = positionSld.Value;
            };

            stopBtn.Clicked += (object sender, EventArgs e) => {
                Stopper();
            };

            //Lambda Style notfication substription
            notification = MPMusicPlayerController.Notifications.ObservePlaybackStateDidChange ((sender, args) => {
                string val = args.Notification.UserInfo ["MPMusicPlayerControllerPlaybackStateKey"].ToString ();
                Console.WriteLine ("Notification: {0}", args.Notification.UserInfo ["MPMusicPlayerControllerPlaybackStateKey"]);
                PlayPauseImage (val);
            });
        }
 private UIButton CreateSubmitButton(UIPickerView hoursField, UITextField commentField, UISwitch sickLeaveField)
 {
     var submitButton = new UIButton(UIButtonType.System)
     {
         Frame = new CGRect(20, 320, View.Bounds.Width - 40, 32),
     };
     submitButton.SetTitle("Submit", UIControlState.Normal);
     submitButton.TouchUpInside += async (sender, e) =>
     {
         var timesheetEntryHoursViewModel = (TimesheetEntryHoursViewModel)hoursField.Model;
         var selectedHours = timesheetEntryHoursViewModel.SelectedValue(hoursField, hoursField.SelectedRowInComponent(0), 0);
         TimesheetEntry.Hours = Convert.ToDecimal(selectedHours);
         TimesheetEntry.Comment = commentField.Text;
         TimesheetEntry.SickLeave = sickLeaveField.On;
         ShowLoadingOverlay();
         try
         {
             await TimesheetService.SubmitTimesheetEntry(TimesheetEntry);
             NavigationController.PopViewController(true);
         }
         catch (Exception ex)
         {
             var okAlertController = UIAlertController.Create("Error", ex.Message, UIAlertControllerStyle.Alert);
             okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
             PresentViewController(okAlertController, true, null);
         }
         LoadingOverlay.Hide();
     };
     return submitButton;
 }
Пример #37
0
// Use For Actionsheet picker view
		public void loadAffiliatePickerView ()
		{
			List<String> segmentosStrings = new List<String> ();

			if (Constant.affiliateResponse != null) {
				for (int i = 0; i < Constant.affiliateResponse.data.Count; i++) {
					segmentosStrings.Add (Constant.affiliateResponse.data [i].name.ToString());
				}
			}

			picker_model_Segmentos = new PickerModel (segmentosStrings);
			picker_Segmentos = new UIPickerView ();
			picker_Segmentos.Model = picker_model_Segmentos;
			picker_Segmentos.ShowSelectionIndicator = true;

			UIToolbar toolbar = new UIToolbar ();
			toolbar.BarStyle = UIBarStyle.Black;
			toolbar.Translucent = true;
			toolbar.SizeToFit ();

			var tapRecognizer = new UITapGestureRecognizer ();

			tapRecognizer.AddTarget(() => { 
				Console.WriteLine("CLICK");
			});

			tapRecognizer.NumberOfTapsRequired = 2;
			tapRecognizer.NumberOfTouchesRequired = 1;

			picker_Segmentos.AddGestureRecognizer(tapRecognizer);

			UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Bordered,(s, e) => {
				//				Console.WriteLine((int)picker_Segmentos.SelectedRowInComponent);
				Console.WriteLine(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ());
				affiliateName.SetTitle(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString (), UIControlState.Normal);
				affName.ResignFirstResponder ();

				for (int i = 0; i < Constant.affiliateResponse.data.Count; i++) {
					if(Constant.affiliateResponse.data [i].name.ToString() == picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ()){
						Constant.selectedAffialte.data = Constant.affiliateResponse.data[i];
					}
				}
			});

			UIBarButtonItem cancelButton = new UIBarButtonItem ("cancel", UIBarButtonItemStyle.Bordered, (s, e) => {
				affName.ResignFirstResponder ();
			});
			toolbar.SetItems (new UIBarButtonItem[]{ doneButton, cancelButton }, true);
			toolbar.TintColor = UIColor.White;
			affName.InputView = picker_Segmentos;
			this.View.BackgroundColor = UIColor.Black;
			affName.InputAccessoryView = toolbar;
			affName.AddGestureRecognizer (tapRecognizer);

		}
			public override void Selected (UIPickerView picker, int row, int component)
			{
				var qbv = (QuartzBlendingView) parent.quartzView;
				qbv.DestinationColor = Colors [picker.SelectedRowInComponent (0)];
				qbv.SourceColor = Colors [picker.SelectedRowInComponent (1)];
				qbv.BlendMode = (CGBlendMode) picker.SelectedRowInComponent (2);
				qbv.SetNeedsDisplay ();
			}
Пример #39
0
 public override void Selected(UIPickerView pickerView, nint row, nint component)
 {
     Quiz.SelectedAnswer = Convert.ToByte(pickerView.SelectedRowInComponent(0));
 }
			public override void Selected(UIPickerView picker, nint row, nint component)
			{
				nint selected = picker.SelectedRowInComponent(0);
				var chart = tk.chart;
				switch (selected)
				{
					case 0:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Standard;
						break;
					case 1:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Cocoa;
						break;
					case 2:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Coral;
						break;
					case 3:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Dark;
						break;
					case 4:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Highcontrast;
						break;
					case 5:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Light;
						break;
					case 6:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Midnight;
						break;
					case 7:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Minimal;
						break;
					case 8:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Modern;
						break;
					case 9:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Organic;
						break;
					case 10:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Slate;
						break;
					case 11:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Zen;
						break;
					case 12:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Cyborg;
						break;
					case 13:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Superhero;
						break;
					case 14:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Flatly;
						break;
					case 15:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Darkly;
						break;
					case 16:
						chart.Palette = Xuni.iOS.ChartCore.XuniPalettes.Cerulean;
						break;
					default:
						break;
				}

			}
 public override void Selected(UIPickerView picker, int row, int component)
 {
     pvc.label.Text = String.Format ("{0} - {1}",
                     names [picker.SelectedRowInComponent (0)],
                     picker.SelectedRowInComponent (1));
 }
Пример #42
0
            public override void Selected(UIPickerView picker, nint row, nint component)
            {
                var selObjctes = new List<object>();

                var aMsg = String.Empty;

                foreach(var aId in mDataDict.Keys)
                {
                    var selIndex = picker.SelectedRowInComponent(aId);

                    var aList = mDataDict[aId];

                    var aRow = aList.Items[(int)selIndex];

                    selObjctes.Add(aRow.SelectedValue);

                    aMsg += aRow.DisplayValue + mTableViewCell.SeperatorCharacter;

                }

                if (aMsg.EndsWith(mTableViewCell.SeperatorCharacter))
                    aMsg = aMsg.Substring(0,aMsg.LastIndexOf(mTableViewCell.SeperatorCharacter));

                mTableViewCell.RightLabel.Text = aMsg;

                SelectedItems = selObjctes.ToArray();

                mTableViewCell.DidSelectItem(selObjctes.ToArray());
            }
Пример #43
0
		public override void Selected (UIPickerView picker, int row, int component)
		{
			tvc.currentSystemItem = (UIBarButtonSystemItem) picker.SelectedRowInComponent (0);
			tvc.CreateToolbarItems ();
		}
Пример #44
0
 public string getRowerId(UIPickerView picker)
 {
     return rowerIds [picker.SelectedRowInComponent (0)];
 }
Пример #45
0
        partial void actionChangeKey(NSObject sender)
        {
            _actionSheet = new UIActionSheet("Title", null, string.Empty, string.Empty, null);

            var pickerView = new UIPickerView(new RectangleF(0, 44, 320, 300));
            pickerView.ShowSelectionIndicator = true;
            pickerView.WeakDelegate = this;

            var toolbar = new UIToolbar(new RectangleF(0, 0, 320, 44));
            toolbar.BarStyle = UIBarStyle.Black;

            UIBarButtonItem flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            var button = new UIButton(UIButtonType.Custom);
            button.SetTitle("Done", UIControlState.Normal);
            button.Layer.CornerRadius = 8;
            button.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor;
            button.Font = UIFont.FromName("HelveticaNeue-Bold", 12.0f);
            button.Frame = new RectangleF(0, 20, 60, 30);
            button.TouchUpInside += (sender2, e) => {
                int key = _keys[pickerView.SelectedRowInComponent(0)].Item1;
                OnChangeKey(key);
                _actionSheet.DismissWithClickedButtonIndex(0, true);
            };
            var btnDone = new UIBarButtonItem(button);
            toolbar.SetItems(new UIBarButtonItem[2] { flexSpace, btnDone }, true);

            _actionSheet.AddSubview(toolbar);
            _actionSheet.AddSubview(pickerView);
            _actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow);
            _actionSheet.Bounds = new RectangleF(0, 0, 320, 344);

            int index = _keys.IndexOf(_currentKey);
            pickerView.Select(index, 0, false);
        }