using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; 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; using C4IT.API.Contracts; using C4IT_CustomerPanel.libs; namespace C4IT_CustomerPanel.UserControls { /// /// Interaktionslogik für IncidentListItem.xaml /// public partial class IncidentListItem : UserControl, INotifyPropertyChanged { private Ticket _ticketItem; public Ticket TicketItem { get => _ticketItem; set { _ticketItem = value; OnPropertyChanged(nameof(TicketItem)); OnPropertyChanged(nameof(Subject)); OnPropertyChanged(nameof(TicketNumber)); OnPropertyChanged(nameof(LastJournalEntryActionText)); OnPropertyChanged(nameof(HasLastJournalEntryActionText)); OnPropertyChanged(nameof(CreatedDate)); OnPropertyChanged(nameof(IsUnread)); OnPropertyChanged(nameof(State)); OnPropertyChanged(nameof(StateValue)); OnPropertyChanged(nameof(TicketType)); } } public string LastJournalEntryActionText { get { return _ticketItem._lastJournalEntryActionText; } set { _ticketItem._lastJournalEntryActionText = value; OnPropertyChanged(); OnPropertyChanged(nameof(HasLastJournalEntryActionText)); } } public bool HasLastJournalEntryActionText => !string.IsNullOrWhiteSpace(LastJournalEntryActionText); private Boolean _isUnread; public Boolean IsUnread { get { return _isUnread; } set { _isUnread = value; OnPropertyChanged(); } } public DateTime CreatedDate { get { return _ticketItem._createdDate.ToLocalTime(); } set { _ticketItem._createdDate = value; OnPropertyChanged(); } } public string TicketNumber { get { return _ticketItem._ticketNumber; } set { _ticketItem._ticketNumber = value; OnPropertyChanged(); } } public string Subject { get { return _ticketItem._subject; } set { _ticketItem._subject = value; OnPropertyChanged(); } } public int StateValue { get { return _ticketItem._stateValue; } set { _ticketItem._stateValue = value; OnPropertyChanged(); } } public string State { get { return _ticketItem._state; } set { _ticketItem._state = value; OnPropertyChanged(); } } public string TicketType { get { return _ticketItem._ticketType; } set { _ticketItem._ticketType = value; OnPropertyChanged(); } } public Guid getEOID() { return _ticketItem._objectID; } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; /// /// Raises this object's PropertyChanged event. /// /// The property that has a new value. protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } } #endregion public IncidentListItem(Ticket ticket) { InitializeComponent(); this.DataContext = this; TicketItem = ticket; } private void orderBy_PreviewMouseDown(object sender, MouseButtonEventArgs e) { TextBlock tb = (TextBlock)sender; var k = Window.GetWindow(this) as MainWindow; k.ReorderTicketCollection((MainWindow.enumOrderBy)Enum.ToObject(typeof(MainWindow.enumOrderBy), Int32.Parse(tb.Tag.ToString()))); } private void OnIncidentMouseEnter(object sender, MouseEventArgs e) { if (Application.Current.TryFindResource("itemHoverBorderColor") is SolidColorBrush hoverBrush) { HighlightIncidentBorder.BorderBrush = hoverBrush; } } private void OnIncidentMouseLeave(object sender, MouseEventArgs e) { if (Application.Current.TryFindResource("cardBorderColor") is SolidColorBrush defaultBrush) { HighlightIncidentBorder.BorderBrush = defaultBrush; } } } }