Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            tableView.WeakDataSource = this;
            tableView.WeakDelegate = this;

            var btnDone = new SessionsFlatButton();
            btnDone.Label.Text = "Done";
            btnDone.Frame = new RectangleF(0, 0, 70, 44);
            btnDone.OnButtonClick += () => {
                NavigationController.DismissViewController(true, null);
            };
            var btnDoneView = new UIView(new RectangleF(0, 0, 70, 44));
            var rect = new RectangleF(btnDoneView.Bounds.X + 16, btnDoneView.Bounds.Y, btnDoneView.Bounds.Width, btnDoneView.Bounds.Height);
            btnDoneView.Bounds = rect;
            btnDoneView.AddSubview(btnDone);
            _btnDone = new UIBarButtonItem(btnDoneView);

            _btnFlatEdit = new SessionsFlatButton();
            _btnFlatEdit.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            _btnFlatEdit.Label.Text = "Edit";
            _btnFlatEdit.Label.TextAlignment = UITextAlignment.Right;
            _btnFlatEdit.Label.Frame = new RectangleF(0, 0, 44, 44);
            _btnFlatEdit.ImageChevron.Hidden = true;
            _btnFlatEdit.Frame = new RectangleF(0, 0, 60, 44);
            _btnFlatEdit.OnButtonClick += HandleEditTouchUpInside;
            var btnEditView = new UIView(new RectangleF(UIScreen.MainScreen.Bounds.Width - 60, 0, 60, 44));
            var rect2 = new RectangleF(btnEditView.Bounds.X - 16, btnEditView.Bounds.Y, btnEditView.Bounds.Width, btnEditView.Bounds.Height);
            btnEditView.Bounds = rect2;
            btnEditView.AddSubview(_btnFlatEdit);
            _btnEdit = new UIBarButtonItem(btnEditView);           

            NavigationItem.SetLeftBarButtonItem(_btnDone, true);
            NavigationItem.SetRightBarButtonItem(_btnEdit, true);

            var btnNew = new SessionsButton();
            btnNew.SetTitle("New", UIControlState.Normal);
            btnNew.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnNew.Frame = new RectangleF(0, 12, 50, 30);
            btnNew.TouchUpInside += HandleNewTouchUpInside;
            _btnNew = new UIBarButtonItem(btnNew);

            var btnShuffle = new SessionsButton();
            btnShuffle.SetTitle("Shuffle", UIControlState.Normal);
            btnShuffle.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnShuffle.Frame = new RectangleF(0, 12, 70, 30);
            btnShuffle.TouchUpInside += HandleShuffleTouchUpInside;
            _btnShuffle = new UIBarButtonItem(btnShuffle);

            toolbar.Items = new UIBarButtonItem[2]{ _btnNew, _btnShuffle };

            base.ViewDidLoad();

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindPlaylistView(null, this);
        }
        public override void ViewDidLoad()
        {
			scrollView.BackgroundColor = GlobalTheme.BackgroundColor;
            toolbar.BackgroundColor = GlobalTheme.MainColor;
            viewOptions.BackgroundColor = GlobalTheme.BackgroundColor;
            lblPresetName.TextColor = UIColor.White;
            
            // Add padding to text field (http://stackoverflow.com/questions/3727068/set-padding-for-uitextfield-with-uitextborderstylenone)
            UIView paddingView = new UIView(new RectangleF(0, 0, 5, 20));
            txtPresetName.LeftView = paddingView;
            txtPresetName.LeftViewMode = UITextFieldViewMode.Always;

            // Make sure the Done key closes the keyboard
            txtPresetName.ShouldReturn = (a) => {
                txtPresetName.ResignFirstResponder();
                return true;
            };

            var btnBack = new SessionsFlatButton();
            btnBack.Label.Text = "Back";
            btnBack.Frame = new RectangleF(0, 0, 70, 44);
            btnBack.OnButtonClick += HandleButtonBackClick;
            var btnBackView = new UIView(new RectangleF(0, 0, 70, 44));
            var rect = new RectangleF(btnBackView.Bounds.X + 16, btnBackView.Bounds.Y, btnBackView.Bounds.Width, btnBackView.Bounds.Height);
            btnBackView.Bounds = rect;
            btnBackView.AddSubview(btnBack);
            _btnBack = new UIBarButtonItem(btnBackView);

            var btnSave = new SessionsFlatButton();
            btnSave.LabelAlignment = UIControlContentHorizontalAlignment.Right;
            btnSave.Label.Text = "Save";
            btnSave.Label.TextAlignment = UITextAlignment.Right;
            btnSave.Label.Frame = new RectangleF(0, 0, 44, 44);
            btnSave.ImageChevron.Hidden = true;
            btnSave.Frame = new RectangleF(0, 0, 60, 44);
            btnSave.OnButtonClick += HandleButtonSaveTouchUpInside;
            var btnSaveView = new UIView(new RectangleF(UIScreen.MainScreen.Bounds.Width - 60, 0, 60, 44));
            var rect2 = new RectangleF(btnSaveView.Bounds.X - 16, btnSaveView.Bounds.Y, btnSaveView.Bounds.Width, btnSaveView.Bounds.Height);
            btnSaveView.Bounds = rect2;
            btnSaveView.AddSubview(btnSave);
            _btnSave = new UIBarButtonItem(btnSaveView);

            var btnReset = new SessionsButton();
            btnReset.SetTitle("Reset", UIControlState.Normal);
            btnReset.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnReset.Frame = new RectangleF(0, 12, 60, 40);
            btnReset.TouchUpInside += HandleButtonResetTouchUpInside;
            _btnReset = new UIBarButtonItem(btnReset);

            var btnNormalize = new SessionsButton();
            btnNormalize.SetTitle("Normalize", UIControlState.Normal);
            btnNormalize.Font = UIFont.FromName("HelveticaNeue", 12.0f);
            btnNormalize.Frame = new RectangleF(0, 12, 80, 40);
            btnNormalize.TouchUpInside += HandleButtonNormalizeTouchUpInside;
            _btnNormalize = new UIBarButtonItem(btnNormalize);

            NavigationItem.SetLeftBarButtonItem(_btnBack, true);
            NavigationItem.SetRightBarButtonItem(_btnSave, true);
            toolbar.Items = new UIBarButtonItem[2]{ _btnNormalize, _btnReset };
            
            var navCtrl = (SessionsNavigationController)NavigationController;
            navCtrl.SetBackButtonVisible(false);
            navCtrl.SetTitle("Equalizer Preset");

            for(int a = 0; a < 18; a++)
                AddFaderToScrollView(a.ToString() + ".0 kHz");

            if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
            {
                NavigationController.InteractivePopGestureRecognizer.WeakDelegate = this;
                NavigationController.InteractivePopGestureRecognizer.Enabled = true;
            }

            base.ViewDidLoad();

            var navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindEqualizerPresetDetailsView(null, this, _presetId);
        }