コード例 #1
0
        public void Dispose() // IDisposable
        {
            imgButtonBack.GestureRecognizers.RemoveAt(0);
            tgrButtonBack.Tapped -= OnButtonBackTapped;
            tgrButtonBack         = null;

            imgButtonHelp.GestureRecognizers.RemoveAt(0);
            tgrButtonHelp.Tapped -= OnButtonHelpTapped;
            tgrButtonHelp         = null;

            ListViewVehicles.ItemSelected -= OnItemSelected;

            btnProfileEdit.Clicked -= OnButtonEdit;
            btnProfileEdit.Image    = null;

            btnProfileCreate.Clicked -= OnButtonCreate;
            btnProfileCreate.Image    = null;

            vehicles.Clear();
            vehicles = null;

            database = null;
            accelerometerProvider = null;
            soundProvider         = null;
        }
コード例 #2
0
        public RunModeZeroToZero(IDeviceAcceleromter accelProvider, IDeviceSound sndProvider)
        {
            var speedoFilter = Settings.GetValueOrDefault(Settings.SpeedoFilter, 1);
            var filterSize   = speedoFilter * 10;

            accelerationProvider = accelProvider;
            soundProvider        = sndProvider;
            stopWatch            = new Stopwatch();
            accelerationFilter   = new MovingAverage(filterSize);
            Reset();
        }
コード例 #3
0
        public PageMain()
        {
            InitializeComponent();
            Debug.LogToFileMethod();

            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetHasNavigationBar(this, false);

            // DependencyService decides if to use iOS or Android
            gpsProvider           = DependencyService.Get <IDeviceGps>();
            accelerometerProvider = DependencyService.Get <IDeviceAcceleromter>();
            soundProvider         = DependencyService.Get <IDeviceSound>();

            runModeProvider       = new RunModeAcceleration(accelerometerProvider, soundProvider);
            accelerometerRecorder = new AccelerometerRecorder(true); // true: use queue mode to limit recording size

            // on first start -> use device language -> update our settings
            // on next starts -> use our updated settings
            LocaleId deviceLanguage = DependencyService.Get <IDeviceLocale>().GetLocale();

            // set language, use system language as default
            Localization.isEnglish = Settings.GetValueOrDefault(Settings.Language, deviceLanguage == LocaleId.English);
            Settings.AddOrUpdateValue(Settings.Language, Localization.isEnglish);

            InitLayout();
            InitLocalisation();
            InitHelp();

            bool showDisclaimer = Settings.GetValueOrDefault(Settings.Disclaimer, true);
            bool showTipOfDay   = Settings.GetValueOrDefault(Settings.TipOfDay, true);

            if (showDisclaimer || showTipOfDay)
            {
                Device.StartTimer(TimeSpan.FromMilliseconds(50), () =>
                {
                    if (isStartUpNoteShown == false) // only show once
                    {
                        isStartUpNoteShown = true;

                        if (showDisclaimer)
                        {
                            Navigation.PushAsync(new PageText(PageText.ContentType.Disclaimer));
                        }
                        else
                        {
                            Navigation.PushAsync(new PageText(PageText.ContentType.TipOfDay));
                        }
                    }

                    return(false); // stop timer
                });
            }
        }
