tr
This commit is contained in:
@@ -8,7 +8,7 @@ namespace ChatController.ChatKlassen
|
||||
{
|
||||
public class ChatMessage
|
||||
{
|
||||
//Chat Ansicht
|
||||
//Chat-Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme)
|
||||
{
|
||||
Username = username;
|
||||
@@ -17,17 +17,11 @@ namespace ChatController.ChatKlassen
|
||||
IsMyMessage = isme;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
if (IsHyperlink(message))
|
||||
{
|
||||
VisibilityRegelung("HyperlinkMessage");
|
||||
}
|
||||
else {
|
||||
VisibilityRegelung("Message");
|
||||
}
|
||||
|
||||
VisibilityRegelung(IsHyperlink(message) ? "HyperlinkMessage" : "Message");
|
||||
}
|
||||
|
||||
// Image Ansicht
|
||||
// Image-Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
@@ -44,7 +38,7 @@ namespace ChatController.ChatKlassen
|
||||
VisibilityRegelung("Image");
|
||||
}
|
||||
|
||||
//Image PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
|
||||
//Image-PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
@@ -59,21 +53,25 @@ namespace ChatController.ChatKlassen
|
||||
VisibilityRegelung("Default_Image");
|
||||
}
|
||||
|
||||
//Dokument Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string url)
|
||||
//Dokumenten-Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, string pSmallerImagePath, bool isme, string url)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
IsMyMessage = isme;
|
||||
|
||||
Dokpfad = (object) url;
|
||||
Dokpfad = url;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
VisibilityRegelung("Dokumente");
|
||||
Thumbnail = Utilities.Utils.CreateImageSourceFromPath(pSmallerImagePath);
|
||||
|
||||
VisibilityRegelung("Dokumente");
|
||||
}
|
||||
|
||||
public ImageSource Thumbnail { get; }
|
||||
|
||||
#region Farbgebung
|
||||
private void Farbgebung(bool isme)
|
||||
{
|
||||
@@ -151,32 +149,21 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
public static bool IsHyperlink(string word)
|
||||
{
|
||||
// First check to make sure the word has at least one of the characters we need to make a hyperlink
|
||||
try
|
||||
{
|
||||
if (word.IndexOfAny(@":.\/".ToCharArray()) != -1)
|
||||
{
|
||||
if (Uri.IsWellFormedUriString(word, UriKind.Absolute))
|
||||
{
|
||||
// The string is an Absolute URI
|
||||
if (word.StartsWith("http://")) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return word.StartsWith("http://");
|
||||
}
|
||||
else if (UrlRegex.IsMatch(word))
|
||||
|
||||
if (UrlRegex.IsMatch(word))
|
||||
{
|
||||
//hier der Bereich hin der die uri splittet wenn neben dem link auch text gesendet wird
|
||||
|
||||
|
||||
Uri uri = new Uri(word, UriKind.RelativeOrAbsolute);
|
||||
var uri = new Uri(word, UriKind.RelativeOrAbsolute);
|
||||
|
||||
if (!uri.IsAbsoluteUri)
|
||||
{
|
||||
// rebuild it it with http to turn it into an Absolute URI
|
||||
uri = new Uri(@"http://" + word, UriKind.Absolute);
|
||||
}
|
||||
|
||||
@@ -201,93 +188,79 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Variablen
|
||||
|
||||
public bool IsMyMessage { get; set; }
|
||||
public string Username { get; private set; }
|
||||
public string UserMessage { get; private set; }
|
||||
public DateTime SendTime { get; private set; }
|
||||
public string Username { get; }
|
||||
public string UserMessage { get; }
|
||||
public DateTime SendTime { get; }
|
||||
|
||||
public string UserTimeStringLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsMyMessage)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Username; //String.Format("{0} {1}", Username, SendTimeString);
|
||||
}
|
||||
}
|
||||
public string UserTimeStringLeft => IsMyMessage ? null : Username;
|
||||
|
||||
public string UserTimeStringRight
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (!IsMyMessage)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
return SendTimeString;
|
||||
}
|
||||
}
|
||||
public string UserTimeStringRight => SendTimeString;
|
||||
|
||||
public string SendTimeString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SendTime.Date == DateTime.Today)
|
||||
{
|
||||
return String.Format("Heute {0:HH:mm}", SendTime);
|
||||
}
|
||||
return SendTime.ToString("dd.MMM HH:mm");
|
||||
}
|
||||
}
|
||||
//public long MessagePersonOid { get; private set; }
|
||||
public string SendTimeString => SendTime.Date == DateTime.Today ? $"Heute {SendTime:HH:mm}" : SendTime.ToString("dd.MMM HH:mm");
|
||||
|
||||
public Brush ChatColor { get; private set; }
|
||||
|
||||
public string Posi { get; private set; }
|
||||
|
||||
public string OriginalImage { get; private set; }
|
||||
public string OriginalImageName { get; private set; }
|
||||
public string OriginalImage { get; }
|
||||
public string OriginalImageName { get; }
|
||||
|
||||
public Visibility ChatVisibility { get; set; }
|
||||
public Visibility HyperlinkVisibility { get; set; }
|
||||
|
||||
|
||||
private Visibility _pictureVisibility;
|
||||
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
|
||||
public Visibility PictureVisibility
|
||||
{
|
||||
get => _pictureVisibility;
|
||||
set
|
||||
{
|
||||
_pictureVisibility = value;
|
||||
OnPropertyChanged(nameof(PictureVisibility));
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _picturePlaceHolderVisibility;
|
||||
public Visibility PicturePlaceHolderVisibility { get { return _picturePlaceHolderVisibility; } set { _picturePlaceHolderVisibility = value; OnPropertyChanged("PicturePlaceHolderVisibility"); } }
|
||||
public Visibility PicturePlaceHolderVisibility
|
||||
{
|
||||
get => _picturePlaceHolderVisibility;
|
||||
set
|
||||
{
|
||||
_picturePlaceHolderVisibility = value;
|
||||
OnPropertyChanged(nameof(PicturePlaceHolderVisibility));
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _gifPictureVisibility;
|
||||
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
|
||||
|
||||
public Visibility GifPictureVisibility
|
||||
{
|
||||
get => _gifPictureVisibility;
|
||||
set
|
||||
{
|
||||
_gifPictureVisibility = value;
|
||||
OnPropertyChanged(nameof(GifPictureVisibility));
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility DokumentVisibility { get; set; }
|
||||
public ImageSource ImageSources { get; private set; }
|
||||
public object Dokpfad { get; private set; }
|
||||
public ImageSource ImageSources { get; }
|
||||
public object Dokpfad { get; }
|
||||
|
||||
public long? ChatMessageOid { get; private set; }
|
||||
|
||||
|
||||
//Farbe Links MEssageHeader
|
||||
private Brush _farbeLinksColor;
|
||||
public Brush FarbeLinksColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeLinksColor;
|
||||
}
|
||||
get => _farbeLinksColor;
|
||||
set
|
||||
{
|
||||
|
||||
_farbeLinksColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeLinksColor");
|
||||
OnPropertyChanged(nameof(FarbeLinksColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,31 +268,22 @@ namespace ChatController.ChatKlassen
|
||||
private Brush _farbeRechtsColor;
|
||||
public Brush FarbeRechtsColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeRechtsColor;
|
||||
}
|
||||
get => _farbeRechtsColor;
|
||||
set
|
||||
{
|
||||
|
||||
_farbeRechtsColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeRechtsColor");
|
||||
OnPropertyChanged(nameof(FarbeRechtsColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user