-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced search criteria and results lists with DataGrids
ListView out. DataGrid in. Enables scrolling and better font-size handling. Added font size setting. Click a dot on the map to highlight the result in the list. Closes #11
- Loading branch information
Showing
24 changed files
with
1,193 additions
and
2,346 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace LarkatorGUI | ||
{ | ||
public class AddIntConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (double.TryParse((string)parameter, out var b) && value is double a) | ||
return a + b; | ||
|
||
throw new InvalidOperationException(); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new InvalidOperationException(); | ||
} | ||
} | ||
} |
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,55 @@ | ||
using Larkator.Common; | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
|
||
namespace LarkatorGUI | ||
{ | ||
public class DummyMainWindow | ||
{ | ||
public string ApplicationVersion { get => "DUMMY"; } | ||
|
||
public Collection<SearchCriteria> ListSearches { get => searches; } | ||
public Collection<DinoViewModel> ListResults { get => results; } | ||
|
||
public MapCalibration MapCalibration { get => calibration; } | ||
|
||
private Collection<SearchCriteria> searches = new Collection<SearchCriteria>() | ||
{ | ||
new SearchCriteria { Species="Zombie", MaxLevel=4, Female=true, Group="Minecraft" }, | ||
new SearchCriteria { Species="Creeper", MinLevel=100, Group="Minecraft" }, | ||
new SearchCriteria { Species="Slender", MinLevel=50, Group="Other" }, | ||
new SearchCriteria { Species="Kermit", Female=false, Group="Other" }, | ||
}; | ||
|
||
private Collection<DinoViewModel> results = new Collection<DinoViewModel>() | ||
{ | ||
new DinoViewModel(new Dino { BaseLevel=90, Location=new Position{ Lat=40,Lon=10 }, Name="Foud" }), | ||
new DinoViewModel(new Dino { BaseLevel=150, Location=new Position{ Lat=10,Lon=10 }, Name="One" }), | ||
new DinoViewModel(new Dino { BaseLevel=110, Location=new Position{ Lat=30,Lon=10 }, Name="Three" }), | ||
new DinoViewModel(new Dino { BaseLevel=130, Location=new Position{ Lat=20,Lon=10 }, Name="Two" }), | ||
}; | ||
|
||
private MapCalibration calibration = new MapCalibration | ||
{ | ||
Filename = "TheIsland", | ||
OffsetX = 13.75, | ||
OffsetY = 23.75, | ||
ScaleX = 9.8875, | ||
ScaleY = 9.625 | ||
}; | ||
|
||
public DummyMainWindow() | ||
{ | ||
foreach (var i in Enumerable.Range(0, 40)) | ||
searches.Add(new SearchCriteria { Species = "Long thingy name", Group = "Overrun" }); | ||
|
||
var rnd = new Random(); | ||
foreach (var dvm in results) | ||
{ | ||
dvm.Dino.Id = (ulong)rnd.Next(); | ||
dvm.Dino.WildLevels = new StatPoints() { Health = rnd.Next(50), Stamina = rnd.Next(50), Melee = rnd.Next(50), Speed = rnd.Next(50), Weight = rnd.Next(50) }; | ||
} | ||
} | ||
} | ||
} |
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,35 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace LarkatorGUI | ||
{ | ||
public sealed class FontSizeHelper | ||
{ | ||
public static readonly DependencyProperty RelativeFontSizeProperty = DependencyProperty.RegisterAttached( | ||
"RelativeFontSize", typeof(double), typeof(FontSizeHelper), new PropertyMetadata(0.0, RelativeFontSizeChanged)); | ||
|
||
public static double GetRelativeFontSize(DependencyObject d) | ||
{ | ||
if (d == null) throw new ArgumentNullException(nameof(d), "in GetRelativeFontSize"); | ||
|
||
return (double)d.GetValue(RelativeFontSizeProperty); | ||
} | ||
|
||
public static void SetRelativeFontSize(DependencyObject d, double value) | ||
{ | ||
if (d == null) throw new ArgumentNullException(nameof(d), "in SetRelativeFontSize"); | ||
|
||
d.SetValue(RelativeFontSizeProperty, value); | ||
} | ||
|
||
private static void RelativeFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
if (d == null) throw new ArgumentNullException(nameof(d), "in RelativeFontSizeChanged"); | ||
|
||
d.ClearValue(TextBlock.FontSizeProperty); | ||
var old = (double)d.GetValue(TextBlock.FontSizeProperty); | ||
d.SetValue(TextBlock.FontSizeProperty, Math.Max(old + (double)e.NewValue, 0)); | ||
} | ||
} | ||
} |
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.