Sftp, fullname+nativepath refactor
This commit is contained in:
@@ -147,6 +147,7 @@
|
||||
<converters:GetFileExtensionConverter x:Key="GetFileExtensionConverter"/>
|
||||
<converters:CommandToCommandNameConverter x:Key="CommandToCommandNameConverter"/>
|
||||
<converters:NamePartShrinkerConverter x:Key="NamePartShrinkerConverter"/>
|
||||
<converters:StringReplaceConverter x:Key="PathPreformatter" OldValue="://" NewValue="/"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace FileTime.Avalonia
|
||||
.AddServices()
|
||||
.RegisterLogging()
|
||||
.AddViewModels()
|
||||
.RegisterCommandHandlers()
|
||||
.BuildServiceProvider()
|
||||
.InitSerilog();
|
||||
|
||||
|
||||
@@ -51,16 +51,11 @@ namespace FileTime.Avalonia.Application
|
||||
{
|
||||
if (!_updateFromCode && value != null)
|
||||
{
|
||||
/*try
|
||||
{*/
|
||||
/*var task = SetSelectedItemAsync(value, true);
|
||||
Task.WaitAll(new Task[] { task }, 100);*/
|
||||
Task.Run(async () => await SetSelectedItemAsync(value, true)).Wait();
|
||||
/*}
|
||||
catch
|
||||
try
|
||||
{
|
||||
//TODO: Debug, linux start after restore 3 tabs
|
||||
}*/
|
||||
Task.Run(async () => await SetSelectedItemAsync(value, true)).Wait();
|
||||
}
|
||||
catch (AggregateException e) when (e.InnerExceptions.Count == 1 && e.InnerExceptions[0] is IndexOutOfRangeException) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace FileTime.Avalonia.Converters
|
||||
{
|
||||
public class StringReplaceConverter : IValueConverter
|
||||
{
|
||||
public string? OldValue { get; set; }
|
||||
public string? NewValue { get; set; }
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is string s && OldValue != null && NewValue != null ? s.Replace(OldValue, NewValue) : value;
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ using FileTime.Avalonia.ViewModels;
|
||||
using FileTime.Core.Command;
|
||||
using FileTime.Core.Interactions;
|
||||
using FileTime.Core.Persistence;
|
||||
using FileTime.Providers.Smb;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
@@ -39,7 +38,6 @@ namespace FileTime.Avalonia
|
||||
.AddSingleton(new PersistenceSettings(Program.AppDataRoot))
|
||||
.AddSingleton<ProgramsService>()
|
||||
.AddSingleton<ToastMessageSink>()
|
||||
.AddSmbServices()
|
||||
.AddSingleton<IIconProvider, MaterialIconProvider>();
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
@@ -53,15 +51,6 @@ namespace FileTime.Avalonia
|
||||
|
||||
return serviceCollection;
|
||||
}
|
||||
internal static IServiceCollection RegisterCommandHandlers(this IServiceCollection serviceCollection)
|
||||
{
|
||||
foreach (var commandHandler in Providers.Local.Startup.GetCommandHandlers())
|
||||
{
|
||||
serviceCollection.AddTransient(typeof(ICommandHandler), commandHandler);
|
||||
}
|
||||
|
||||
return serviceCollection;
|
||||
}
|
||||
|
||||
internal static IServiceCollection RegisterLogging(this IServiceCollection serviceCollection)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<Rectangle Fill="#01000000"/>
|
||||
|
||||
<StackPanel Margin="20,10" Orientation="Horizontal">
|
||||
<local:PathPresenter DataContext="{Binding AppState.SelectedTab.CurrentLocation.Container.FullName}"/>
|
||||
<local:PathPresenter DataContext="{Binding AppState.SelectedTab.CurrentLocation.Container.FullName,Converter={StaticResource PathPreformatter}}"/>
|
||||
<TextBlock
|
||||
Text="{Binding AppState.SelectedTab.SelectedItem.Item.Name}" Foreground="{StaticResource AccentBrush}" />
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user