diff --git a/src/GuiApp/FileTime.Avalonia/App.axaml b/src/GuiApp/FileTime.Avalonia/App.axaml
index 8bfcc6d..4720bdb 100644
--- a/src/GuiApp/FileTime.Avalonia/App.axaml
+++ b/src/GuiApp/FileTime.Avalonia/App.axaml
@@ -2,57 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FileTime.Avalonia"
xmlns:converters="using:FileTime.Avalonia.Converters"
+ xmlns:views="using:FileTime.Avalonia.Views"
x:Class="FileTime.Avalonia.App">
-
-
-
-
-
-
-
-
-
-
+
+
@@ -64,6 +17,8 @@
#93a1a1
#93a1a1
+ #268bd2
+ #7793a1a1
#93a1a1
#073642
@@ -74,9 +29,9 @@
-
-
-
+
+
+
@@ -97,6 +52,12 @@
+
+
@@ -108,11 +69,48 @@
x:Key="ErrorBrush"
Color="{DynamicResource ErrorColor}" />
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/GuiApp/FileTime.Avalonia/Application/AppState.cs b/src/GuiApp/FileTime.Avalonia/Application/AppState.cs
index 08dae28..bd1b6e8 100644
--- a/src/GuiApp/FileTime.Avalonia/Application/AppState.cs
+++ b/src/GuiApp/FileTime.Avalonia/Application/AppState.cs
@@ -2,6 +2,7 @@
using MvvmGen;
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Text;
namespace FileTime.Avalonia.Application
@@ -10,8 +11,7 @@ namespace FileTime.Avalonia.Application
public partial class AppState
{
[Property]
- [PropertyCallMethod(nameof(TabsChanged))]
- private List _tabs = new List();
+ private ObservableCollection _tabs = new ObservableCollection();
[Property]
private TabContainer _selectedTab;
@@ -22,9 +22,9 @@ namespace FileTime.Avalonia.Application
[Property]
private string _rapidTravelText = "";
- private void TabsChanged()
+ partial void OnInitialize()
{
- SelectedTab ??= Tabs[0];
+ _tabs.CollectionChanged += (o, e) => SelectedTab ??= Tabs.Count > 0 ? Tabs[0] : null;
}
}
}
diff --git a/src/GuiApp/FileTime.Avalonia/Application/TabContainer.cs b/src/GuiApp/FileTime.Avalonia/Application/TabContainer.cs
index 35cdd40..61eff10 100644
--- a/src/GuiApp/FileTime.Avalonia/Application/TabContainer.cs
+++ b/src/GuiApp/FileTime.Avalonia/Application/TabContainer.cs
@@ -29,6 +29,12 @@ namespace FileTime.Avalonia.Application
[Property]
private ContainerViewModel _childContainer;
+ [Property]
+ private int _tabNumber;
+
+ [Property]
+ private bool _isSelected;
+
private IItemViewModel? _selectedItem;
public IItemViewModel? SelectedItem
@@ -36,7 +42,7 @@ namespace FileTime.Avalonia.Application
get => _selectedItem;
set
{
- if (_selectedItem != value && value != null)
+ if (_selectedItem != value)// && value != null
{
_selectedItem = value;
OnPropertyChanged("SelectedItem");
@@ -45,8 +51,9 @@ namespace FileTime.Avalonia.Application
}
}
- public async Task Init()
+ public async Task Init(int tabNumber)
{
+ TabNumber = tabNumber;
Tab.CurrentLocationChanged.Add(Tab_CurrentLocationChanged);
Tab.CurrentSelectedItemChanged.Add(Tab_CurrentSelectedItemChanged);
diff --git a/src/GuiApp/FileTime.Avalonia/Converters/ContextMenuGenerator.cs b/src/GuiApp/FileTime.Avalonia/Converters/ContextMenuGenerator.cs
new file mode 100644
index 0000000..b000c52
--- /dev/null
+++ b/src/GuiApp/FileTime.Avalonia/Converters/ContextMenuGenerator.cs
@@ -0,0 +1,34 @@
+using Avalonia.Controls;
+using Avalonia.Data.Converters;
+using FileTime.Avalonia.Services;
+using FileTime.Avalonia.ViewModels;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Globalization;
+
+namespace FileTime.Avalonia.Converters
+{
+ public class ContextMenuGenerator : IValueConverter
+ {
+ private readonly IContextMenuProvider _contextMenuProvider;
+
+ public ContextMenuGenerator()
+ {
+ _contextMenuProvider = App.ServiceProvider.GetService() ?? throw new Exception($"No {nameof(IContextMenuProvider)} is registered.");
+ }
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is ContainerViewModel containerViewModel)
+ {
+ return _contextMenuProvider.GetContextMenuForFolder(containerViewModel.Container);
+ }
+
+ return new object[] { new MenuItem() { Header = "asd" } };
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/GuiApp/FileTime.Avalonia/Converters/ItemViewModeToBrushConverter.cs b/src/GuiApp/FileTime.Avalonia/Converters/ItemViewModeToBrushConverter.cs
new file mode 100644
index 0000000..4eed0c7
--- /dev/null
+++ b/src/GuiApp/FileTime.Avalonia/Converters/ItemViewModeToBrushConverter.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Globalization;
+using Avalonia.Data.Converters;
+using Avalonia.Media;
+using FileTime.Avalonia.ViewModels;
+
+namespace FileTime.Avalonia.Converters
+{
+ public class ItemViewModeToBrushConverter : IValueConverter
+ {
+ public Brush? DefaultBrush { get; set; }
+ public Brush? AlternativeBrush { get; set; }
+ public Brush? SelectedBrush { get; set; }
+
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is ItemViewMode viewMode)
+ {
+ return viewMode switch
+ {
+ ItemViewMode.Default => DefaultBrush,
+ ItemViewMode.Alternative => AlternativeBrush,
+ ItemViewMode.Selected => SelectedBrush,
+ _ => throw new NotImplementedException()
+ };
+ }
+
+ return value;
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/GuiApp/FileTime.Avalonia/Converters/SplitStringConverter.cs b/src/GuiApp/FileTime.Avalonia/Converters/SplitStringConverter.cs
new file mode 100644
index 0000000..3ff9810
--- /dev/null
+++ b/src/GuiApp/FileTime.Avalonia/Converters/SplitStringConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Globalization;
+using Avalonia.Data.Converters;
+
+namespace FileTime.Avalonia.Converters
+{
+ public class SplitStringConverter : IValueConverter
+ {
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is string path && parameter is string separator)
+ {
+ return path.Split(separator);
+ }
+ else if (value is string path2 && parameter is char separator2)
+ {
+ return path2.Split(separator2);
+ }
+
+ return value;
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/GuiApp/FileTime.Avalonia/Services/IContextMenuProvider.cs b/src/GuiApp/FileTime.Avalonia/Services/IContextMenuProvider.cs
new file mode 100644
index 0000000..fb22430
--- /dev/null
+++ b/src/GuiApp/FileTime.Avalonia/Services/IContextMenuProvider.cs
@@ -0,0 +1,10 @@
+using FileTime.Core.Models;
+using System.Collections.Generic;
+
+namespace FileTime.Avalonia.Services
+{
+ public interface IContextMenuProvider
+ {
+ List