UI - Removed Fody, begone arrogant devs!

This commit is contained in:
Robert committed 2020-06-30 20:41:46 +02:00
1 parent 8e01d1f63e
commit 2c2b0ca3e1
49 files changed
+1011 -232

No files matched your search

@@ -14,6 +14,7 @@ namespace Artemis.UI.Screens.Settings.Debug
{
private readonly IDeviceService _deviceService;
private readonly IDialogService _dialogService;
private ArtemisLed _selectedLed;
public DeviceDebugViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService)
{
@@ -22,11 +23,18 @@ namespace Artemis.UI.Screens.Settings.Debug
Device = device;
}
// [DependsOn(nameof(SelectedLed))]
public List<ArtemisLed> SelectedLeds => SelectedLed != null ? new List<ArtemisLed> {SelectedLed} : null;
public ArtemisDevice Device { get; }
public ArtemisLed SelectedLed { get; set; }
public ArtemisLed SelectedLed
{
get => _selectedLed;
set
{
if (!SetAndNotify(ref _selectedLed, value)) return;
NotifyOfPropertyChange(nameof(SelectedLeds));
}
}
public bool CanOpenImageDirectory => Device.RgbDevice.DeviceInfo.Image != null;
@@ -16,6 +16,9 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
private readonly Timer _updateTimer;
private bool _isModuleFilterEnabled;
private Core.Plugins.Abstract.Module _selectedModule;
private DataModelViewModel _mainDataModel;
private string _propertySearch;
private List<Core.Plugins.Abstract.Module> _modules;
public DataModelDebugViewModel(IDataModelVisualizationService dataModelVisualizationService, IPluginService pluginService)
{
@@ -27,17 +30,30 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
DisplayName = "Data model";
}
public DataModelViewModel MainDataModel { get; set; }
public DataModelViewModel MainDataModel
{
get => _mainDataModel;
set => SetAndNotify(ref _mainDataModel, value);
}
public string PropertySearch { get; set; }
public List<Core.Plugins.Abstract.Module> Modules { get; set; }
public string PropertySearch
{
get => _propertySearch;
set => SetAndNotify(ref _propertySearch, value);
}
public List<Core.Plugins.Abstract.Module> Modules
{
get => _modules;
set => SetAndNotify(ref _modules, value);
}
public Core.Plugins.Abstract.Module SelectedModule
{
get => _selectedModule;
set
{
_selectedModule = value;
if (!SetAndNotify(ref _selectedModule, value)) return;
GetDataModel();
}
}
@@ -47,8 +63,8 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
get => _isModuleFilterEnabled;
set
{
_isModuleFilterEnabled = value;
SetAndNotify(ref _isModuleFilterEnabled, value);
if (!IsModuleFilterEnabled)
SelectedModule = null;
else
@@ -75,8 +91,8 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
private void GetDataModel()
{
MainDataModel = SelectedModule != null
? _dataModelVisualizationService.GetPluginDataModelVisualization(SelectedModule)
MainDataModel = SelectedModule != null
? _dataModelVisualizationService.GetPluginDataModelVisualization(SelectedModule)
: _dataModelVisualizationService.GetMainDataModelVisualization();
}
@@ -4,7 +4,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using SkiaSharp;
using SkiaSharp.Views.WPF;
using Stylet;
@@ -14,20 +13,26 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
public class RenderDebugViewModel : Screen
{
private readonly ICoreService _coreService;
private readonly IRgbService _rgbService;
private readonly ISurfaceService _surfaceService;
private double _currentFps;
private ImageSource _currentFrame;
public RenderDebugViewModel(ICoreService coreService, IRgbService rgbService, ISurfaceService surfaceService)
public RenderDebugViewModel(ICoreService coreService)
{
_coreService = coreService;
_rgbService = rgbService;
_surfaceService = surfaceService;
DisplayName = "Rendering";
}
public ImageSource CurrentFrame { get; set; }
public double CurrentFps { get; set; }
public ImageSource CurrentFrame
{
get => _currentFrame;
set => SetAndNotify(ref _currentFrame, value);
}
public double CurrentFps
{
get => _currentFps;
set => SetAndNotify(ref _currentFps, value);
}
protected override void OnActivate()
{
@@ -47,7 +52,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
Execute.PostToUIThread(() =>
{
if (e.BitmapBrush?.Bitmap == null)
if (e.BitmapBrush?.Bitmap == null || e.BitmapBrush.Bitmap.Pixels.Length == 0)
return;
if (!(CurrentFrame is WriteableBitmap writeableBitmap))
@@ -29,6 +29,11 @@ namespace Artemis.UI.Screens.Settings
private readonly ISettingsService _settingsService;
private readonly IPluginSettingsVmFactory _pluginSettingsVmFactory;
private readonly ISurfaceService _surfaceService;
private List<Tuple<string, int>> _targetFrameRates;
private List<Tuple<string, double>> _renderScales;
private List<int> _sampleSizes;
private BindableCollection<DeviceSettingsViewModel> _deviceSettingsViewModels;
private BindableCollection<PluginSettingsViewModel> _plugins;
public SettingsViewModel(ISurfaceService surfaceService, IPluginService pluginService, IDialogService dialogService, IDebugService debugService,
ISettingsService settingsService, IPluginSettingsVmFactory pluginSettingsVmFactory, IDeviceSettingsVmFactory deviceSettingsVmFactory)
@@ -60,15 +65,39 @@ namespace Artemis.UI.Screens.Settings
SampleSizes = new List<int> {1, 9};
}
public List<Tuple<string, int>> TargetFrameRates { get; set; }
public List<Tuple<string, double>> RenderScales { get; set; }
public List<Tuple<string, int>> TargetFrameRates
{
get => _targetFrameRates;
set => SetAndNotify(ref _targetFrameRates, value);
}
public List<Tuple<string, double>> RenderScales
{
get => _renderScales;
set => SetAndNotify(ref _renderScales, value);
}
public List<int> SampleSizes
{
get => _sampleSizes;
set => SetAndNotify(ref _sampleSizes, value);
}
public BindableCollection<DeviceSettingsViewModel> DeviceSettingsViewModels
{
get => _deviceSettingsViewModels;
set => SetAndNotify(ref _deviceSettingsViewModels, value);
}
public BindableCollection<PluginSettingsViewModel> Plugins
{
get => _plugins;
set => SetAndNotify(ref _plugins, value);
}
public IEnumerable<ValueDescription> LogLevels { get; }
public IEnumerable<ValueDescription> ColorSchemes { get; }
public List<int> SampleSizes { get; set; }
public BindableCollection<DeviceSettingsViewModel> DeviceSettingsViewModels { get; set; }
public BindableCollection<PluginSettingsViewModel> Plugins { get; set; }
public bool StartWithWindows
{
get => _settingsService.GetSetting("UI.AutoRun", false).Value;
@@ -10,14 +10,15 @@ using Stylet;
namespace Artemis.UI.Screens.Settings.Tabs.Devices
{
public class DeviceSettingsViewModel
public class DeviceSettingsViewModel : PropertyChangedBase
{
private readonly IDeviceService _deviceService;
private readonly IDialogService _dialogService;
private readonly IWindowManager _windowManager;
private readonly IDeviceDebugVmFactory _deviceDebugVmFactory;
private bool _isDeviceEnabled;
public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService,
public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService,
IWindowManager windowManager, IDeviceDebugVmFactory deviceDebugVmFactory)
{
_deviceService = deviceService;
@@ -29,15 +30,22 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize();
Name = Device.RgbDevice.DeviceInfo.Model;
Manufacturer = Device.RgbDevice.DeviceInfo.Manufacturer;
// TODO: Implement this bad boy
IsDeviceEnabled = true;
}
public ArtemisDevice Device { get; }
public string Type { get; set; }
public string Name { get; set; }
public string Manufacturer { get; set; }
public bool IsDeviceEnabled { get; set; }
public string Type { get; }
public string Name { get; }
public string Manufacturer { get; }
public bool IsDeviceEnabled
{
get => _isDeviceEnabled;
set => SetAndNotify(ref _isDeviceEnabled, value);
}
public void IdentifyDevice()
{
@@ -17,6 +17,9 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
private readonly IPluginService _pluginService;
private readonly ISnackbarMessageQueue _snackbarMessageQueue;
private readonly IWindowManager _windowManager;
private Plugin _plugin;
private PluginInfo _pluginInfo;
private bool _enabling;
public PluginSettingsViewModel(Plugin plugin, IWindowManager windowManager, IDialogService dialogService, IPluginService pluginService,
ISnackbarMessageQueue snackbarMessageQueue)
@@ -30,9 +33,24 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
_snackbarMessageQueue = snackbarMessageQueue;
}
public Plugin Plugin { get; set; }
public PluginInfo PluginInfo { get; set; }
public bool Enabling { get; set; }
public Plugin Plugin
{
get => _plugin;
set => SetAndNotify(ref _plugin, value);
}
public PluginInfo PluginInfo
{
get => _pluginInfo;
set => SetAndNotify(ref _pluginInfo, value);
}
public bool Enabling
{
get => _enabling;
set => SetAndNotify(ref _enabling, value);
}
public PackIconKind Icon => GetIconKind();
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
public bool CanOpenSettings => IsEnabled && Plugin.HasConfigurationViewModel;