public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            //dismiss the keyboard on background touch
            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                FahrenheitField.ResignFirstResponder();
                HumidityField.ResignFirstResponder();
            }));

            //after editing, compute
            HumidityField.EditingDidEnd   += compute;
            FahrenheitField.EditingDidEnd += compute;
            HumiditySwitch.ValueChanged   += compute;

            //when slider value is changed, update UI
            WindSlider.ValueChanged += (sender, e) =>
            {
                WindSpeedLabel.Text = String.Format("Wind Speed (0-100 mph): {0}",
                                                    (int)WindSlider.Value);

                compute(sender, e);
            };
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            //Check settings
            RefreshFields();
            //dismiss the keyboard on background touch
            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                FahrenheitField.ResignFirstResponder();
                HumidityField.ResignFirstResponder();
                compute(null, null);
            }));

            //after editing, compute
            HumidityField.EditingDidEnd   += compute;
            FahrenheitField.EditingDidEnd += compute;
            HumiditySwitch.ValueChanged   += compute;

            //when slider value is changed, update UI
            WindSlider.ValueChanged += (sender, e) =>
            {
                //lazy, clean up kmph/mph
                WindSpeedLabel.Text = Metric ? $"Wind Speed (0-100 kph) {WindSlider.Value}" :
                                      $"Wind Speed (0-100 mph) {WindSlider.Value}";

                compute(sender, e);
            };
        }
        void ReleaseDesignerOutlets()
        {
            if (AboutButton != null)
            {
                AboutButton.Dispose();
                AboutButton = null;
            }

            if (FahrenheitField != null)
            {
                FahrenheitField.Dispose();
                FahrenheitField = null;
            }

            if (HistoryButton != null)
            {
                HistoryButton.Dispose();
                HistoryButton = null;
            }

            if (HumidityField != null)
            {
                HumidityField.Dispose();
                HumidityField = null;
            }

            if (HumiditySwitch != null)
            {
                HumiditySwitch.Dispose();
                HumiditySwitch = null;
            }

            if (ImageView1 != null)
            {
                ImageView1.Dispose();
                ImageView1 = null;
            }

            if (ResultLabel != null)
            {
                ResultLabel.Dispose();
                ResultLabel = null;
            }

            if (WindSlider != null)
            {
                WindSlider.Dispose();
                WindSlider = null;
            }

            if (WindSpeedLabel != null)
            {
                WindSpeedLabel.Dispose();
                WindSpeedLabel = null;
            }
        }