using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using detect.gui.ViewModels;
using Avalonia.Controls;
using Avalonia.Interactivity;
using detect.gui.Commons;
using ReactiveUI;

namespace detect.gui.Views;

public partial class UserView : ReactiveUserControl<UserViewModel>
{
    public UserView()
    {
        InitializeComponent();
        this.WhenActivated(d => { });
    }

    private void InitializeComponent()
    {
        AvaloniaXamlLoader.Load(this);
    }
    //
    private void OnLoaded(object? sender, RoutedEventArgs e)
    {
        // this.GetParent<MainView>()!.WebWindow.ParentContent = this;
        this.GetParent<MainView>()!.WebWindow.SetAddress(3);
    }
    //
    // private void OnUnloaded(object? sender, RoutedEventArgs e)
    // {
    //     this.GetParent<MainView>()!.WebWindow.Hide();
    // }
    //
    // private void OnSizeChanged(object? sender, SizeChangedEventArgs e)
    // {
    //     if (!this.GetParent<MainView>()!.WebWindow.IsVisible) return;
    //     this.GetParent<MainView>()!.WebWindow.InitUI();
    // }
}