-
Notifications
You must be signed in to change notification settings - Fork 0
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
43 changed files
with
2,278 additions
and
455 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
28 changes: 28 additions & 0 deletions
28
src/Apps/Corathing.Organizer/Behaviors/DataTemplateSelector.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,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows; | ||
|
||
namespace Corathing.Organizer.Behaviors; | ||
|
||
public class TemplateSelector : DataTemplateSelector | ||
{ | ||
public DataTemplate ItemTemplate { get; set; } | ||
public DataTemplate NewButtonTemplate { get; set; } | ||
|
||
public override DataTemplate SelectTemplate(object item, DependencyObject container) | ||
{ | ||
if (item == CollectionView.NewItemPlaceholder) | ||
{ | ||
return NewButtonTemplate; | ||
} | ||
else | ||
{ | ||
return ItemTemplate; | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/Apps/Corathing.Organizer/Converters/ApplicationLanguageToCultureInfoConverter.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,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
|
||
using Corathing.Contracts.Services; | ||
using Corathing.Dashboards.WPF.Bindings; | ||
|
||
namespace Corathing.Organizer.Converters; | ||
|
||
[ValueConversion(typeof(ApplicationLanguage), typeof(CultureInfo))] | ||
public class ApplicationLanguageToCultureInfoConverter : IValueConverter | ||
{ | ||
public object? Convert(object value, Type targetType, | ||
object parameter, CultureInfo culture) | ||
=> value is ApplicationLanguage language ? language switch | ||
{ | ||
ApplicationLanguage.en_US => 0, | ||
ApplicationLanguage.ko_KR => 1, | ||
_ => 0, | ||
} : 0; | ||
|
||
public object? ConvertBack(object value, Type targetType, | ||
object parameter, CultureInfo culture) | ||
=> value is int index ? index switch | ||
{ | ||
0 => ApplicationLanguage.en_US, | ||
1 => ApplicationLanguage.ko_KR, | ||
_ => ApplicationLanguage.en_US, | ||
} : ApplicationLanguage.en_US; | ||
|
||
//public object? Convert(object value, Type targetType, | ||
// object parameter, CultureInfo culture) | ||
//{ | ||
// if (value == null) | ||
// return null; | ||
// if (value is not AvailableCulture) | ||
// return null; | ||
// return Convert((AvailableCulture)value); | ||
//} | ||
|
||
//public object? ConvertBack(object value, Type targetType, | ||
// object parameter, CultureInfo culture) | ||
//{ | ||
// if (value == null) | ||
// return null; | ||
// if (value is not CultureInfo) | ||
// return null; | ||
// return ConvertBack((CultureInfo)value); | ||
//} | ||
|
||
//public static CultureInfo Convert(AvailableCulture culture) | ||
//{ | ||
// return CultureInfo.GetCultureInfo( | ||
// StringToAvailableCultureConverter. | ||
// ConvertBack(culture)); | ||
//} | ||
|
||
//public static AvailableCulture ConvertBack(CultureInfo culture) | ||
//{ | ||
// return StringToAvailableCultureConverter.Convert(culture.Name); | ||
//} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Apps/Corathing.Organizer/Converters/ApplicationLanguageToIndexConverter.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,29 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
using Corathing.Contracts.Services; | ||
|
||
namespace Corathing.Organizer.Converters; | ||
|
||
[ValueConversion(typeof(ApplicationLanguage), typeof(int))] | ||
public class ApplicationLanguageToIndexConverter : IValueConverter | ||
{ | ||
public object? Convert(object value, Type targetType, | ||
object parameter, CultureInfo culture) | ||
=> value is ApplicationLanguage language ? language switch | ||
{ | ||
ApplicationLanguage.en_US => 0, | ||
ApplicationLanguage.ko_KR => 1, | ||
_ => 0, | ||
} : 0; | ||
|
||
public object? ConvertBack(object value, Type targetType, | ||
object parameter, CultureInfo culture) | ||
=> value is int index ? index switch | ||
{ | ||
0 => ApplicationLanguage.en_US, | ||
1 => ApplicationLanguage.ko_KR, | ||
_ => ApplicationLanguage.en_US, | ||
} : ApplicationLanguage.en_US; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Apps/Corathing.Organizer/Converters/UILanguageToIndexConverter.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,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
|
||
using Corathing.Contracts.Services; | ||
|
||
namespace Corathing.Organizer.Converters; | ||
|
||
public class UILanguageToIndexConverter : IValueConverter | ||
{ | ||
public object? Convert(object value, Type targetType, | ||
object parameter, CultureInfo culture) | ||
=> value is string languageName ? languageName switch | ||
{ | ||
"English" => 0, | ||
"한국어" => 1, | ||
_ => 0, | ||
} : 0; | ||
|
||
public object? ConvertBack(object value, Type targetType, | ||
object parameter, CultureInfo culture) | ||
=> value is int index ? index switch | ||
{ | ||
0 => "English", | ||
1 => "한국어", | ||
_ => "English", | ||
} : "English"; | ||
} |
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
Oops, something went wrong.