diff --git a/PhotonUI/Controls/Content/TextBlockSelectable.cs b/PhotonUI/Controls/Content/TextBlockSelectable.cs index 157ae70..92660f6 100644 --- a/PhotonUI/Controls/Content/TextBlockSelectable.cs +++ b/PhotonUI/Controls/Content/TextBlockSelectable.cs @@ -1,6 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; using PhotonUI.Events; -using PhotonUI.Events.Platform; using PhotonUI.Extensions; using PhotonUI.Interfaces.Services; using PhotonUI.Models; diff --git a/PhotonUI/Controls/Input/TextInput.cs b/PhotonUI/Controls/Input/TextInput.cs index 3f15b3f..e76c585 100644 --- a/PhotonUI/Controls/Input/TextInput.cs +++ b/PhotonUI/Controls/Input/TextInput.cs @@ -9,7 +9,6 @@ using PhotonUI.Models.Properties; using SDL3; using System.ComponentModel; -using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows.Input; diff --git a/PhotonUI/Interfaces/Clips/ClipFrame.cs b/PhotonUI/Models/Clips/ClipFrame.cs similarity index 100% rename from PhotonUI/Interfaces/Clips/ClipFrame.cs rename to PhotonUI/Models/Clips/ClipFrame.cs diff --git a/PhotonUI/Interfaces/Clips/ClipSequence.cs b/PhotonUI/Models/Clips/ClipSequence.cs similarity index 100% rename from PhotonUI/Interfaces/Clips/ClipSequence.cs rename to PhotonUI/Models/Clips/ClipSequence.cs diff --git a/PhotonUI/ViewModels/ViewModelBase.cs b/PhotonUI/ViewModels/ViewModelBase.cs new file mode 100644 index 0000000..27a52e0 --- /dev/null +++ b/PhotonUI/ViewModels/ViewModelBase.cs @@ -0,0 +1,25 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using PhotonUI.Controls; +using PhotonUI.Events; +using PhotonUI.Extensions; +using PhotonUI.Interfaces.Services; + +namespace PhotonUI.ViewModels +{ + public abstract partial class ViewModelBase(IServiceProvider serviceProvider, IBindingService bindingService) + : ObservableObject + { + protected readonly IServiceProvider ServiceProvider = serviceProvider; + protected readonly IBindingService BindingService = bindingService; + + public virtual void OnEvent(Window window, PlatformEventArgs e) { } + + public virtual T Create() + where T : class => DependencyInjectionExtensions.Create(this.ServiceProvider); + + public virtual void Bind(Control target, string targetProperty, object source, string sourceProperty, bool twoWay = false) + => this.BindingService.Bind(target, targetProperty, source, sourceProperty, twoWay); + public void Unbind(Control target, string targetProperty) + => this.BindingService.Unbind(target, targetProperty); + } +} \ No newline at end of file