-
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.
Merge pull request #2 from intcooper/feature/ui_revamp
Feature/UI revamp
- Loading branch information
Showing
15 changed files
with
510 additions
and
239 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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
<Application x:Class="MMExNotifier.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:MMExNotifier"> | ||
<Application | ||
x:Class="MMExNotifier.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:MMExNotifier" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"> | ||
<Application.Resources> | ||
|
||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ui:ThemesDictionary Theme="Dark" /> | ||
<ui:ControlsDictionary /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
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,47 @@ | ||
using MMExNotifier.DataModel; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
|
||
namespace MMExNotifier.MVVM | ||
{ | ||
internal class DaysToTextConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null || value is not ExpiringBill) | ||
return string.Empty; | ||
|
||
var expiringBill = (ExpiringBill)value; | ||
|
||
if (expiringBill.DaysToNextOccurrence < -5) | ||
return $"expired on {expiringBill.NextOccurrenceDate:d} ({-expiringBill.DaysToNextOccurrence} days ago)!"; | ||
|
||
if (expiringBill.DaysToNextOccurrence < -1) | ||
return $"expired {-expiringBill.DaysToNextOccurrence} days ago!"; | ||
|
||
if (expiringBill.DaysToNextOccurrence == -1) | ||
return "expired yesterday!"; | ||
|
||
if (expiringBill.DaysToNextOccurrence == 0) | ||
return "expires today."; | ||
|
||
if (expiringBill.DaysToNextOccurrence == 1) | ||
return "expires tomorrow."; | ||
|
||
if (expiringBill.DaysToNextOccurrence > 1) | ||
return $"will expire on {expiringBill.NextOccurrenceDate:d} (in {expiringBill.DaysToNextOccurrence} days)."; | ||
|
||
return string.Empty; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace MMExNotifier.MVVM | ||
{ | ||
internal class DerivableDynamicStyle | ||
{ | ||
public static Style GetBaseStyle(DependencyObject obj) | ||
{ | ||
return (Style)obj.GetValue(BaseStyleProperty); | ||
} | ||
|
||
public static void SetBaseStyle(DependencyObject obj, Style value) | ||
{ | ||
obj.SetValue(BaseStyleProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty BaseStyleProperty = | ||
DependencyProperty.RegisterAttached("BaseStyle", typeof(Style), typeof(FrameworkElement), new UIPropertyMetadata(StyleChanged)); | ||
|
||
public static Style GetDerivedStyle(DependencyObject obj) | ||
{ | ||
return (Style)obj.GetValue(DerivedStyleProperty); | ||
} | ||
|
||
public static void SetDerivedStyle(DependencyObject obj, Style value) | ||
{ | ||
obj.SetValue(DerivedStyleProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty DerivedStyleProperty = | ||
DependencyProperty.RegisterAttached("DerivedStyle", typeof(Style), typeof(FrameworkElement), new UIPropertyMetadata(StyleChanged)); | ||
|
||
|
||
private static void StyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
Style baseStyle = GetBaseStyle(d); | ||
Style derivedStyle = GetDerivedStyle(d); | ||
Style newStyle; | ||
|
||
if (derivedStyle == null) | ||
{ | ||
newStyle = baseStyle; | ||
} | ||
else | ||
{ | ||
newStyle = new Style { BasedOn = baseStyle, TargetType = derivedStyle.TargetType }; | ||
|
||
foreach (var setter in derivedStyle.Setters) | ||
{ | ||
newStyle.Setters.Add(setter); | ||
} | ||
|
||
foreach (var trigger in derivedStyle.Triggers) | ||
{ | ||
newStyle.Triggers.Add(trigger); | ||
} | ||
} | ||
|
||
var fe = (FrameworkElement)d; | ||
fe.Style = newStyle; | ||
} | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using MMExNotifier.DataModel; | ||
using MMExNotifier.MVVM; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MMExNotifier.ViewModels.Design | ||
{ | ||
internal class MainViewModel : ViewModelBase | ||
{ | ||
public RangeObservableCollection<ExpiringBill> ExpiringBills { get; set; } = new RangeObservableCollection<ExpiringBill>(); | ||
|
||
public MainViewModel() | ||
{ | ||
ExpiringBills = new RangeObservableCollection<ExpiringBill>() { | ||
new () | ||
{ | ||
BillId = 1, | ||
CategoryName = "Category Name", | ||
SubCategoryName = "Subcategory Name", | ||
PayeeName = "Payee Name", | ||
NextOccurrenceDate = new DateTime(2024, 10, 30), | ||
Notes = "some notes about this entry.", | ||
} | ||
}; | ||
|
||
OnPropertyChanged(nameof(ExpiringBills)); | ||
} | ||
|
||
public override void Activate() | ||
{ | ||
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
Oops, something went wrong.