Exemplo n.º 1
0
 public void removeAll(UIPickerView picker)
 {
     toolbar.SetItems(new UIBarButtonItem[0], false);
     this.toolbar.RemoveFromSuperview();
     picker.Layer.Opacity = 0f;
     picker.Layer.Bounds  = new RectangleF(0, 0, 0, 0);
     picker.RemoveFromSuperview();
     txtZip.InputView = null;
     txtZip.ReloadInputViews();
     storeNamesID.Clear();
     storeLocatorModel.Items.Clear();
 }
Exemplo n.º 2
0
 void HidePickerView()
 {
     if (_picker != null)
     {
         Log("Picker selected: ");
         for (var i = 0; i < _picker.numberOfComponents; i++)
         {
             var selectedRow = _picker.SelectedRowInComponent(i);
             Log("component " + i + ": " + _picker.titleForRowHandler(_picker, selectedRow, i));
         }
         _picker.RemoveFromSuperview();
     }
 }
Exemplo n.º 3
0
        private void hidecomboShare()
        {
            pkrShare.RemoveFromSuperview();
            pkrShare = null;
            BarraShare.RemoveFromSuperview();
            BarraShare = null;
            GC.Collect();

            showComboTaks = false;

            if (!UserInterfaceIdiomIsPhone)
            {
                detailparameters.Dismiss(true);
            }
        }
Exemplo n.º 4
0
 public void UpdateDatas(bool show)
 {
     txtZip.Text        = "";
     txtZip.Placeholder = "ZIP/DEALER CODE";
     txtZip.EndEditing(true);
     this.View.EndEditing(true);
     GetStartBtn.SetTitle("Get Started", UIControlState.Normal);
     AppDelegate.appDelegate.IsZipCodeValid = false;
     if (null != toolbar)
     {
         toolbar.RemoveFromSuperview();
     }
     if (null != pickerView)
     {
         pickerView.RemoveFromSuperview();
     }
 }
Exemplo n.º 5
0
 protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         SelectedValue = Element.Items[0];
         UIPickerView pickerView = (UIPickerView)Control.InputView;
         pickerView.WeakDelegate = this;
         pickerView.DataSource   = this;
         // get the button Done and rewrite the event
         UIToolbar       toolbar = (UIToolbar)Control.InputAccessoryView;
         UIBarButtonItem done    = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (object sender, EventArgs click) =>
         {
             Control.Text = SelectedValue;
             toolbar.RemoveFromSuperview();
             pickerView.RemoveFromSuperview();
             Control.ResignFirstResponder();
         });
         UIBarButtonItem empty = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null);
         toolbar.Items = new UIBarButtonItem[] { empty, done };
     }
 }
Exemplo n.º 6
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);
            });
        }
Exemplo n.º 7
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// Perform any additional setup after loading the view, typically from a nib.
			this.NavigationController.NavigationBarHidden = true;

			//UIPickerView--------------------------------------------------------------

			//model for data loading
			PickerModel model = new PickerModel(this.View);

			//picker
			UIPickerView picker = new UIPickerView();
			picker.Frame = new RectangleF(0,164,768,216);

			picker.ShowSelectionIndicator = true;
			picker.Model = model;

			//--------------------------------------------------------------------------

			//Setup the toolbar
			UIToolbar toolbar = new UIToolbar();
			toolbar.Frame = new RectangleF(0,380,768,44);
			toolbar.BarStyle = UIBarStyle.Black;
			toolbar.Translucent = true;
			toolbar.SizeToFit();

			
			//Create a 'done' button for the toolbar and add it to the toolbar
			UIBarButtonItem doneButton = 
				new UIBarButtonItem
					("Done",UIBarButtonItemStyle.Done,
					 (s,e) => 
					 {
						//do something after the values is selected
//						this.txtCurrentAltitude.ResignFirstResponder();
						picker.RemoveFromSuperview();
						toolbar.RemoveFromSuperview();
					}
					);

			UIBarButtonItem loadButton = 
				new UIBarButtonItem
					("Load",UIBarButtonItemStyle.Bordered,
					 (s,e) => 
					 {
						//do something after the values is selected
					}
					);

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

	

			btnLoadPicker.TouchUpInside += (object sender, EventArgs e) => 
			{
				this.View.AddSubview(picker);
				this.View.AddSubview(toolbar);
			};
			//UIPickerView--------------------------------------------------------------

			//DialogView----------------------------------------------------------------
			FPLView.BackgroundColor = new UIColor(0.89f,0.78f,0.56f,1.00f);
			ListBoxDialog lbd = new ListBoxDialog();
			MTDView.AddSubview(lbd.View);

			btnFPLLoad.BackgroundColor = new UIColor(0.78f,0.65f,0.39f,1.00f);
			//COLOR ON PRESS
//			btnFPLLoad.TintColor = new UIColor(0.78f,0.65f,0.39f,1.00f);


			btnFPLCancel.BackgroundColor = new UIColor(0.78f,0.65f,0.39f,1.00f);

			btnFPLCancel.TouchUpInside += (object sender, EventArgs e) => 
			{
				FPLView.RemoveFromSuperview();
			};
			btnDialog.TouchUpInside += (object sender, EventArgs e) => 
			{
				this.View.AddSubview(FPLView);
			};

		}