Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vicdotexe committed Dec 18, 2024
1 parent 8b3f1df commit f1a49cc
Show file tree
Hide file tree
Showing 27 changed files with 174 additions and 176 deletions.
4 changes: 2 additions & 2 deletions AchxTool/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:canvasItems="clr-namespace:AchxTool.Views.CanvasItems"
xmlns:converters="clr-namespace:AchxTool.Converters"
xmlns:converters1="clr-namespace:Avalonia.Markup.Xaml.Converters;assembly=Avalonia.Markup.Xaml"
xmlns:icons="clr-namespace:Material.Icons;assembly=Material.Icons"
xmlns:nodes="clr-namespace:AchxTool.ViewModels.Nodes"
xmlns:views="clr-namespace:AchxTool.Views"
xmlns:vm="clr-namespace:AchxTool.ViewModels"
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:canvasItems="clr-namespace:AchxTool.Views.Animation"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->

Expand Down Expand Up @@ -56,7 +56,7 @@
<TextBox Grid.Column="1" Text="{Binding Name}" />
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:FrameViewModel}">
<DataTemplate DataType="{x:Type nodes:FrameViewModel}">
<Grid x:Name="MainGrid"
Margin="4"
ColumnDefinitions="Auto, *"
Expand Down
2 changes: 2 additions & 0 deletions AchxTool/Behaviors/NodeTreeViewDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using Avalonia.VisualTree;
using Avalonia.Xaml.Interactions.DragAndDrop;

using AchxNodeViewModel = AchxTool.ViewModels.Nodes.AchxNodeViewModel;

namespace AchxTool.Behaviors;
public class NodeTreeViewDropHandler : DropHandlerBase
{
Expand Down
3 changes: 3 additions & 0 deletions AchxTool/Converters/NameOrIndexConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using AchxTool.ViewModels;
using AchxTool.ViewModels.Nodes;

using AchxNodeViewModel = AchxTool.ViewModels.Nodes.AchxNodeViewModel;
using FrameViewModel = AchxTool.ViewModels.Nodes.FrameViewModel;

namespace AchxTool.Converters;
public class NameOrIndexConverter : IMultiValueConverter
{
Expand Down
1 change: 1 addition & 0 deletions AchxTool/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using Microsoft.Extensions.DependencyInjection.Extensions;
using AchxTool.Services;
using AchxTool.ViewModels.Animation;

using Avalonia.Platform.Storage;

Expand Down
2 changes: 2 additions & 0 deletions AchxTool/Services/DialogService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using AchxTool.ViewModels;
using AchxTool.Views;

using Avalonia.Controls;
using Avalonia.Platform.Storage;

Expand Down
2 changes: 2 additions & 0 deletions AchxTool/Services/ProjectLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

using CommunityToolkit.Mvvm.Messaging;

using FrameViewModel = AchxTool.ViewModels.Nodes.FrameViewModel;

namespace AchxTool.Services
{
public interface IProjectLoader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Specialized;
using System.Diagnostics;

using AchxTool.Services;
using AchxTool.ViewModels.Nodes;

using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Threading;

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;

namespace AchxTool.ViewModels;
namespace AchxTool.ViewModels.Animation;

public partial class AnimationRunnerViewModel : ObservableObject, IRecipient<TreeNodeSelectedMessage>
{
Expand Down Expand Up @@ -150,12 +148,12 @@ void IRecipient<TreeNodeSelectedMessage>.Receive(TreeNodeSelectedMessage message

if (NodeTree.FindAnimation(message.Node) is { } animation)
{
ActiveAnimation = animation;

if (message.Node is FrameViewModel frame)
{
CurrentIndex = animation.Frames.IndexOf(frame);
}

ActiveAnimation = animation;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using AchxTool.Services;

using Avalonia.Media.Imaging;

using CommunityToolkit.Mvvm.ComponentModel;

namespace AchxTool.ViewModels;
namespace AchxTool.ViewModels.Animation;
public partial class CanvasTextureViewModel : ObservableObject, ICanvasItem
{
[ObservableProperty]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;

using AchxTool.Services;
using AchxTool.ViewModels.Nodes;

using Avalonia.Media.Imaging;

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;

namespace AchxTool.ViewModels;
namespace AchxTool.ViewModels.Animation;

public partial class CanvasViewModel : ObservableObject, IRecipient<TreeNodeSelectedMessage>,
IRecipient<ActiveAnimationChangedMessage>
Expand All @@ -19,7 +16,6 @@ public partial class CanvasViewModel : ObservableObject, IRecipient<TreeNodeSele
public CanvasTextureViewModel TextureViewModel { get; }

[ObservableProperty] private ICanvasItem? _selectedItem;

private AnimationViewModel? ActiveAnimation { get; set; }

private IMessenger Messenger { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AchxTool.ViewModels;
namespace AchxTool.ViewModels.Animation;

public interface ICanvasItem
{
Expand Down
8 changes: 4 additions & 4 deletions AchxTool/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ namespace AchxTool.ViewModels;

public partial class MainViewModel : ObservableObject
{
public CanvasViewModel CanvasViewModel { get; }
public Animation.CanvasViewModel CanvasViewModel { get; }
public NodeTreeViewModel NodeTreeViewModel { get; }
public AnimationRunnerViewModel AnimationRunner { get; }
public Animation.AnimationRunnerViewModel AnimationRunner { get; }
private IViewModelFactory Factory { get; }
private IProjectLoader ProjectLoader { get; }
private IDialogService DialogService { get; }

public MainViewModel(CanvasViewModel canvasViewModel,
public MainViewModel(Animation.CanvasViewModel canvasViewModel,
IViewModelFactory factory,
AnimationRunnerViewModel animationRunner,
Animation.AnimationRunnerViewModel animationRunner,
NodeTreeViewModel nodeTreeViewModel,
IMessenger messenger,
IProjectLoader projectLoader,
Expand Down
Loading

0 comments on commit f1a49cc

Please sign in to comment.