public TankMinderManager(TankMinderSettings tankSettings)
     : base()
 {
     this.tankSettings = tankSettings;
     tankMinderReader  = new TankMinderReader(tankSettings.fileName);
     startFuel         = (!tankSettings.showInMetric) ? tankMinderReader.Contents.StartGallons : tankMinderReader.Contents.StartLiters;
     startDistance     = (!tankSettings.showInMetric) ? tankMinderReader.Contents.StartMiles : tankMinderReader.Contents.StartKilometers;
     currentFuelmeter  = startFuel;
     currentOdometer   = startDistance;
     UpdateValues();
 }
 protected override void ApplyDefaults()
 {
     base.ApplyDefaults();
     panelSettings.tankSize         = 75;
     panelSettings.panelId          = Enums.UI.PanelType.TANK_MINDER;
     panelSettings.showInMetric     = false;
     panelSettings.showFuel         = true;
     panelSettings.showCaptions     = true;
     panelSettings.showMilesToEmpty = true;
     panelSettings.showMPG          = true;
     panelSettings.showUnits        = true;
     panelSettings.useRollingMPG    = true;
     panelSettings.orientation      = Orientation.Vertical;
     panelSettings.alignment        = HorizontalAlignment.Center;
     panelSettings.fileName         = TankMinderReader.GetNewFilePath() + ".json";
 }
        protected override void ApplyBindings()
        {
            TankMinder = new TankMinderReader(panelSettings.fileName);
            ShowCaptionsCheckbox.IsChecked = panelSettings.showCaptions;
            ShowUnitsCheckbox.IsChecked    = panelSettings.showUnits;
            ShowInMetricCheckbox.IsChecked = panelSettings.showInMetric;
            UseRecentDistance.IsChecked    = panelSettings.useRollingMPG;
            showInMetric = panelSettings.showInMetric;
            if (panelSettings.orientation == Orientation.Horizontal)
            {
                HorizontalLayoutRadio.IsChecked = true;
            }
            else
            {
                VerticalLayoutRadio.IsChecked = true;
            }
            switch (panelSettings.alignment)
            {
            case HorizontalAlignment.Left:
                LeftAlignmentRadio.IsChecked = true;
                break;

            case HorizontalAlignment.Center:
                CenterAlignmentRadio.IsChecked = true;
                break;

            case HorizontalAlignment.Right:
                RightAlignmentRadio.IsChecked = true;
                break;

            default:
                CenterAlignmentRadio.IsChecked = true;
                break;
            }
            ShowDistanceCheckbox.IsChecked      = panelSettings.showMilesToEmpty;
            ShowFuelRemainingCheckbox.IsChecked = panelSettings.showFuel;
            ShowMPGCheckbox.IsChecked           = panelSettings.showMPG;
            TankSizeBox.Value                   = panelSettings.tankSize;
            CurrentLevelBox.Value               = (int)((panelSettings.showInMetric) ? FuelLevelGallons : FuelLevelLiters);
            TankMinder.Contents.StartMiles      = ChassisParameters.Instance.CurrentMiles;
            TankMinder.Contents.StartKilometers = ChassisParameters.Instance.CurrentKilometers;
        }