-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
25 changed files
with
226 additions
and
19 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,63 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
using System.Windows.Media.Imaging; | ||
using Volumey.DataProvider; | ||
|
||
namespace Volumey.View.Converters | ||
{ | ||
public class ButtonIconThemeConverter : IMultiValueConverter | ||
{ | ||
private BitmapImage mug; | ||
private BitmapImage MugIcon => mug ??= App.Current.FindResource("Mug") as BitmapImage; | ||
|
||
private BitmapImage mugEmpty; | ||
private BitmapImage MugEmptyIcon => mugEmpty ??= App.Current.FindResource("MugEmpty") as BitmapImage; | ||
|
||
private BitmapImage mugDark; | ||
private BitmapImage MugIconDark => mugDark ??= App.Current.FindResource("MugDark") as BitmapImage; | ||
|
||
private BitmapImage mugEmptyDark; | ||
private BitmapImage MugEmptyIconDark => mugEmptyDark ??= App.Current.FindResource("MugEmptyDark") as BitmapImage; | ||
|
||
private BitmapImage lightGit; | ||
private BitmapImage LightGitIcon => lightGit ??= App.Current.FindResource("GitHub") as BitmapImage; | ||
|
||
private BitmapImage darkGit; | ||
private BitmapImage DarkGitIcon => darkGit ??= App.Current.FindResource("GitHubDark") as BitmapImage; | ||
|
||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
try | ||
{ | ||
var theme = AppTheme.Light; | ||
if(values[0] is AppTheme selectedTheme) | ||
{ | ||
if(selectedTheme == AppTheme.System && values[1] is AppTheme windowsTheme) | ||
theme = windowsTheme; | ||
else | ||
theme = selectedTheme; | ||
} | ||
|
||
if(parameter.Equals("Mug") && values[2] is bool isMouseOver) | ||
return GetMugIcon(theme, isMouseOver); | ||
if(parameter.Equals("Git")) | ||
return theme == AppTheme.Dark ? LightGitIcon : DarkGitIcon; | ||
} | ||
catch { } | ||
return Binding.DoNothing; | ||
} | ||
|
||
private BitmapImage GetMugIcon(AppTheme theme, bool isMouseOver) | ||
=> theme == AppTheme.Dark ? GetLightMugIcon(isMouseOver) : GetDarkMugIcon(isMouseOver); | ||
|
||
private BitmapImage GetDarkMugIcon(bool isMouseOver) | ||
=> isMouseOver ? MugIconDark : MugEmptyIconDark; | ||
|
||
private BitmapImage GetLightMugIcon(bool isMouseOver) | ||
=> isMouseOver ? MugIcon : MugEmptyIcon; | ||
|
||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) | ||
=> new object[] { }; | ||
} | ||
} |
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.