mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Media.Imaging;
|
|
using Remotely.Shared.Entities;
|
|
using System.Diagnostics;
|
|
|
|
namespace Remotely.Desktop.UI.ViewModels.Fakes;
|
|
|
|
public class FakeBrandedViewModelBase : IBrandedViewModelBase
|
|
{
|
|
private readonly BrandingInfo _brandingInfo;
|
|
private Bitmap? _icon;
|
|
|
|
public FakeBrandedViewModelBase()
|
|
{
|
|
_brandingInfo = new BrandingInfo();
|
|
_icon = GetBitmapImageIcon(_brandingInfo);
|
|
}
|
|
public Bitmap? Icon
|
|
{
|
|
get => _icon;
|
|
set => _icon = value;
|
|
}
|
|
public string ProductName { get; set; } = "Test Product";
|
|
public WindowIcon? WindowIcon { get; set; }
|
|
|
|
public Task ApplyBranding()
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
private Bitmap? GetBitmapImageIcon(BrandingInfo bi)
|
|
{
|
|
try
|
|
{
|
|
using var imageStream = typeof(Shared.Services.AppState)
|
|
.Assembly
|
|
.GetManifestResourceStream("Remotely.Desktop.Shared.Assets.DefaultIcon.png") ?? new MemoryStream();
|
|
|
|
return new Bitmap(imageStream);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Debug.WriteLine(ex.Message);
|
|
return null;
|
|
}
|
|
}
|
|
}
|