コード例 #4
0
        public void Dispose() // IDisposable
        {
            imgButtonBack.GestureRecognizers.RemoveAt(0);
            imgButtonBack.Source  = null;
            imgButtonBack         = null;
            tgrButtonBack.Tapped -= OnButtonBackTapped;
            tgrButtonBack         = null;

            lblCaption = null;

            imgButtonHelp.GestureRecognizers.RemoveAt(0);
            imgButtonHelp.Source  = null;
            imgButtonHelp         = null;
            tgrButtonHelp.Tapped -= OnButtonHelpTapped;
            tgrButtonHelp         = null;

            btnCalibration.Clicked -= OnButtonCalibration;
            btnCalibration.Image    = null;
            btnCalibration          = null;

            btnVehicle.Clicked -= OnButtonVehicle;
            btnVehicle.Image    = null;
            btnVehicle          = null;

            entryVehicle.Completed -= OnEntryVehicleComplete;
            entryVehicle.Unfocused -= OnEntryVehicleComplete;
            entryVehicle            = null;

            btnColor.Image = null;
            btnColor       = null;

            if (btnDelete != null)
            {
                btnDelete.Clicked -= OnButtonDelete;
                btnDelete.Image    = null;
                btnDelete          = null;
            }

            for (int i = 0; i < colorButtons.Length; i++)
            {
                colorButtons[i].SizeChanged -= OnColorButtonSizeChanged;
                colorButtons[i].Clicked     -= OnColorButtonClicked;
                colorButtons[i]              = null;
            }

            storage               = null;
            item                  = null;
            itemCalibration       = null;
            accelerometerProvider = null;
            soundProvider         = null;
        }
コード例 #5
0
        public void Dispose() // IDisposable
        {
            imgButtonBack.Source = null;
            imgButtonBack.GestureRecognizers.RemoveAt(0);
            imgButtonBack         = null;
            tgrButtonBack.Tapped -= OnButtonBackTapped;
            tgrButtonBack         = null;

            lblCaption = null;

            imgButtonHelp.Source = null;
            imgButtonHelp.GestureRecognizers.RemoveAt(0);
            imgButtonHelp         = null;
            tgrButtonHelp.Tapped -= OnButtonHelpTapped;
            tgrButtonHelp         = null;

            lblHelp = null;

            imgCalibAnim1.Source       = null;
            imgCalibAnim1.SizeChanged -= OnLayoutSizeChanged;
            imgCalibAnim1              = null;

            imgCalibAnim2.Source = null;
            imgCalibAnim2        = null;

            imgCalibAnim3.Source = null;
            imgCalibAnim3        = null;

            imgCalibAnim4.Source = null;
            imgCalibAnim4        = null;

            lblText.SizeChanged -= OnLayoutSizeChanged;
            lblText              = null;

            btnOk.Image    = null;
            btnOk.Clicked -= OnButtonOkClicked;
            btnOk          = null;

            vehicle = null;
            accelerometerProvider = null;
            accelerometerRecorder = null;
            soundProvider         = null;
            calibrationFilter     = null;
            pageNavigation        = null;
        }
コード例 #6
0
        public PageProfile(IDeviceAcceleromter accelerometer, IDeviceSound sound)
        {
            InitializeComponent();
            Debug.LogToFileMethod();

            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetHasNavigationBar(this, false);

            accelerometerProvider = accelerometer;
            soundProvider         = sound;

            InitLayout();

            database = Database.GetInstance();
            vehicles = new ObservableCollection <DataItemVehicle>(database.GetVehicles());

            SetSelectedItem(SearchVehicle(database.GetActiveProfile()));
            ListViewVehicles.ItemSelected += OnItemSelected;
        }
コード例 #7
0
        public PageCalibration(DataItemVehicle item, IDeviceAcceleromter accelerometer, IDeviceSound sound, PageMain parentPage)
        {
            InitializeComponent();
            Debug.LogToFileMethod();

            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetHasNavigationBar(this, false);

            vehicle = item;
            accelerometerProvider = accelerometer;
            soundProvider         = sound;
            state                 = CalibrationState.Init;
            timeMilliSeconds      = 0;
            calibrationFilter     = new MovingAverage(SAMPLE_DURATION_MS / SAMPLE_INTERVAL_MS);
            calibration           = 0;
            pageNavigation        = parentPage;
            accelerometerRecorder = new AccelerometerRecorder(false); // false: do not use queue mode

            InitLayout();
        }
コード例 #8
0
        public PageProfileEdit(PageProfile page, DataItemVehicle vehicle, bool showDeleteButton, IDeviceAcceleromter accelerometer, IDeviceSound sound)
        {
            InitializeComponent();
            Debug.LogToFileMethod();

            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetHasNavigationBar(this, false);

            storage = page;
            item    = vehicle;
            accelerometerProvider = accelerometer;
            soundProvider         = sound;
            isDirty = false;

            InitLayout(showDeleteButton, (item == null)); // if item is null -> create profile mode, not edit mode

            // init with default color
            color = colorButtons[0].color;

            if (item != null)
            {
                calibration       = item.Calibration;
                entryVehicle.Text = item.Model;

                if (item.Color != null)
                {
                    // overwite with given color
                    color = item.Color;
                }
            }
            else
            {
                calibration       = 0;
                entryVehicle.Text = Localization.pageProfileEditDefault;
            }
        }
コード例 #9
0
        public void Dispose() // IDisposable
        {
            imgBackground.Source = null;
            imgBackground        = null;

            imgGpsStateOk.Source = null;
            imgGpsStateOk        = null;

            imgGpsStateNotOk.Source = null;
            imgGpsStateNotOk        = null;

            imgMountStateOk.Source = null;
            imgMountStateOk        = null;

            imgMountStateNotOk.Source = null;
            imgMountStateNotOk        = null;

            imgVelocityStateOk.Source = null;
            imgVelocityStateOk        = null;

            imgVelocityStateNotOk.Source = null;
            imgVelocityStateNotOk        = null;

            if (Config.Debug.PageRunAdjustEnabled)
            {
                imgDebugRunAdjust.Source  = null;
                imgDebugRunAdjust         = null;
                tgrDebugRunAdjust.Tapped -= OnImageDebugRunAdjust;
                tgrDebugRunAdjust         = null;
            }

            lblGpsState.SizeChanged      -= OnLayoutSizeChanged;
            lblMountState.SizeChanged    -= OnLayoutSizeChanged;
            lblVelocityState.SizeChanged -= OnLayoutSizeChanged;

            lblGpsState      = null;
            lblMountState    = null;
            lblVelocityState = null;

            lytHorizontalTab = null;

            btnTabAcceleration.Image    = null;
            btnTabAcceleration.Clicked -= OnButtonTabAcceleration;
            btnTabAcceleration          = null;

            btnTabBrake.Image    = null;
            btnTabBrake.Clicked -= OnButtonTabBrake;
            btnTabBrake          = null;

            btnTabZeroToZero.Image    = null;
            btnTabZeroToZero.Clicked -= OnButtonTabZeroToZero;
            btnTabZeroToZero          = null;

            btnTabResults.Image    = null;
            btnTabResults.Clicked -= OnButtonTabResults;
            btnTabResults          = null;

            btnHelp.Image    = null;
            btnHelp.Clicked -= OnButtonHelp;
            btnHelp          = null;

            if (Config.Debug.PagePurchaseEnabled)
            {
                btnDebugPurchase.Image    = null;
                btnDebugPurchase.Clicked -= OnButtonDebugPurchase;
                btnDebugPurchase          = null;
            }

            btnConfig          = null;
            btnConfig.Image    = null;
            btnConfig.Clicked -= OnButtonConfig;

            btnSetup.Image    = null;
            btnSetup.Clicked -= OnButtonSetup;
            btnSetup          = null;

            btnRun.Image    = null;
            btnRun.Clicked -= OnButtonRun;
            btnRun          = null;

            btnProfile.Image    = null;
            btnProfile.Clicked -= OnButtonProfile;
            btnProfile          = null;

            gpsProvider           = null;
            accelerometerProvider = null;
            runModeProvider       = null;
            soundProvider         = null;
            accelerometerRecorder = null;
            pageRun            = null;
            pageConfig         = null;
            pageProfile        = null;
            pageResults        = null;
            pageHelp           = null;
            pageDebugRunAdjust = null;
            pageDebugPurchase  = null;
            pageSetup          = null;
        }