-
Notifications
You must be signed in to change notification settings - Fork 4
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 #19 from UnicordDev/feature/more-embeds
More embed types
- Loading branch information
Showing
12 changed files
with
457 additions
and
59 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,45 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Linq; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Data; | ||
|
||
namespace UniSky.Converters; | ||
|
||
public class VisibilityConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
if (value is null) | ||
{ | ||
return Visibility.Collapsed; | ||
} | ||
|
||
if (value is bool b) | ||
{ | ||
return b ? Visibility.Visible : Visibility.Collapsed; | ||
} | ||
|
||
if (value is int i) | ||
{ | ||
return i > 0 ? Visibility.Visible : Visibility.Collapsed; | ||
} | ||
|
||
if (value is string str) | ||
{ | ||
return string.IsNullOrWhiteSpace(str) ? Visibility.Collapsed : Visibility.Visible; | ||
} | ||
|
||
if (value is IEnumerable e) | ||
{ | ||
return e.OfType<object>().Any() ? Visibility.Visible : Visibility.Collapsed; | ||
} | ||
|
||
return Visibility.Visible; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
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.