Пример #1
0
        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            //don't clean up objects, if we want the controller to be kept alive
            if (keepScanViewControllerAlive)
            {
                return;
            }

            //we have to un-register the event handlers because else the whole viewcontroller will be kept in the garbage collector.
            if (meterTypeSegment != null)
            {
                meterTypeSegment.ValueChanged -= HandleSegmentChange;
            }

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

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

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

            segmentItems = null;

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

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

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            anylineEnergyView.RemoveFromSuperview();
            anylineEnergyView.Dispose();
            anylineEnergyView = null;

            base.Dispose();
        }
Пример #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (textbutton != null)
                {
                    textbutton.TouchUpInside -= ShowPicker;
                    textbutton.Dispose();
                    textbutton = null;
                }

                if (button != null)
                {
                    button.TouchUpInside -= HidePicker;
                    button.Dispose();
                    button = null;
                }

                if (schedule != null)
                {
                    schedule.MonthCellLoaded   -= Schedule_MonthCellLoaded;
                    schedule.AppointmentLoaded -= Schedule_AppointmentLoaded;
                    this.schedule.Dispose();
                    this.schedule = null;
                }

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

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

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

            base.Dispose(disposing);
        }
        new void Dispose()
        {
            //we have to un-register the event handlers because else the whole viewcontroller will be kept in the garbage collector.
            if (_meterTypeSegment != null)
            {
                _meterTypeSegment.ValueChanged -= HandleSegmentChange;
            }

            _meterTypeSegment?.Dispose();

            _selectionLabel?.Dispose();

            _toggleBarcodeLabel.RemoveFromSuperview();
            _toggleBarcodeLabel?.Dispose();

            _toggleBarcodeSwitch.ValueChanged -= OnValueChanged;
            _toggleBarcodeSwitch.RemoveFromSuperview();
            _toggleBarcodeSwitch?.Dispose();

            _toggleBarcodeView.RemoveFromSuperview();
            _toggleBarcodeView?.Dispose();

            _segmentItems = null;

            _alert?.Dispose();
            _error?.Dispose();

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            _anylineEnergyView?.RemoveFromSuperview();
            _anylineEnergyView?.Dispose();
            _anylineEnergyView = null;

            GC.Collect(GC.MaxGeneration);

            base.Dispose();
        }