Default theme is back. Container selection functionality etc.
This commit is contained in:
@@ -636,6 +636,8 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
||||
}
|
||||
}
|
||||
|
||||
public int IndexOf(object item) => Items.IndexOf(item);
|
||||
|
||||
private void RefreshThreadInUI(ThreadMailItemViewModel expander)
|
||||
{
|
||||
// Remove thread completely from UI
|
||||
@@ -646,6 +648,53 @@ public partial class GroupedEmailCollection : ObservableObject, IRecipient<Prope
|
||||
AddThreadToUI(expander, groupKey);
|
||||
}
|
||||
|
||||
public MailItemContainer GetMailItemContainer(Guid uniqueId)
|
||||
{
|
||||
// First, search in standalone mail items (not displayed in threads)
|
||||
var standaloneMailItem = _sourceItems.FirstOrDefault(item =>
|
||||
item.MailCopy.UniqueId == uniqueId && !item.IsDisplayedInThread);
|
||||
|
||||
if (standaloneMailItem != null)
|
||||
{
|
||||
// Check if the standalone item is visible in the UI
|
||||
var isItemVisible = Items.Contains(standaloneMailItem);
|
||||
|
||||
return new MailItemContainer(standaloneMailItem)
|
||||
{
|
||||
IsItemVisible = isItemVisible,
|
||||
IsThreadVisible = false // Not a threaded item
|
||||
};
|
||||
}
|
||||
|
||||
// Search in thread expanders for threaded mail items
|
||||
foreach (var threadExpander in _threadExpanders.Values)
|
||||
{
|
||||
if (threadExpander.HasUniqueId(uniqueId))
|
||||
{
|
||||
// Find the specific mail item within the thread
|
||||
var threadMailItem = threadExpander.ThreadEmails.FirstOrDefault(email =>
|
||||
email.MailCopy.UniqueId == uniqueId);
|
||||
|
||||
if (threadMailItem != null)
|
||||
{
|
||||
// Check visibility: thread expander must be visible, and for individual item visibility,
|
||||
// the thread must be expanded and the item must be in the visible Items collection
|
||||
var isThreadVisible = Items.Contains(threadExpander);
|
||||
var isItemVisible = isThreadVisible && threadExpander.IsThreadExpanded && Items.Contains(threadMailItem);
|
||||
|
||||
return new MailItemContainer(threadMailItem, threadExpander)
|
||||
{
|
||||
IsItemVisible = isItemVisible,
|
||||
IsThreadVisible = isThreadVisible
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Item not found
|
||||
return null;
|
||||
}
|
||||
|
||||
private void AddThreadToUI(ThreadMailItemViewModel expander, string groupKey)
|
||||
{
|
||||
var groupHeader = GetOrCreateGroupHeader(groupKey);
|
||||
|
||||
@@ -6,6 +6,25 @@ public class MailItemContainer
|
||||
{
|
||||
public MailItemViewModel ItemViewModel { get; set; }
|
||||
public ThreadMailItemViewModel ThreadViewModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the mail item is currently visible in the UI's Items collection.
|
||||
/// For threaded items, this indicates if the individual mail item is visible (thread must be expanded).
|
||||
/// </summary>
|
||||
public bool IsItemVisible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the thread expander (if applicable) is currently visible in the UI's Items collection.
|
||||
/// Only relevant when ThreadViewModel is not null.
|
||||
/// </summary>
|
||||
public bool IsThreadVisible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the container can be successfully navigated to in the UI.
|
||||
/// For standalone items: true if IsItemVisible is true.
|
||||
/// For threaded items: true if IsThreadVisible is true (the thread expander can be navigated to).
|
||||
/// </summary>
|
||||
public bool CanNavigate => ThreadViewModel != null ? IsThreadVisible : IsItemVisible;
|
||||
|
||||
public MailItemContainer(MailItemViewModel itemViewModel, ThreadMailItemViewModel threadViewModel) : this(itemViewModel)
|
||||
{
|
||||
|
||||
@@ -110,4 +110,9 @@ public partial class ThreadMailItemViewModel : ObservableRecipient, IDisposable
|
||||
NotifyPropertyChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if this thread contains an email with the specified unique ID
|
||||
/// </summary>
|
||||
public bool HasUniqueId(Guid uniqueId) => _threadEmails.Any(email => email.MailCopy.UniqueId == uniqueId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user