Smb write, delete, fixes, error handling
This commit is contained in:
@@ -268,9 +268,18 @@ namespace FileTime.Avalonia.Services
|
||||
{
|
||||
var handler = async (List<InputElementWrapper> inputs) =>
|
||||
{
|
||||
var container = _appState.SelectedTab.CurrentLocation.Container;
|
||||
var createContainerCommand = new CreateContainerCommand(new AbsolutePath(container), inputs[0].Value);
|
||||
await AddCommand(createContainerCommand);
|
||||
string? containerName = null;
|
||||
try
|
||||
{
|
||||
containerName = inputs[0].Value;
|
||||
var container = _appState.SelectedTab.CurrentLocation.Container;
|
||||
var createContainerCommand = new CreateContainerCommand(new AbsolutePath(container), containerName);
|
||||
await AddCommand(createContainerCommand);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Error while creating container {Container}", containerName);
|
||||
}
|
||||
};
|
||||
|
||||
_dialogService.ReadInputs(new List<InputElement>() { new InputElement("Container name", InputType.Text) }, handler);
|
||||
@@ -282,9 +291,18 @@ namespace FileTime.Avalonia.Services
|
||||
{
|
||||
var handler = async (List<InputElementWrapper> inputs) =>
|
||||
{
|
||||
var container = _appState.SelectedTab.CurrentLocation.Container;
|
||||
var createElementCommand = new CreateElementCommand(new AbsolutePath(container), inputs[0].Value);
|
||||
await AddCommand(createElementCommand);
|
||||
string? elementName = null;
|
||||
try
|
||||
{
|
||||
elementName = inputs[0].Value;
|
||||
var container = _appState.SelectedTab.CurrentLocation.Container;
|
||||
var createElementCommand = new CreateElementCommand(new AbsolutePath(container), elementName);
|
||||
await AddCommand(createElementCommand);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Error while creating element {Element}", elementName);
|
||||
}
|
||||
};
|
||||
|
||||
_dialogService.ReadInputs(new List<InputElement>() { new InputElement("Element name", InputType.Text) }, handler);
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace FileTime.Avalonia.Services
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, "Unknown error while running commnad. {Command}", command);
|
||||
_logger.LogError(e, "Unknown error while running command. {Command} {Error}", command, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,19 @@ namespace FileTime.Avalonia.Services
|
||||
if (container == null) continue;
|
||||
|
||||
var newTab = new Tab();
|
||||
await newTab.Init(container);
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (container == null) throw new Exception($"Could not find an initializable path along {tab.Path}");
|
||||
await newTab.Init(container);
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
container = container!.GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
var newTabContainer = new TabContainer(newTab, _localContentProvider, _itemNameConverterService);
|
||||
await newTabContainer.Init(tab.Number);
|
||||
|
||||
Reference in New Issue
Block a user