You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6 KiB
C#

using System.Collections.ObjectModel;
namespace CommanderApp.Services;
public class MockPanelManager : IPanelManager
{
public event EventHandler<PanelStateChangedEventArgs> StateChanged;
public bool IsLeftPanelActive { get; set; } = true;
public FileSystemItem SelectedItem { get; set; }
public string ActivePanelPath { get; set; } = "/mock/path";
public string LeftPanelPath { get; set; } = "/left/path";
public string RightPanelPath { get; set; } = "/right/path";
public int LeftSelectedIndex { get; set; } = 0;
public int RightSelectedIndex { get; set; } = -1;
public ObservableCollection<FileSystemItem> LeftItems { get; } = new();
public ObservableCollection<FileSystemItem> RightItems { get; } = new();
public void SwitchToLeftPanel() => IsLeftPanelActive = true;
public void SwitchToRightPanel() => IsLeftPanelActive = false;
public void MoveSelection(int direction)
{
if (IsLeftPanelActive)
LeftSelectedIndex = Math.Max(0, LeftSelectedIndex + direction);
else
RightSelectedIndex = Math.Max(0, RightSelectedIndex + direction);
}
public void SetSelection(int index, bool isLeftPanel)
{
if (isLeftPanel)
LeftSelectedIndex = index;
else
RightSelectedIndex = index;
}
public void UpdatePanelPaths(string leftPath, string rightPath)
{
LeftPanelPath = leftPath;
RightPanelPath = rightPath;
}
public void ClearSelection()
{
LeftSelectedIndex = -1;
RightSelectedIndex = -1;
}
}