fix issue
This commit is contained in:
@ -26,14 +26,15 @@ namespace Billing.Views
|
||||
public Command Tapped { get; }
|
||||
|
||||
private readonly int parentId;
|
||||
private readonly Category parent;
|
||||
|
||||
public CategoryPage(int pid = -1)
|
||||
{
|
||||
parentId = pid;
|
||||
var category = App.Categories.FirstOrDefault(c => c.Id == pid);
|
||||
Title = category?.Name ?? Resource.CategoryManage;
|
||||
parent = App.Categories.FirstOrDefault(c => c.Id == pid);
|
||||
Title = parent?.Name ?? Resource.CategoryManage;
|
||||
|
||||
if (category != null)
|
||||
if (parent != null)
|
||||
{
|
||||
SetValue(IsTopCategoryProperty, false);
|
||||
Categories = App.Categories.Where(c => c.ParentId == pid).Select(c => WrapCategory(c)).ToList();
|
||||
@ -68,7 +69,7 @@ namespace Billing.Views
|
||||
Name = category.Name,
|
||||
IsTopCategory = IsTopCategory,
|
||||
TintColor = category.TintColor == Color.Transparent || category.TintColor == default ?
|
||||
(Color)Application.Current.Resources[BaseTheme.PrimaryColor] :
|
||||
BaseTheme.CurrentPrimaryColor :
|
||||
category.TintColor
|
||||
};
|
||||
}
|
||||
@ -81,7 +82,7 @@ namespace Billing.Views
|
||||
}
|
||||
using (Tap.Start())
|
||||
{
|
||||
var page = new AddCategoryPage();
|
||||
var page = new AddCategoryPage(parent: parent);
|
||||
page.CategoryChecked += OnCategoryChecked;
|
||||
await Navigation.PushAsync(page);
|
||||
}
|
||||
@ -189,7 +190,9 @@ namespace Billing.Views
|
||||
{
|
||||
c.Name = c.Category.Name;
|
||||
c.Icon = c.Category.Icon;
|
||||
c.TintColor = c.Category.TintColor;
|
||||
c.TintColor = c.Category.TintColor == Color.Transparent || c.Category.TintColor == default ?
|
||||
BaseTheme.CurrentPrimaryColor :
|
||||
c.Category.TintColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user