forked from HellsGuard/ARK-Dedicated-Server-Tool
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from ChronosWS/BletchChanges
ASM 301 & 302 Changes
- Loading branch information
Showing
14 changed files
with
140 additions
and
15 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
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
56 changes: 56 additions & 0 deletions
56
ARK Server Manager/Common/Converters/IntRangeValueConverter.cs
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 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
using System.Windows.Markup; | ||
|
||
namespace ARK_Server_Manager.Lib.ViewModel | ||
{ | ||
public class IntRangeValueConverter : MarkupExtension, IValueConverter | ||
{ | ||
protected int MinValue { get; set; } | ||
protected int MaxValue { get; set; } | ||
|
||
public IntRangeValueConverter() | ||
{ | ||
MinValue = int.MinValue; | ||
MaxValue = int.MaxValue; | ||
} | ||
|
||
public IntRangeValueConverter(int minValue) | ||
{ | ||
MinValue = minValue; | ||
MaxValue = int.MaxValue; | ||
} | ||
|
||
public IntRangeValueConverter(int minValue, int maxValue) | ||
{ | ||
MinValue = minValue; | ||
MaxValue = maxValue; | ||
} | ||
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
double scaledValue = System.Convert.ToInt32(value); | ||
|
||
var sliderValue = scaledValue; | ||
sliderValue = Math.Max(MinValue, sliderValue); | ||
sliderValue = Math.Min(MaxValue, sliderValue); | ||
return sliderValue; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
var sliderValue = System.Convert.ToInt32(value); | ||
sliderValue = Math.Max(MinValue, sliderValue); | ||
sliderValue = Math.Min(MaxValue, sliderValue); | ||
|
||
var scaledValue = sliderValue; | ||
return scaledValue; | ||
} | ||
|
||
public override object ProvideValue(IServiceProvider serviceProvider) | ||
{ | ||
return this; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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