Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
donkeyProgramming committed Nov 24, 2024
1 parent 913d8a0 commit c47aef4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 4 additions & 5 deletions AssetEditor/Services/EditorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public partial class EditorManager : ObservableObject, IEditorManager
{
private readonly ILogger _logger = Logging.Create<EditorManager>();

private readonly PackFileService _packfileService;
private readonly PackFileService _packFileService;
private readonly IEditorDatabase _editorDatabase;

Expand All @@ -46,7 +45,7 @@ public EditorManager(IGlobalEventHub eventHub, PackFileService packFileService,
_packFileService = packFileService;
_editorDatabase = editorDatabase;

eventHub.Register<BeforePackFileContainerRemovedEvent>(this, Database_BeforePackFileContainerRemoved);
eventHub.Register<BeforePackFileContainerRemovedEvent>(this, OnBeforeRemoved);
}

public IList<IEditorInterface> GetAllEditors() => CurrentEditorsList;
Expand Down Expand Up @@ -133,8 +132,7 @@ void InsertEditorIntoTab(IEditorInterface editorView)
SelectedEditorIndex = CurrentEditorsList.Count - 1;
}


private void Database_BeforePackFileContainerRemoved(BeforePackFileContainerRemovedEvent e)
private void OnBeforeRemoved(BeforePackFileContainerRemovedEvent e)
{
var container = e.Removed;
var openFiles = new List<IEditorInterface>();
Expand All @@ -143,7 +141,7 @@ private void Database_BeforePackFileContainerRemoved(BeforePackFileContainerRemo
if (CurrentEditorsList[i] is not IFileEditor fileEditor)
continue;

var containterForPack = _packfileService.GetPackFileContainer(fileEditor.CurrentFile);
var containterForPack = _packFileService.GetPackFileContainer(fileEditor.CurrentFile);
if (containterForPack == container)
openFiles.Add(CurrentEditorsList[i]);
}
Expand Down Expand Up @@ -216,6 +214,7 @@ public bool ShouldBlockCloseCommand(IEditorInterface editor, bool hasUnsavedFile
return false;
}

// Move to a drop handler
public bool Drop(IEditorInterface node, IEditorInterface targetNode = default, bool insertAfterTargetNode = default)
{
var nodeIndex = CurrentEditorsList.IndexOf(node);
Expand Down
4 changes: 1 addition & 3 deletions AssetEditor/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ namespace AssetEditor.ViewModels
{
public partial class MainViewModel : ObservableObject, IDropTarget<IEditorInterface, bool>
{
private readonly IEditorManager _editorManager;
private readonly PackFileService _packfileService;
private readonly IUiCommandFactory _uiCommandFactory;

public PackFileBrowserViewModel FileTree { get; private set; }
public MenuBarViewModel MenuBar { get; set; }
public IEditorDatabase ToolsFactory { get; set; }
public IEditorManager EditorManager { get => _editorManager; }

[ObservableProperty] IEditorManager _editorManager;
[ObservableProperty] private bool _isClosingWithoutPrompt;
[ObservableProperty] private string _applicationTitle;
[ObservableProperty] private string _currentGame;
Expand Down Expand Up @@ -79,7 +78,6 @@ [RelayCommand] private void Closing(IEditorInterface editor)
}

[RelayCommand] void CloseTool(IEditorInterface tool) => _editorManager.CloseTool(tool);

[RelayCommand] void CloseOtherTools(IEditorInterface tool) => _editorManager.CloseOtherTools(tool);
[RelayCommand] void CloseAllTools(IEditorInterface tool) => _editorManager.CloseAllTools(tool);
[RelayCommand] void CloseToolsToLeft(IEditorInterface tool) => _editorManager.CloseToolsToLeft(tool);
Expand Down

0 comments on commit c47aef4

Please sign in to comment.