117 lines
4.0 KiB
C#
117 lines
4.0 KiB
C#
using F4SD_AdaptableIcon;
|
|
using F4SD_AdaptableIcon.Enums;
|
|
using FasdDesktopUi.Basics.Helper;
|
|
using FasdDesktopUi.Basics.Models;
|
|
using FasdDesktopUi.Pages.DetailsPage.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace FasdDesktopUi.Basics.UserControls
|
|
{
|
|
public partial class DetailedRecommendation : UserControl
|
|
{
|
|
#region Properties
|
|
|
|
#region RecommendationData
|
|
|
|
public static readonly DependencyProperty RecommendationDataProperty =
|
|
DependencyProperty.Register("RecommendationData", typeof(cRecommendationDataModel), typeof(DetailedRecommendation), new PropertyMetadata(new cRecommendationDataModel()));
|
|
|
|
public cRecommendationDataModel RecommendationData
|
|
{
|
|
get { return (cRecommendationDataModel)GetValue(RecommendationDataProperty); }
|
|
set { SetValue(RecommendationDataProperty, value); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsCloseButtonVisible
|
|
|
|
public static readonly DependencyProperty IsCloseButtonVisibleProperty =
|
|
DependencyProperty.Register("IsCloseButtonVisible", typeof(bool), typeof(DetailedRecommendation), new PropertyMetadata(false));
|
|
|
|
public bool IsCloseButtonVisible
|
|
{
|
|
get { return (bool)GetValue(IsCloseButtonVisibleProperty); }
|
|
set { SetValue(IsCloseButtonVisibleProperty, value); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Icon
|
|
|
|
public IconData Icon
|
|
{
|
|
get { return (IconData)GetValue(IconProperty); }
|
|
set { SetValue(IconProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty IconProperty =
|
|
DependencyProperty.Register("Icon", typeof(IconData), typeof(DetailedRecommendation), new PropertyMetadata(new IconData(enumInternIcons.status_info), HandleIconChanged));
|
|
|
|
private static void HandleIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (d is DetailedRecommendation recommendation && e.NewValue is IconData iconData)
|
|
{
|
|
IconHelper.SetIconValue(recommendation.RecommendationIcon, iconData);
|
|
}
|
|
}
|
|
|
|
public string PrimaryIconColorResourceName
|
|
{
|
|
get { return (string)GetValue(PrimaryIconColorResourceNameProperty); }
|
|
set { SetValue(PrimaryIconColorResourceNameProperty, value); }
|
|
}
|
|
|
|
public static readonly DependencyProperty PrimaryIconColorResourceNameProperty =
|
|
DependencyProperty.Register("PrimaryIconColorResourceName", typeof(string), typeof(DetailedRecommendation), new PropertyMetadata("Color.Blue", HandleColorChanged));
|
|
|
|
private static void HandleColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (d is DetailedRecommendation recommendation)
|
|
{
|
|
recommendation.RecommendationIcon.SetResourceReference(AdaptableIcon.AdaptableIcon.PrimaryIconColorProperty, e.NewValue);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public Action CloseButtonClickedAction { get; set; }
|
|
|
|
#endregion
|
|
|
|
public DetailedRecommendation()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void CloseButton_Click()
|
|
{
|
|
if (CloseButtonClickedAction != null)
|
|
CloseButtonClickedAction.Invoke();
|
|
}
|
|
|
|
private void CloseButton_MouseUp(object sender, MouseButtonEventArgs e)
|
|
{
|
|
CloseButton_Click();
|
|
}
|
|
|
|
private void CloseButton_TouchDown(object sender, TouchEventArgs e)
|
|
{
|
|
CloseButton_Click();
|
|
}
|
|
}
|
|
}
|