DesignPreview WIP

This commit is contained in:
2023-07-18 07:48:13 +02:00
parent cd31104f8d
commit db32c7aef3
13 changed files with 389 additions and 23 deletions

View File

@@ -0,0 +1,49 @@
using System.Reactive.Linq;
using System.Reactive.Subjects;
using DynamicData;
using FileTime.Core.Models;
using FileTime.Core.Services;
namespace FileTime.GuiApp.DesignPreview.Services;
public class TabPreview : ITab
{
public TabPreview()
{
var currentLocation = new BehaviorSubject<IContainer?>(ItemPreview.CurrentContainer);
CurrentLocation = currentLocation.AsObservable();
var currentItems = new SourceCache<IItem, string>(i => i.Name);
var items = GenerateItems();
currentItems.AddOrUpdate(items);
CurrentSelectedItemPreview = items[0];
CurrentItems = new BehaviorSubject<IObservable<IChangeSet<IItem, string>>>(currentItems.Connect());
CurrentSelectedItem = new BehaviorSubject<AbsolutePath?>(new AbsolutePath(null!, CurrentSelectedItemPreview));
}
public IItem CurrentSelectedItemPreview { get; }
private static List<IItem> GenerateItems()
=> Enumerable.Range(1, 10).Select(i => (IItem)ItemPreview.GenerateElement("Element" + i)).ToList();
public IObservable<IContainer?> CurrentLocation { get; }
public IObservable<AbsolutePath?> CurrentSelectedItem { get; }
public IObservable<IObservable<IChangeSet<IItem, string>>?> CurrentItems { get; }
public FullName? LastDeepestSelectedPath { get; }
public void SetCurrentLocation(IContainer newLocation) => throw new NotImplementedException();
public void AddItemFilter(ItemFilter filter) => throw new NotImplementedException();
public void RemoveItemFilter(ItemFilter filter) => throw new NotImplementedException();
public void RemoveItemFilter(string name) => throw new NotImplementedException();
public void SetSelectedItem(AbsolutePath newSelectedItem) => throw new NotImplementedException();
public void ForceSetCurrentLocation(IContainer newLocation) => throw new NotImplementedException();
public void Init(IContainer obj1) => throw new NotImplementedException();
public void Dispose()
{
}
}