50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.Specialized;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using JD.Plugin.WPF.Module.ViewModel;
|
|
using JD.Remoting;
|
|
using JD.Remoting.Services;
|
|
|
|
namespace JD.Plugin.WPF.Module.Views
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for ToolWindowContent.xaml
|
|
/// </summary>
|
|
public partial class ToolWindowContent : UserControl
|
|
{
|
|
private ToolWindowContentViewModel _viewModel;
|
|
private readonly IPluginService _pluginService;
|
|
|
|
public ToolWindowContent(IPluginService pluginService)
|
|
{
|
|
_pluginService = pluginService;
|
|
pluginService.CollectionChanged += PluginServiceOnCollectionChanged;
|
|
UpdateViewModel();
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void UpdateViewModel()
|
|
{
|
|
_viewModel = new ToolWindowContentViewModel { PluginCollection = new PluginCollection(this.Dispatcher, _pluginService.ToArray()) };
|
|
this.DataContext = _viewModel;
|
|
}
|
|
|
|
private void PluginServiceOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
|
{
|
|
UpdateViewModel();
|
|
}
|
|
}
|
|
}
|