-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'iExt11-11-#1' into main
- Loading branch information
Showing
101 changed files
with
1,788 additions
and
1,672 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+757 Bytes
src/electrifier/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.14 KB
src/electrifier/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.7 KB
src/electrifier/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.75 KB
src/electrifier/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.01 KB
src/electrifier/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png
Oops, something went wrong.
Binary file added
BIN
+757 Bytes
src/electrifier/Assets/Square44x44Logo.altform-unplated_targetsize-16.png
Oops, something went wrong.
Binary file added
BIN
+1.14 KB
src/electrifier/Assets/Square44x44Logo.altform-unplated_targetsize-24.png
Oops, something went wrong.
Binary file added
BIN
+38.7 KB
src/electrifier/Assets/Square44x44Logo.altform-unplated_targetsize-256.png
Oops, something went wrong.
Binary file added
BIN
+1.75 KB
src/electrifier/Assets/Square44x44Logo.altform-unplated_targetsize-32.png
Oops, something went wrong.
Binary file added
BIN
+3.01 KB
src/electrifier/Assets/Square44x44Logo.altform-unplated_targetsize-48.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+1.14 KB
src/electrifier/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
46 changes: 46 additions & 0 deletions
46
src/electrifier/Controls/Vanara/Contracts/AbstractBrowserItem.cs
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,46 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using Vanara.PInvoke; | ||
using Vanara.Windows.Shell; | ||
using static Vanara.PInvoke.ComCtl32; | ||
using static Vanara.PInvoke.Shell32; | ||
|
||
namespace electrifier.Controls.Vanara.Contracts; | ||
|
||
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")] | ||
public abstract class AbstractBrowserItem<T>(bool isFolder, List<T> childItems) | ||
{ | ||
public readonly bool IsFolder = isFolder; | ||
public readonly List<T> ChildItems = childItems; | ||
public new string ToString() => $"AbstractBrowserItem(<{typeof(T)}>(isFolder {isFolder}, childItems {childItems})"; | ||
} | ||
|
||
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")] | ||
public abstract class AbstractBrowserItemCollection<T> : IEnumerable<AbstractBrowserItem<T>>, IList<AbstractBrowserItem<T>> | ||
{ | ||
protected readonly IList<AbstractBrowserItem<T>> Collection = []; | ||
//protected readonly ShellItem? _parentItem; | ||
|
||
AbstractBrowserItem<T> IList<AbstractBrowserItem<T>>.this[int index] { get => Collection[index]; set => Collection[index] = value; } | ||
int ICollection<AbstractBrowserItem<T>>.Count => Collection.Count; | ||
bool ICollection<AbstractBrowserItem<T>>.IsReadOnly => false; | ||
void ICollection<AbstractBrowserItem<T>>.Add(AbstractBrowserItem<T> item) => Collection.Add(item); | ||
void ICollection<AbstractBrowserItem<T>>.Clear() => Collection.Clear(); | ||
bool ICollection<AbstractBrowserItem<T>>.Contains(AbstractBrowserItem<T> item) => Collection.Contains(item); | ||
void ICollection<AbstractBrowserItem<T>>.CopyTo(AbstractBrowserItem<T>[] array, int arrayIndex) => Collection.CopyTo(array, arrayIndex); | ||
IEnumerator<AbstractBrowserItem<T>> IEnumerable<AbstractBrowserItem<T>>.GetEnumerator() => Collection.GetEnumerator(); | ||
IEnumerator IEnumerable.GetEnumerator() => Collection.GetEnumerator(); | ||
int IList<AbstractBrowserItem<T>>.IndexOf(AbstractBrowserItem<T> item) => Collection.IndexOf(item); | ||
void IList<AbstractBrowserItem<T>>.Insert(int index, AbstractBrowserItem<T> item) => Collection.Insert(index, item); | ||
bool ICollection<AbstractBrowserItem<T>>.Remove(AbstractBrowserItem<T> item) => Collection.Remove(item); | ||
void IList<AbstractBrowserItem<T>>.RemoveAt(int index) => Collection.RemoveAt(index); | ||
|
||
public new string ToString() => $"AbstractBrowserItemCollection(<{typeof(T)}>(number of child items: {Collection.Count})"; | ||
} |
192 changes: 192 additions & 0 deletions
192
src/electrifier/Controls/Vanara/ExplorerBrowser.NavigationService.cs
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,192 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using static Vanara.PInvoke.Shell32; | ||
using Vanara.Windows.Shell; | ||
|
||
namespace electrifier.Controls.Vanara; | ||
|
||
public sealed partial class ExplorerBrowser | ||
{ | ||
|
||
/* | ||
/// <summary>The navigation log is a history of the locations visited by the explorer browser.</summary> | ||
public class NavigationLog | ||
{ | ||
private readonly ExplorerBrowser? parent = null; | ||
/// <summary>The pending navigation log action. null if the user is not navigating via the navigation log.</summary> | ||
private PendingNavigation? pendingNavigation; | ||
internal NavigationLog(ExplorerBrowser parent) | ||
{ | ||
// Hook navigation events from the parent to distinguish between navigation log induced navigation, and other navigations. | ||
this.parent = parent ?? throw new ArgumentNullException(nameof(parent)); | ||
this.parent.Navigated += OnNavigated; | ||
this.parent.NavigationFailed += OnNavigationFailed; | ||
} | ||
/// <summary>Fires when the navigation log changes or the current navigation position changes</summary> | ||
public event EventHandler<NavigationLogEventArgs>? NavigationLogChanged; | ||
/// <summary>Indicates the presence of locations in the log that can be reached by calling Navigate(Backward)</summary> | ||
public bool CanNavigateBackward => CurrentLocationIndex > 0; | ||
/// <summary>Indicates the presence of locations in the log that can be reached by calling Navigate(Forward)</summary> | ||
public bool CanNavigateForward => CurrentLocationIndex < Locations.Count - 1; | ||
/// <summary>Gets the shell object in the Locations collection pointed to by CurrentLocationIndex.</summary> | ||
public ShellItem? CurrentLocation => CurrentLocationIndex < 0 ? null : Locations[CurrentLocationIndex]; | ||
/// <summary> | ||
/// An index into the Locations collection. The ShellItem pointed to by this index is the current location of the ExplorerBrowser. | ||
/// </summary> | ||
public int CurrentLocationIndex { get; set; } = -1; | ||
/// <summary>The navigation log</summary> | ||
public List<ShellItem> Locations { get; } = new List<ShellItem>(); | ||
/// <summary>Clears the contents of the navigation log.</summary> | ||
public void Clear() | ||
{ | ||
if (Locations.Count == 0) return; | ||
var oldCanNavigateBackward = CanNavigateBackward; | ||
var oldCanNavigateForward = CanNavigateForward; | ||
Locations.Clear(); | ||
CurrentLocationIndex = -1; | ||
var args = new NavigationLogEventArgs | ||
{ | ||
LocationsChanged = true, | ||
CanNavigateBackwardChanged = oldCanNavigateBackward != CanNavigateBackward, | ||
CanNavigateForwardChanged = oldCanNavigateForward != CanNavigateForward | ||
}; | ||
NavigationLogChanged?.Invoke(this, args); | ||
} | ||
internal bool NavigateLog(NavigationLogDirection direction) | ||
{ | ||
// determine proper index to navigate to | ||
int locationIndex; | ||
switch (direction) | ||
{ | ||
case NavigationLogDirection.Backward when CanNavigateBackward: | ||
locationIndex = CurrentLocationIndex - 1; | ||
break; | ||
case NavigationLogDirection.Forward when CanNavigateForward: | ||
locationIndex = CurrentLocationIndex + 1; | ||
break; | ||
default: | ||
return false; | ||
} | ||
// initiate traversal request | ||
var location = Locations[locationIndex]; | ||
pendingNavigation = new PendingNavigation(location, locationIndex); | ||
parent?.Navigate(location); | ||
return true; | ||
} | ||
internal bool NavigateLog(int index) | ||
{ | ||
// can't go anywhere | ||
if (index >= Locations.Count || index < 0) return false; | ||
// no need to re navigate to the same location | ||
if (index == CurrentLocationIndex) return false; | ||
// initiate traversal request | ||
var location = Locations[index]; | ||
pendingNavigation = new PendingNavigation(location, index); | ||
parent?.Navigate(location); | ||
return true; | ||
} | ||
private void OnNavigated(object? sender, NavigatedEventArgs args) | ||
{ | ||
var eventArgs = new NavigationLogEventArgs(); | ||
var oldCanNavigateBackward = CanNavigateBackward; | ||
var oldCanNavigateForward = CanNavigateForward; | ||
if (pendingNavigation != null) | ||
{ | ||
// navigation log traversal in progress | ||
// determine if new location is the same as the traversal request | ||
var shellItemsEqual = pendingNavigation.Location.IShellItem.Compare(args.NewLocation?.IShellItem, SICHINTF.SICHINT_ALLFIELDS, out var i).Succeeded && i == 0; | ||
if (!shellItemsEqual) | ||
{ | ||
// new location is different than traversal request, behave is if it never happened! remove history following | ||
// currentLocationIndex, append new item | ||
if (CurrentLocationIndex < Locations.Count - 1) | ||
{ | ||
Locations.RemoveRange(CurrentLocationIndex + 1, Locations.Count - (CurrentLocationIndex + 1)); | ||
} | ||
if (args.NewLocation is not null) Locations.Add(args.NewLocation); | ||
CurrentLocationIndex = Locations.Count - 1; | ||
eventArgs.LocationsChanged = true; | ||
} | ||
else | ||
{ | ||
// log traversal successful, update index | ||
CurrentLocationIndex = pendingNavigation.Index; | ||
eventArgs.LocationsChanged = false; | ||
} | ||
pendingNavigation = null; | ||
} | ||
else | ||
{ | ||
// remove history following currentLocationIndex, append new item | ||
if (CurrentLocationIndex < Locations.Count - 1) | ||
{ | ||
Locations.RemoveRange(CurrentLocationIndex + 1, Locations.Count - (CurrentLocationIndex + 1)); | ||
} | ||
if (args.NewLocation is not null) Locations.Add(args.NewLocation); | ||
CurrentLocationIndex = Locations.Count - 1; | ||
eventArgs.LocationsChanged = true; | ||
} | ||
// update event args | ||
eventArgs.CanNavigateBackwardChanged = oldCanNavigateBackward != CanNavigateBackward; | ||
eventArgs.CanNavigateForwardChanged = oldCanNavigateForward != CanNavigateForward; | ||
NavigationLogChanged?.Invoke(this, eventArgs); | ||
} | ||
private void OnNavigationFailed(object? sender, NavigationFailedEventArgs args) => pendingNavigation = null; | ||
/// <summary>A navigation traversal request</summary> | ||
private class PendingNavigation | ||
{ | ||
internal PendingNavigation(ShellItem location, int index) | ||
{ | ||
Location = location; | ||
Index = index; | ||
} | ||
internal int Index { get; set; } | ||
internal ShellItem Location { get; set; } | ||
} | ||
} | ||
/// <summary>The event argument for NavigationLogChangedEvent</summary> | ||
public class NavigationLogEventArgs : EventArgs | ||
{ | ||
/// <summary>Indicates CanNavigateBackward has changed</summary> | ||
public bool CanNavigateBackwardChanged { get; set; } | ||
/// <summary>Indicates CanNavigateForward has changed</summary> | ||
public bool CanNavigateForwardChanged { get; set; } | ||
/// <summary>Indicates the Locations collection has changed</summary> | ||
public bool LocationsChanged { get; set; } | ||
} | ||
*/ | ||
} |
Oops, something went wrong.