-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
507 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using AcManager.Tools.Data; | ||
using AcTools; | ||
using AcTools.Utils; | ||
|
||
namespace AcManager.Controls.Services { | ||
public static class TimeSliderService { | ||
public static bool GetIsTimeSlider(DependencyObject obj) { | ||
return (bool)obj.GetValue(IsTimeSliderProperty); | ||
} | ||
|
||
public static void SetIsTimeSlider(DependencyObject obj, bool value) { | ||
obj.SetValue(IsTimeSliderProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty IsTimeSliderProperty = DependencyProperty.RegisterAttached("IsTimeSlider", typeof(bool), | ||
typeof(TimeSliderService), new UIPropertyMetadata(OnIsTimeSliderChanged)); | ||
|
||
private static void OnIsTimeSliderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { | ||
var element = d as Slider; | ||
if (element == null || !(e.NewValue is bool)) return; | ||
|
||
var newValue = (bool)e.NewValue; | ||
if (!newValue) return; | ||
|
||
if (PatchHelper.IsFeatureSupported(PatchHelper.FeatureFullDay)) { | ||
element.Minimum = 0; | ||
element.Maximum = CommonAcConsts.TimeAbsoluteMaximum; | ||
} else { | ||
element.Minimum = CommonAcConsts.TimeMinimum; | ||
element.Maximum = CommonAcConsts.TimeMaximum; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
namespace AcManager.Tools.Helpers.AcSettings { | ||
public class PitMenuSettings : IniSettings { | ||
internal PitMenuSettings() : base("pitstop", systemConfig: true) { } | ||
|
||
private bool _useMousePitstop; | ||
|
||
public bool UseMousePitstop { | ||
get => _useMousePitstop; | ||
set => Apply(value, ref _useMousePitstop); | ||
} | ||
|
||
private bool _stayInCar; | ||
|
||
public bool StayInCar { | ||
get => _stayInCar; | ||
set => Apply(value, ref _stayInCar); | ||
} | ||
|
||
private bool _autoAppOnPitlane; | ||
|
||
public bool AutoAppOnPitlane { | ||
get => _autoAppOnPitlane; | ||
set => Apply(value, ref _autoAppOnPitlane); | ||
} | ||
|
||
private int _visibilityMaxTime; | ||
|
||
public int VisibilityMaxTime { | ||
get => _visibilityMaxTime; | ||
set => Apply(value, ref _visibilityMaxTime); | ||
} | ||
|
||
private int _presetsCount; | ||
|
||
public int PresetsCount { | ||
get => _presetsCount; | ||
set => Apply(value, ref _presetsCount); | ||
} | ||
|
||
protected override void LoadFromIni() { | ||
UseMousePitstop = Ini["SETTINGS"].GetBool("USE_MOUSE_PITSTOP", false); | ||
StayInCar = Ini["SETTINGS"].GetBool("STAY_IN_CAR", true); | ||
AutoAppOnPitlane = Ini["SETTINGS"].GetBool("AUTO_APP_ON_PITLANE", true); | ||
VisibilityMaxTime = Ini["SETTINGS"].GetInt("VISIBILITY_MAX_TIME", 5); | ||
PresetsCount = Ini["SETTINGS"].GetInt("PRESETS_COUNT", 5); | ||
} | ||
|
||
protected override void SetToIni() { | ||
Ini["SETTINGS"].Set("USE_MOUSE_PITSTOP", UseMousePitstop); | ||
Ini["SETTINGS"].Set("STAY_IN_CAR", StayInCar); | ||
Ini["SETTINGS"].Set("AUTO_APP_ON_PITLANE", AutoAppOnPitlane); | ||
Ini["SETTINGS"].Set("VISIBILITY_MAX_TIME", VisibilityMaxTime); | ||
Ini["SETTINGS"].Set("PRESETS_COUNT", PresetsCount); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.