add cool status circle changing depends on adb device connected
This commit is contained in:
parent
bac6bb9ccd
commit
864a07c75c
4 changed files with 169 additions and 5 deletions
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia.Media;
|
||||
using MetaforceInstaller.Core.Models;
|
||||
|
||||
namespace MetaforceInstaller.UI.ViewModels;
|
||||
|
|
@ -12,6 +13,42 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
|
||||
public ObservableCollection<InstallationData> Installations { get; set; } = new();
|
||||
|
||||
private bool _isDeviceConnected;
|
||||
|
||||
public bool IsDeviceConnected
|
||||
{
|
||||
get => _isDeviceConnected;
|
||||
set
|
||||
{
|
||||
if (_isDeviceConnected != value)
|
||||
{
|
||||
_isDeviceConnected = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(StatusColor));
|
||||
OnPropertyChanged(nameof(StatusText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _deviceSerial = string.Empty;
|
||||
|
||||
public string DeviceSerial
|
||||
{
|
||||
get => _deviceSerial;
|
||||
set
|
||||
{
|
||||
if (_deviceSerial != value)
|
||||
{
|
||||
_deviceSerial = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(StatusText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IBrush StatusColor => IsDeviceConnected ? Brushes.Green : Brushes.Red;
|
||||
public string StatusText => IsDeviceConnected ? $"Connected to {_deviceSerial}" : "Not connected";
|
||||
|
||||
public void LoadInstallations(IEnumerable<InstallationData> data)
|
||||
{
|
||||
Installations.Clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue