237 lines
6.8 KiB
C#
237 lines
6.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Media;
|
|
|
|
namespace ChatController.ChatKlassen
|
|
{
|
|
public class KontaktlistBuilder
|
|
{
|
|
|
|
public string Name { get; private set; }
|
|
|
|
private string _receiveMs;
|
|
public string ReceiveMs
|
|
{
|
|
get
|
|
{
|
|
var WordsArray = _receiveMs.Split();
|
|
|
|
//var verkuerzterText = _receiveMs.Substring(0,10);
|
|
if (WordsArray.Length > 4)
|
|
{
|
|
string Items = WordsArray[0] + " " + WordsArray[1] + " " + WordsArray[2] + " " + WordsArray[3] + "...";
|
|
|
|
return Items;
|
|
}
|
|
else
|
|
{
|
|
//if(_receiveMs.Length > 15)
|
|
return _receiveMs;
|
|
}
|
|
}
|
|
|
|
set
|
|
{
|
|
_receiveMs = value;
|
|
OnPropertyChanged("ReceiveMs");
|
|
}
|
|
}
|
|
|
|
private Brush _color;
|
|
public Brush Color
|
|
{
|
|
get
|
|
{
|
|
return _color;
|
|
}
|
|
set
|
|
{
|
|
|
|
_color = value;
|
|
|
|
OnPropertyChanged("Color");
|
|
}
|
|
}
|
|
|
|
private int _setzeGelesen;
|
|
public int SetzeGelesen
|
|
{
|
|
get { return _setzeGelesen; }
|
|
|
|
set
|
|
{
|
|
_setzeGelesen = value;
|
|
|
|
if (_setzeGelesen == 1)
|
|
{
|
|
_color = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
|
}
|
|
else
|
|
{
|
|
_color = new SolidColorBrush(Colors.Gray);
|
|
}
|
|
|
|
OnPropertyChanged("SetzeGelesen");
|
|
OnPropertyChanged("Color");
|
|
}
|
|
}
|
|
|
|
public ImageSource Image { get; private set; }
|
|
public DateTime TimeStamp { get; set; }
|
|
public long GroupId { get; set; }
|
|
public long UserId { get; set; }
|
|
public long? CustomerPersonOid { get; set; }
|
|
|
|
public KontaktlistBuilder(string name, ImageSource image, string lastMs, DateTime timestamp, long groupid,long? customerPersonOid)
|
|
{
|
|
Name = name;
|
|
ReceiveMs = lastMs;
|
|
Image = image;
|
|
TimeStamp = timestamp;
|
|
GroupId = groupid;
|
|
CustomerPersonOid = customerPersonOid;
|
|
SetzeGelesen = 1;
|
|
|
|
}
|
|
|
|
//public KontaktlistBuilder(string name, StatusType statustyp, ImageSource image, long empfaengerid, ChatType typeChat, CompactCustomerDC customer)
|
|
//{
|
|
// this.Customer = customer;
|
|
// this.Name = name;
|
|
// this.StatusTyp = statustyp;
|
|
// this.Image = image;
|
|
// this.EmpfaengerOid = empfaengerid;
|
|
|
|
// Receivems = "";
|
|
// TypeChat = typeChat;
|
|
|
|
// if (statustyp == StatusType.Online)
|
|
// {
|
|
// this.Color = new BrushConverter().ConvertFromString("#00ae00") as SolidColorBrush;
|
|
// }
|
|
// else if (statustyp == StatusType.Offline)
|
|
// {
|
|
// this.Color = new SolidColorBrush(Colors.Red);
|
|
// }
|
|
// else
|
|
// {
|
|
// this.Color = new SolidColorBrush(Colors.Orange);
|
|
// }
|
|
|
|
// if (typeChat == ChatType.Team)
|
|
// {
|
|
// _colorType = new SolidColorBrush(Colors.DarkViolet);
|
|
// }
|
|
// else if (typeChat == ChatType.Klienten)
|
|
// {
|
|
// _colorType = new SolidColorBrush(Colors.Blue);
|
|
// }
|
|
// else
|
|
// {
|
|
// _colorType = new SolidColorBrush(Colors.Green);
|
|
// }
|
|
//}
|
|
|
|
//public string Name { get; private set; }
|
|
|
|
//private StatusType _statustyp;
|
|
//public StatusType StatusTyp
|
|
//{
|
|
// get { return _statustyp; }
|
|
// set
|
|
// {
|
|
// _statustyp = value;
|
|
|
|
// if (_statustyp == StatusType.Online)
|
|
// {
|
|
// _color = new BrushConverter().ConvertFromString("#00ae00") as SolidColorBrush;
|
|
// }
|
|
// else if (_statustyp == StatusType.Offline)
|
|
// {
|
|
// _color = new SolidColorBrush(Colors.Red);
|
|
// }
|
|
// else
|
|
// {
|
|
// _color = new SolidColorBrush(Colors.Orange);
|
|
// }
|
|
|
|
// OnPropertyChanged("Lastms");
|
|
// }
|
|
//}
|
|
|
|
//public ImageSource Image { get; private set; }
|
|
|
|
//public long EmpfaengerOid { get; private set; }
|
|
|
|
//private string _receivems;
|
|
//public string Receivems { get { return _receivems; } set { _receivems = value; OnPropertyChanged("Receivems"); } }
|
|
|
|
//public ChatType TypeChat { get; set; }
|
|
|
|
//private Brush _color;
|
|
//public Brush Color
|
|
//{
|
|
// get
|
|
// {
|
|
// return _color;
|
|
// }
|
|
// set
|
|
// {
|
|
// if (StatusTyp == StatusType.Online)
|
|
// {
|
|
// _color = new BrushConverter().ConvertFromString("#00ae00") as SolidColorBrush;
|
|
// }
|
|
// else if (StatusTyp == StatusType.Offline)
|
|
// {
|
|
// _color = new SolidColorBrush(Colors.Red);
|
|
// }
|
|
// else
|
|
// {
|
|
// _color = new SolidColorBrush(Colors.Orange);
|
|
// }
|
|
|
|
// OnPropertyChanged("Color");
|
|
// }
|
|
//}
|
|
|
|
//private Brush _colorType;
|
|
//public Brush ColorType
|
|
//{
|
|
// get
|
|
// {
|
|
// return _colorType;
|
|
// }
|
|
// set
|
|
// {
|
|
// if (TypeChat == ChatType.Team)
|
|
// {
|
|
// _colorType = new SolidColorBrush(Colors.DarkViolet);
|
|
// }
|
|
// else if (TypeChat == ChatType.Klienten)
|
|
// {
|
|
// _colorType = new SolidColorBrush(Colors.Blue);
|
|
// }
|
|
// else
|
|
// {
|
|
// _colorType = new SolidColorBrush(Colors.Green);
|
|
// }
|
|
|
|
// OnPropertyChanged("ColorType");
|
|
// }
|
|
//}
|
|
//public CompactCustomerDC Customer { get; set; }
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
protected virtual void OnPropertyChanged(string propertyName)
|
|
{
|
|
var handler = PropertyChanged;
|
|
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
}
|