forked from Imulion/MHFZ_Overlay
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add data templates for quest log options
- Loading branch information
1 parent
ca62ec2
commit 484354b
Showing
22 changed files
with
283 additions
and
23 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
Large diffs are not rendered by default.
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
33 changes: 33 additions & 0 deletions
33
MHFZ_Overlay/UI/Class/Converter/OptionToTemplateConverter.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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Controls; | ||
using System.Windows; | ||
|
||
namespace MHFZ_Overlay | ||
{ | ||
public class OptionToTemplateConverter : DataTemplateSelector | ||
{ | ||
public override DataTemplate SelectTemplate(object item, DependencyObject container) | ||
{ | ||
var option = item as Option; | ||
if (option == null) | ||
return null; | ||
|
||
if (option.Name == "Gear") | ||
return (DataTemplate)((FrameworkElement)container).FindResource("GearTemplate"); | ||
else if (option.Name == "Top 20") | ||
return (DataTemplate)((FrameworkElement)container).FindResource("Top20Template"); | ||
else if (option.Name == "Weapon Usage") | ||
return (DataTemplate)((FrameworkElement)container).FindResource("WeaponUsageTemplate"); | ||
else if (option.Name == "Most Recent") | ||
return (DataTemplate)((FrameworkElement)container).FindResource("MostRecentTemplate"); | ||
else if (option.Name == "YouTube") | ||
return (DataTemplate)((FrameworkElement)container).FindResource("YouTubeTemplate"); | ||
else | ||
return (DataTemplate)((FrameworkElement)container).FindResource("DefaultTemplate"); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
MHFZ_Overlay/UI/Class/Converter/OptionToVisibilityConverter.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,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
using System.Windows; | ||
|
||
namespace MHFZ_Overlay | ||
{ | ||
public class OptionToVisibilityConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
string selectedOption = value as string; | ||
string targetOption = parameter as string; | ||
|
||
if (selectedOption == targetOption) | ||
{ | ||
return Visibility.Visible; | ||
} | ||
else | ||
{ | ||
return Visibility.Collapsed; | ||
} | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
|
||
} |
File renamed without changes.
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,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MHFZ_Overlay | ||
{ | ||
public class Option | ||
{ | ||
public string Name { get; set; } | ||
public bool IsSelected { get; set; } | ||
} | ||
} |
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,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Controls; | ||
using System.Windows; | ||
|
||
namespace MHFZ_Overlay | ||
{ | ||
public class OptionTemplateSelector : DataTemplateSelector | ||
{ | ||
public override DataTemplate SelectTemplate(object item, DependencyObject container) | ||
{ | ||
var selectedOption = item as string; | ||
if (selectedOption != null) | ||
{ | ||
FrameworkElement element = container as FrameworkElement; | ||
if (element != null) | ||
{ | ||
return element.FindResource(selectedOption) as DataTemplate; | ||
} | ||
} | ||
return null; | ||
} | ||
} | ||
|
||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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