Files
Chat/ChatController/Utilities/BroadcastMessage.cs
LynJet 410945af20 Massennachricht hinzugefügt
Optik an die vom Android- und Webclient angepasst
Asynchrone Methoden verbessert
2022-07-11 16:01:14 +02:00

69 lines
1.9 KiB
C#

using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ChatController.Annotations;
namespace ChatController.Utilities
{
public class BroadcastMessage : INotifyPropertyChanged
{
private string _OriginalFilePath;
public string OriginalFilePath
{
get => _OriginalFilePath;
set
{
_OriginalFilePath = value;
OnPropertyChanged(nameof(OriginalFilePath));
}
}
private string _ScaledFilePath;
public string ScaledFilePath
{
get => _ScaledFilePath;
set
{
_ScaledFilePath = value;
OnPropertyChanged(nameof(ScaledFilePath));
}
}
private ImageSource _BroadcastMessageImageSource;
public ImageSource BroadcastMessageImageSource
{
get => _BroadcastMessageImageSource;
set
{
_BroadcastMessageImageSource = value;
OnPropertyChanged(nameof(BroadcastMessageImageSource));
}
}
public BroadcastMessage(string originalFilePath, string scaledFilePath)
{
OriginalFilePath = originalFilePath;
ScaledFilePath = scaledFilePath;
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(scaledFilePath);
bitmap.EndInit();
BroadcastMessageImageSource = bitmap;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}