Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/Chat
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
<Compile Include="ChatKlassen\AktuellerKontakt.cs" />
|
||||
<Compile Include="ChatKlassen\ChatControlExtensions.cs" />
|
||||
<Compile Include="ChatKlassen\KontaktlistBuilder.cs" />
|
||||
<Compile Include="ChatKlassen\KontaktMessageBuilder.cs" />
|
||||
<Compile Include="ChatKlassen\ChatMessage.cs" />
|
||||
<Compile Include="ChatKlassen\MessageCounter.cs" />
|
||||
<Compile Include="ChatMainControl.xaml.cs">
|
||||
<DependentUpon>ChatMainControl.xaml</DependentUpon>
|
||||
|
||||
329
ChatController/ChatKlassen/ChatMessage.cs
Normal file
329
ChatController/ChatKlassen/ChatMessage.cs
Normal file
@@ -0,0 +1,329 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ChatController.ChatKlassen
|
||||
{
|
||||
public class ChatMessage
|
||||
{
|
||||
//Chat Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
IsMyMessage = isme;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
if (IsHyperlink(message))
|
||||
{
|
||||
VisibilityRegelung("HyperlinkMessage");
|
||||
}
|
||||
else {
|
||||
VisibilityRegelung("Message");
|
||||
}
|
||||
}
|
||||
|
||||
// Image Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
ImageSources = image;
|
||||
IsMyMessage = isme;
|
||||
|
||||
OriginalImage = originalImage;
|
||||
OriginalImageName = imageName;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
VisibilityRegelung("Image");
|
||||
}
|
||||
|
||||
//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;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
IsMyMessage = isme;
|
||||
OriginalImage = originalImage;
|
||||
OriginalImageName = imageName;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
VisibilityRegelung("Default_Image");
|
||||
}
|
||||
|
||||
//Dokument Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string url)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
IsMyMessage = isme;
|
||||
|
||||
Dokpfad = (object) url;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
VisibilityRegelung("Dokumente");
|
||||
}
|
||||
|
||||
#region Farbgebung
|
||||
private void Farbgebung(bool isme)
|
||||
{
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
_farbeRechtsColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
|
||||
_farbeLinksColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#FFFFFF") as SolidColorBrush; //"#cccccc"
|
||||
Posi = "Left";
|
||||
_farbeRechtsColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
|
||||
_farbeLinksColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Visibility Regelung
|
||||
private void VisibilityRegelung(string Ansicht)
|
||||
{
|
||||
switch (Ansicht)
|
||||
{
|
||||
case "Message":
|
||||
ChatVisibility = Visibility.Visible;
|
||||
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_gifPictureVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
case "HyperlinkMessage":
|
||||
HyperlinkVisibility = Visibility.Visible;
|
||||
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_gifPictureVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
case "Image":
|
||||
_pictureVisibility = Visibility.Visible;
|
||||
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
case "Default_Image":
|
||||
_picturePlaceHolderVisibility = Visibility.Visible;
|
||||
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
case "Dokumente":
|
||||
DokumentVisibility = Visibility.Visible;
|
||||
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Hyperlink Detection
|
||||
|
||||
private static readonly Regex UrlRegex = new Regex(@"(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?");
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
else 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);
|
||||
|
||||
if (!uri.IsAbsoluteUri)
|
||||
{
|
||||
// rebuild it it with http to turn it into an Absolute URI
|
||||
uri = new Uri(@"http://" + word, UriKind.Absolute);
|
||||
}
|
||||
|
||||
if (uri.IsAbsoluteUri)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#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 UserTimeStringLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsMyMessage)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Username; //String.Format("{0} {1}", Username, SendTimeString);
|
||||
}
|
||||
}
|
||||
|
||||
public string UserTimeStringRight
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (!IsMyMessage)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
return 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 Brush ChatColor { get; private set; }
|
||||
|
||||
public string Posi { get; private set; }
|
||||
|
||||
public string OriginalImage { get; private set; }
|
||||
public string OriginalImageName { get; private set; }
|
||||
|
||||
public Visibility ChatVisibility { get; set; }
|
||||
public Visibility HyperlinkVisibility { get; set; }
|
||||
|
||||
|
||||
private Visibility _pictureVisibility;
|
||||
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
|
||||
|
||||
private Visibility _picturePlaceHolderVisibility;
|
||||
public Visibility PicturePlaceHolderVisibility { get { return _picturePlaceHolderVisibility; } set { _picturePlaceHolderVisibility = value; OnPropertyChanged("PicturePlaceHolderVisibility"); } }
|
||||
|
||||
private Visibility _gifPictureVisibility;
|
||||
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
|
||||
|
||||
|
||||
public Visibility DokumentVisibility { get; set; }
|
||||
public ImageSource ImageSources { get; private set; }
|
||||
public object Dokpfad { get; private set; }
|
||||
|
||||
public long? ChatMessageOid { get; private set; }
|
||||
|
||||
|
||||
//Farbe Links MEssageHeader
|
||||
private Brush _farbeLinksColor;
|
||||
public Brush FarbeLinksColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeLinksColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_farbeLinksColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeLinksColor");
|
||||
}
|
||||
}
|
||||
|
||||
//Farbe Rechts MessageHeader
|
||||
private Brush _farbeRechtsColor;
|
||||
public Brush FarbeRechtsColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeRechtsColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_farbeRechtsColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeRechtsColor");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,464 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ChatController.ChatKlassen
|
||||
{
|
||||
public class KontaktMessageBuilder
|
||||
{
|
||||
|
||||
public string OriginalImage { get; private set; }
|
||||
|
||||
//Chat Ansicht
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, DateTime convertedSendTimeString)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
if (IsHyperlink(message))
|
||||
{
|
||||
HyperlinkVisibility = Visibility.Visible;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
}
|
||||
else {
|
||||
ChatVisibility = Visibility.Visible;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
_gifPictureVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// IMage Ansicht
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, ImageSource image, DateTime convertedSendTimeString,string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
ImageSources = image;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
OriginalImage = originalImage;
|
||||
OriginalImageName = imageName;
|
||||
// Dokpfad =
|
||||
Farbgebung(isme);
|
||||
|
||||
//if (!isGif)
|
||||
//{
|
||||
_pictureVisibility = Visibility.Visible;
|
||||
//_gifPictureVisibility = Visibility.Collapsed;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// _pictureVisibility = Visibility.Collapsed;
|
||||
// _gifPictureVisibility = Visibility.Visible;
|
||||
//}
|
||||
|
||||
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
|
||||
//Konstruktor PlaceHolder
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, DateTime convertedSendTimeString, string originalImage, string imageName)
|
||||
{
|
||||
|
||||
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
OriginalImage = originalImage;
|
||||
OriginalImageName = imageName;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
|
||||
_picturePlaceHolderVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
//Dokument Ansicht
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, string url, DateTime convertedSendTimeString)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
|
||||
Dokpfad = (object) url;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
|
||||
DokumentVisibility = Visibility.Visible;
|
||||
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
|
||||
private void Farbgebung(bool isme)
|
||||
{
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
_farbeRechtsColor = new BrushConverter().ConvertFromString("#636363") as SolidColorBrush;
|
||||
_farbeLinksColor = new BrushConverter().ConvertFromString("#636363") as SolidColorBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#FFFFFF") as SolidColorBrush; //"#cccccc"
|
||||
Posi = "Left";
|
||||
_farbeRechtsColor = new BrushConverter().ConvertFromString("#A0A0A0") as SolidColorBrush;
|
||||
_farbeLinksColor = new BrushConverter().ConvertFromString("#A0A0A0") as SolidColorBrush;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Hyperlink Detection
|
||||
|
||||
private static readonly Regex UrlRegex = new Regex(@"(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?");
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
else 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);
|
||||
|
||||
if (!uri.IsAbsoluteUri)
|
||||
{
|
||||
// rebuild it it with http to turn it into an Absolute URI
|
||||
uri = new Uri(@"http://" + word, UriKind.Absolute);
|
||||
}
|
||||
|
||||
if (uri.IsAbsoluteUri)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region kram der sortiert werden muss
|
||||
//Alter Kram
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, long messagePersonOid, bool isme, bool loadnext, object loadObject)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
MessagePersonOid = messagePersonOid;
|
||||
|
||||
if (messagePersonOid == 0 && !loadnext)
|
||||
{
|
||||
ChatColor = new SolidColorBrush(Colors.AliceBlue); //CornflowerBlue
|
||||
Posi = "Center";
|
||||
}
|
||||
else
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
|
||||
Posi = "Left";
|
||||
}
|
||||
|
||||
|
||||
if (loadnext)
|
||||
{
|
||||
Posi = "Right";
|
||||
LoadNextVisibility = Visibility.Visible;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
LoadObject = loadObject;
|
||||
MainVisibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadNextVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Visible;
|
||||
LoadObject = null;
|
||||
MainVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, long messagePersonOid, bool isme,
|
||||
bool isSoundDatei, bool isPicDatei, bool isDokument, ImageSource source, string fulldokpfad, byte[] dokarray, bool isHerunterladen, object[] herunterladbares, long? chatMessageOid)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
MessagePersonOid = messagePersonOid;
|
||||
ChatMessageOid = chatMessageOid;
|
||||
|
||||
|
||||
if (isme && messagePersonOid == 0)
|
||||
{
|
||||
ChatColor = new SolidColorBrush(Colors.CornflowerBlue);
|
||||
Posi = "Center";
|
||||
}
|
||||
else if (isme)
|
||||
{
|
||||
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
|
||||
Posi = "Left";
|
||||
}
|
||||
|
||||
if (isSoundDatei)
|
||||
{
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Visible;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
else if (isDokument)
|
||||
{
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Visible;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
else if (isPicDatei && source != null)
|
||||
{
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Visible;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
}
|
||||
else if (isHerunterladen)
|
||||
{
|
||||
_herunterladen = Visibility.Visible;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatVisibility = Visibility.Visible;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (source != null)
|
||||
{
|
||||
ImageSources = source;
|
||||
}
|
||||
|
||||
|
||||
//Dokument
|
||||
object[] array1 = new object[3];
|
||||
|
||||
if (fulldokpfad != null && chatMessageOid == 0)
|
||||
{
|
||||
Dokpfad = fulldokpfad;
|
||||
}
|
||||
else if (chatMessageOid > 0 && fulldokpfad != null)
|
||||
{
|
||||
array1[0] = fulldokpfad;
|
||||
array1[1] = dokarray;
|
||||
array1[2] = chatMessageOid;
|
||||
|
||||
Dokpfad = array1;
|
||||
}
|
||||
|
||||
|
||||
if (herunterladbares != null)
|
||||
{
|
||||
Herunterladbares = herunterladbares;
|
||||
}
|
||||
|
||||
//array übergabe für Sound ermöglichen
|
||||
SoundArray = null;
|
||||
LoadNextVisibility = Visibility.Collapsed;
|
||||
MainVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public string Username { get; private set; }
|
||||
public string UserMessage { get; private set; }
|
||||
public string SendTime { get; private set; }
|
||||
public long MessagePersonOid { get; private set; }
|
||||
public Brush ChatColor { get; private set; }
|
||||
public int ChatPosition { get; private set; }
|
||||
public string Posi { get; private set; }
|
||||
public string OriginalImageName { get; private set; }
|
||||
|
||||
public DateTime InternalSendTime { get; set; }
|
||||
|
||||
public Visibility MainVisibility { get; set; }
|
||||
public Visibility ChatVisibility { get; set; }
|
||||
public Visibility HyperlinkVisibility { get; set; }
|
||||
|
||||
public Visibility LoadNextVisibility { get; set; }
|
||||
public object LoadObject { get; set; }
|
||||
|
||||
public Visibility SoundVisibility { get; set; }
|
||||
|
||||
private Visibility _pictureVisibility;
|
||||
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
|
||||
|
||||
private Visibility _picturePlaceHolderVisibility;
|
||||
public Visibility PicturePlaceHolderVisibility { get { return _picturePlaceHolderVisibility; } set { _picturePlaceHolderVisibility = value; OnPropertyChanged("PicturePlaceHolderVisibility"); } }
|
||||
|
||||
private Visibility _gifPictureVisibility;
|
||||
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
|
||||
|
||||
|
||||
public Visibility DokumentVisibility { get; set; }
|
||||
public ImageSource ImageSources { get; private set; }
|
||||
public object Dokpfad { get; private set; }
|
||||
public byte[] SoundArray { get; private set; }
|
||||
|
||||
public long? ChatMessageOid { get; private set; }
|
||||
|
||||
private Visibility _herunterladen;
|
||||
public Visibility Herunterladen
|
||||
{
|
||||
get { return _herunterladen; }
|
||||
set { _herunterladen = value; OnPropertyChanged("Herunterladen"); }
|
||||
}
|
||||
|
||||
public object[] Herunterladbares { get; private set; }
|
||||
|
||||
|
||||
//Farbe Links MEssageHeader
|
||||
private Brush _farbeLinksColor;
|
||||
public Brush FarbeLinksColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeLinksColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_farbeLinksColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeLinksColor");
|
||||
}
|
||||
}
|
||||
|
||||
//Farbe Rechts MessageHeader
|
||||
private Brush _farbeRechtsColor;
|
||||
public Brush FarbeRechtsColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeRechtsColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_farbeRechtsColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeRechtsColor");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,20 +18,26 @@ namespace ChatController.ChatKlassen
|
||||
{
|
||||
get
|
||||
{
|
||||
var WordsArray = _receiveMs.Split();
|
||||
|
||||
//var verkuerzterText = _receiveMs.Substring(0,10);
|
||||
if (WordsArray.Length > 4)
|
||||
if (!String.IsNullOrEmpty(_receiveMs) && _receiveMs.Length > 25)
|
||||
{
|
||||
string Items = WordsArray[0] + " " + WordsArray[1] + " " + WordsArray[2] + " " + WordsArray[3] + "...";
|
||||
return _receiveMs.Substring(0, 25) + "...";
|
||||
}
|
||||
return _receiveMs;
|
||||
|
||||
//var WordsArray = _receiveMs.Split();
|
||||
|
||||
return Items;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if(_receiveMs.Length > 15)
|
||||
return _receiveMs;
|
||||
}
|
||||
////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
|
||||
@@ -104,6 +110,13 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
public KontaktlistBuilder(string name, ImageSource image, string lastMs, DateTime timestamp, long groupid,long? customerPersonOid,bool onlyEmployee, int userCount)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
//lastMs =
|
||||
// "aas dgfal Dies ist ein laaaaaanger Text !Q!!! adg asgl sadlg jasg jas,g ans,g nasgd., a ag fdgg agsd g";
|
||||
//name = "Hans Hubert Christopherus Maximilian Schumacherus";
|
||||
#endif
|
||||
|
||||
Name = name;
|
||||
ReceiveMs = lastMs;
|
||||
Image = image;
|
||||
@@ -112,6 +125,10 @@ namespace ChatController.ChatKlassen
|
||||
CustomerPersonOid = customerPersonOid;
|
||||
SetzeGelesen = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (CustomerPersonOid != null)
|
||||
{
|
||||
_kontaktChatColor = new BrushConverter().ConvertFromString("#3B7799") as SolidColorBrush;
|
||||
|
||||
@@ -5,181 +5,216 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ChatController"
|
||||
mc:Ignorable="d" x:Name="ChatControlling"
|
||||
d:DesignHeight="300" d:DesignWidth="300" >
|
||||
d:DesignHeight="300" d:DesignWidth="600"
|
||||
SnapsToDevicePixels="True" >
|
||||
<UserControl.Resources>
|
||||
<SolidColorBrush x:Key="DarkBackColor" Color="#FFA9B8C2" />
|
||||
<SolidColorBrush x:Key="LightBackColor" Color="#E8EFF4" />
|
||||
<SolidColorBrush x:Key="ButtonForeground" Color="#ff5e00" />
|
||||
|
||||
|
||||
<Style x:Key="MainNavigationScrollViewer" TargetType="{x:Type ScrollViewer}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ScrollViewer}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ScrollContentPresenter Grid.Column="0"/>
|
||||
|
||||
<ScrollBar Name="PART_VerticalScrollBar"
|
||||
Value="{TemplateBinding VerticalOffset}"
|
||||
Maximum="{TemplateBinding ScrollableHeight}"
|
||||
ViewportSize="{TemplateBinding ViewportHeight}"
|
||||
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
|
||||
Grid.Column="1"/>
|
||||
<ScrollBar Name="PART_HorizontalScrollBar"
|
||||
Orientation="Horizontal"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Value="{TemplateBinding HorizontalOffset}"
|
||||
Maximum="{TemplateBinding ScrollableWidth}"
|
||||
ViewportSize="{TemplateBinding ViewportWidth}"
|
||||
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
|
||||
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<ControlTemplate x:Key="ContactListBoxTemplate" TargetType="{x:Type ListBox}">
|
||||
<Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}" Style="{StaticResource MainNavigationScrollViewer}" HorizontalScrollBarVisibility="Disabled">
|
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
<Style x:Key="ContactListStyle" TargetType="{x:Type ListBox}">
|
||||
<Setter Property="Template" Value="{StaticResource ContactListBoxTemplate}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ContactListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Grid>
|
||||
<Border x:Name="ItemBorder" MinHeight="20" Background="White" BorderThickness="0,0,0,1" BorderBrush="{StaticResource LightBackColor}">
|
||||
|
||||
</Border>
|
||||
<Border x:Name="ItemContent" MinHeight="20">
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="7"/>
|
||||
<ColumnDefinition Width="35"/>
|
||||
<ColumnDefinition Width="7"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="7"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<Ellipse Grid.Column="1" Width='32' Height='32' RenderOptions.BitmapScalingMode="HighQuality">
|
||||
<Ellipse.Fill>
|
||||
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill' RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
|
||||
|
||||
<Grid Grid.Column="3" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" Foreground="{Binding Path=KontaktChatColor}" FontSize="16" Margin="1" />
|
||||
|
||||
<TextBlock Text="{Binding Path=ReceiveMs}" Grid.Row="1" FontSize="14" Foreground="{Binding Path=Color}" Margin="1" />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" />
|
||||
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="ListBoxItem.IsSelected" Value="True">
|
||||
<Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" />
|
||||
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="ListBoxItem.IsSelected" Value="True" />
|
||||
<Condition Property="Selector.IsSelectionActive" Value="False" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" />
|
||||
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<ControlTemplate x:Key="SearchTextBoxTemplate" TargetType="{x:Type TextBox}">
|
||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="2,2,2,2">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer Grid.Column="1" x:Name="PART_ContentHost" Margin="0,2,0,0" />
|
||||
<Canvas Grid.Column="0" Width="14" Margin="3,4,2,2">
|
||||
<Ellipse Stroke="#FFA0A0A0" Height="10" Width="10" StrokeThickness="2" Fill="{x:Null}" />
|
||||
<Line Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFA0A0A0" Canvas.Left="6" Canvas.Top="7.4" Y1="0" Y2="5" StrokeThickness="3" X2="4" />
|
||||
|
||||
|
||||
</Canvas>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
|
||||
<Border x:Name="rootGroupBox" Background="#F3F3F3" BorderThickness="0">
|
||||
<Border x:Name="rootBorder" Background="{StaticResource DarkBackColor}" Padding="0" Margin="0" BorderThickness="0">
|
||||
<!--Style="{DynamicResource MainContentGroupBoxWithoutMaximizeBtnStyle}"-->
|
||||
<Grid >
|
||||
<!--Background="{StaticResource ObjectEditBackgroundBrush}"-->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2.7*" MaxWidth="250" />
|
||||
<ColumnDefinition Width="7.2*"/>
|
||||
<ColumnDefinition Width="250" />
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<!-- ########################## Linkes panel ########################### -->
|
||||
<Grid Grid.Column="0" Grid.Row="0" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.8*"/>
|
||||
<RowDefinition Height="9.20*"/>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="0" Grid.Row="0" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="3*"/>
|
||||
<RowDefinition Height="5*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="8*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left" Visibility="Collapsed">
|
||||
<Label Content="Mein Status: " MaxWidth="80"/>
|
||||
<RadioButton GroupName="status" x:Name="RadioButtonOnline" BorderBrush="Green" MaxWidth="15" ToolTip="Online" VerticalAlignment="Center" Foreground="Green"/>
|
||||
//Checked="ComboBox_SelectionChanged"
|
||||
<RadioButton GroupName="status" x:Name="RadioButtonOffline" BorderBrush="Red" MaxWidth="15" ToolTip="Offline" VerticalAlignment="Center" Foreground="Red"/>
|
||||
//Checked="ComboBox_SelectionChanged"
|
||||
<RadioButton GroupName="status" x:Name="RadioButtonBeschaeftigt" BorderBrush="DarkOrange" MaxWidth="15" ToolTip="Beschäftigt" VerticalAlignment="Center" Foreground="DarkOrange"/>
|
||||
//Checked="ComboBox_SelectionChanged"
|
||||
</StackPanel> / Style="{DynamicResource IconButtonStyle}" /-->
|
||||
|
||||
<StackPanel x:Name="ReloadGruppen" Grid.Row="0" Grid.Column="1" MinHeight="25" MaxWidth="25" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Collapsed" Margin="0,-2,0,-2">
|
||||
<StackPanel x:Name="ReloadGruppen" Grid.Row="0" Grid.Column="1" Height="25" Width="25" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Visibility="Visible" Margin="0,0,3,0">
|
||||
<Button Background="Transparent" HorizontalAlignment="Right" BorderThickness="0" VerticalAlignment="Center" VerticalContentAlignment="Center" Width="25" Height="25" Click="ButtonReloadGruppen_OnClick" >
|
||||
<Image ToolTip="Gruppen Aktualisieren" Width="20" Height="20" Source="pack://application:,,,/ChatController;component/Ressourcen/SymbolRefresh32.png" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" />
|
||||
<Image ToolTip="Gruppen Aktualisieren" Margin="0,0,0,0" Width="20" Height="20" Source="pack://application:,,,/ChatController;component/Ressourcen/SymbolRefresh32.png" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!-- <StackPanel Grid.Row="0" MaxWidth="20" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Collapsed">
|
||||
<Button Style="{DynamicResource IconButtonStyle}" x:Name="ButtonSortLabel" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" VerticalAlignment="Center" Width="20" Height="20" >
|
||||
Click="ButtonSortLabel_OnClick"-->
|
||||
<!-- <Image x:Name="SortLabel" ToolTip="Sortierung ändern" Source="pack://application:,,,/Ressources/icons/unsortiert.png" />
|
||||
</Button>
|
||||
</StackPanel>-->
|
||||
|
||||
<!-- KeyDown="Suche_OnKeyDown" TextChanged="Suche_OnTextChanged" -->
|
||||
<Label Grid.Row="0" Grid.Column="0" MinHeight="25">Suche:</Label>
|
||||
<!-- <GroupBox Grid.Column="0" Grid.Row="1" Header="Suche:" Style="{x:Null}"> -->
|
||||
<TextBox x:Name="Suche" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="3,3,3,3" MinHeight="25" Height="25" VerticalContentAlignment="Center" TextChanged="Suche_OnTextChanged" VerticalAlignment="Top" ToolTip="Suchen Sie hier nach einem Kontakt in der Liste" >
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="4"/>
|
||||
<Setter Property="Padding" Value="5,5,5,5" />
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
</TextBox>
|
||||
<!-- </GroupBox> -->
|
||||
|
||||
<TextBox x:Name="Suche" Height="22" HorizontalAlignment="Stretch" Margin="5" TabIndex="0" Template="{DynamicResource SearchTextBoxTemplate}" BorderThickness="0,0,0,0" TextChanged="Suche_OnTextChanged" />
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid Grid.Column="0" Grid.Row="1" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--###################################### Liste aller User ###################################################### -->
|
||||
<ListView x:Name="Clientlist" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" Margin="3" Style="{DynamicResource ResourceKey=styleListBox}" ItemTemplate="{DynamicResource DataTemplate1}" SelectionChanged="Clientlist_OnSelectionChanged" >
|
||||
<ListView.Resources>
|
||||
<DataTemplate x:Key="DataTemplate1">
|
||||
<Grid Margin="7,0,0,0" x:Name="GridMargin">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="35"/>
|
||||
<ColumnDefinition Width="7"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="25"/>
|
||||
<ColumnDefinition Width="12"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<Border BorderThickness="0.25" CornerRadius="3" Grid.RowSpan="2" Grid.ColumnSpan="5" Background="White" >
|
||||
<Border.BorderBrush>
|
||||
<SolidColorBrush Color="Black" />
|
||||
</Border.BorderBrush>
|
||||
</Border>
|
||||
|
||||
<Ellipse Width='30' Height='30' RenderOptions.BitmapScalingMode="HighQuality">
|
||||
<Ellipse.Fill>
|
||||
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill' RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
|
||||
<!-- <StackPanel Grid.Column="1" Height="30" > Online status anzeige
|
||||
<Ellipse Width='7' Height='7' Fill="{Binding Path=Color}" Margin="-23,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Fill" />
|
||||
</StackPanel>-->
|
||||
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Margin="1" >
|
||||
<StackPanel Orientation="Horizontal" TextBlock.FontSize="14" >
|
||||
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" Foreground="{Binding Path=KontaktChatColor}" />
|
||||
</StackPanel>
|
||||
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
|
||||
</StackPanel>
|
||||
|
||||
<!--Für die anzeige der anzahl ungelesener Nachrichten Height="30" FontWeight="Bold"-->
|
||||
<StackPanel Margin="1" Grid.Row="1">
|
||||
<TextBlock Text="{Binding Path=ReceiveMs}" FontSize="11" Foreground="{Binding Path=Color}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Column="4" Margin="7,0,0,0">
|
||||
<Rectangle Fill="{Binding Path=ColorType}" Stretch="Fill" Height="30" Width="2" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.Resources>
|
||||
|
||||
<!--Uberschríft Mitarbeiter, ItemCount-->
|
||||
<ListView.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.ContainerStyle>
|
||||
<Style TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Expander IsExpanded="True">
|
||||
<Expander.Header>
|
||||
<StackPanel Orientation="Horizontal" >
|
||||
<TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="Black" FontSize="18" VerticalAlignment="Bottom" Width="148" />
|
||||
<TextBlock Text="{Binding ItemCount}" FontSize="12" Foreground="Black" FontWeight="Bold" Margin="10,0,0,1" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
|
||||
</StackPanel>
|
||||
</Expander.Header>
|
||||
<ItemsPresenter />
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</GroupStyle.ContainerStyle>
|
||||
</GroupStyle>
|
||||
</ListView.GroupStyle>
|
||||
|
||||
<!-- <ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle> -->
|
||||
<ListView x:Name="Clientlist" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" BorderThickness="0" Background="White"
|
||||
ItemContainerStyle="{StaticResource ContactListBoxItemStyle}" SelectionChanged="Clientlist_OnSelectionChanged" Style="{StaticResource ContactListStyle}">
|
||||
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Grid>
|
||||
@@ -189,39 +224,34 @@
|
||||
<!-- ####################### Rechtes Panel ################################-->
|
||||
<Grid Grid.Column="1" Grid.Row="0" x:Name="GridRechts">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.80*"/>
|
||||
<RowDefinition Height="8.45*" />
|
||||
<RowDefinition Height="0.75*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<ListBox x:Name="AktChatUser" HorizontalAlignment="Left" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<ListBox x:Name="AktChatUserList" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
|
||||
<ListBox.Resources>
|
||||
<DataTemplate x:Key="DataTemplate2">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Ellipse Width='30' Height='30' VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
|
||||
<Ellipse Width='40' Height='40' VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
|
||||
<Ellipse.Fill >
|
||||
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill'/>
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
|
||||
<StackPanel Grid.Column="1" Margin="5" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" TextBlock.FontWeight="Bold" >
|
||||
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" />
|
||||
</StackPanel>
|
||||
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
|
||||
</StackPanel>
|
||||
<TextBlock Grid.Column="1" Margin="8" Text="{Binding Path=Name, FallbackValue=FirstName}" FontSize="16" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.Resources>
|
||||
@@ -229,31 +259,25 @@
|
||||
|
||||
|
||||
<!--##### Chat Bereich ####-->
|
||||
<ListBox x:Name="Chat" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Margin="3" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged" Background="#F3F3F3"
|
||||
ContextMenuOpening="Chat_OnContextMenuOpening">
|
||||
<ListBox x:Name="ChatListBox" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" BorderThickness="0"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged" Background="{StaticResource LightBackColor}"
|
||||
ContextMenuOpening="Chat_OnContextMenuOpening" Padding="20">
|
||||
<!--MouseRightButtonDown="OnRightClickEvent"-->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalAlignment" Value="{Binding Posi}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
<Setter Property="Padding" Value="10,0,0,0" />
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
|
||||
<Border BorderBrush="{Binding ChatColor}" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="{Binding ChatColor}" Visibility="{Binding MainVisibility}" >
|
||||
<DockPanel MinHeight="15" Margin="5" LastChildFill="True" Background="{Binding ChatColor}" Visibility="{Binding MainVisibility}" >
|
||||
<Border BorderBrush="{Binding ChatColor}" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="{Binding ChatColor}" >
|
||||
<DockPanel MinHeight="15" Margin="5" LastChildFill="True" Background="{Binding ChatColor}" >
|
||||
|
||||
<!-- Message Bereich -->
|
||||
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ChatVisibility}" >
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" FontSize="14"/>
|
||||
<!-- <RichTextBox VerticalAlignment="Center" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" local:RichTextBoxHelper.DocumentXaml="{Binding UserMessage}" MinWidth="0" MaxWidth="500" />-->
|
||||
</StackPanel>
|
||||
|
||||
@@ -261,7 +285,7 @@
|
||||
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding HyperlinkVisibility}" >
|
||||
<TextBlock>
|
||||
<Hyperlink NavigateUri="{Binding UserMessage}" RequestNavigate="Hyperlink_OnRequestNavigate" >
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" FontSize="14"/>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<!-- <RichTextBox VerticalAlignment="Center" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" local:RichTextBoxHelper.DocumentXaml="{Binding UserMessage}" MinWidth="0" MaxWidth="500" />-->
|
||||
@@ -271,9 +295,10 @@
|
||||
<!-- Bild bereich MaxHeight="200" MaxWidth="300" Stretch uniform-->
|
||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<Image MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" x:Name="imgChatMessage" Stretch="None"/>
|
||||
|
||||
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14"/>
|
||||
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
@@ -281,9 +306,9 @@
|
||||
<!-- Image Placeholder -->
|
||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PicturePlaceHolderVisibility}" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Source="pack://application:,,,/ChatController;component/Ressourcen/ClipboardDisabled.png" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<Image Source="pack://application:,,,/ChatController;component/Ressourcen/ClipboardDisabled.png" Stretch="None" />
|
||||
|
||||
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
@@ -291,9 +316,9 @@
|
||||
<!-- Gif BEreich ?? <MediaElement Source="" ></MediaElement> villeicht gif erstmal runterladen und dann den pfad ausgeben ? 200
|
||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding GifPictureVisibility}" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<MediaElement LoadedBehavior="Play" UnloadedBehavior="Manual" MediaFailed="MediaElement_OnMediaFailed" MediaEnded="MediaElement_OnMediaEnded" Source="{Binding UserMessage}" Stretch="Uniform" MaxHeight="200" MaxWidth="300" >
|
||||
<MediaElement LoadedBehavior="Play" UnloadedBehavior="Manual" MediaFailed="MediaElement_OnMediaFailed" MediaEnded="MediaElement_OnMediaEnded" Source="{Binding ImageSources}" Stretch="Uniform" MaxHeight="200" MaxWidth="300" >
|
||||
<MediaElement.OpacityMask>
|
||||
<ImageBrush ImageSource="{Binding UserMessage}"/>
|
||||
<ImageBrush ImageSource="{Binding ImageSources}"/>
|
||||
</MediaElement.OpacityMask>
|
||||
</MediaElement>
|
||||
|
||||
@@ -307,7 +332,7 @@
|
||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image ToolTip="Dokument öffnen" Height="100" Width="150" Source="pack://application:,,,/ChatController;component/Ressourcen/ClipboardDisabled.png" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}"/>
|
||||
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}" FontSize="14"/>
|
||||
<!-- <Button HorizontalAlignment="Center" VerticalAlignment="Center" Content="Dokument Anzeigen" Height="25" Tag="{Binding Dokpfad}" Click="OpenDokument_OnClick " >
|
||||
<Button.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
@@ -321,12 +346,15 @@
|
||||
|
||||
|
||||
|
||||
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
|
||||
<TextBlock Text="{Binding Username}" FontSize="8" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeLinksColor}" />
|
||||
</StackPanel>
|
||||
|
||||
<!--<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
|
||||
<TextBlock Text="{Binding Username}" FontSize="11" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeLinksColor}" />
|
||||
</StackPanel>-->
|
||||
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,0" >
|
||||
<TextBlock Text="{Binding UserTimeStringLeft}" MaxWidth="350" FontSize="11" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel DockPanel.Dock="Right" Margin="5,0,0,5" >
|
||||
<TextBlock Text="{Binding SendTime}" MaxWidth="350" FontSize="8" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" />
|
||||
<TextBlock Text="{Binding UserTimeStringRight}" MaxWidth="350" FontSize="11" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" />
|
||||
</StackPanel>
|
||||
|
||||
</DockPanel>
|
||||
@@ -337,28 +365,27 @@
|
||||
</ListBox>
|
||||
|
||||
|
||||
<Grid Grid.Row="2" Margin="3,0,3,3" >
|
||||
<Grid Grid.Row="2" Margin="10" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="8.5*"/>
|
||||
<ColumnDefinition Width=".5*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Column="0" Grid.ColumnSpan="2" MinHeight="25">
|
||||
<Grid Grid.Column="0" MinHeight="25" Margin="0,0,3,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="9*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox x:Name="Chatbox" HorizontalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="Nachricht schreiben" VerticalScrollBarVisibility="Hidden" MaxLines="5" MaxHeight="70" Visibility="Visible"
|
||||
VerticalContentAlignment="Center" MinHeight="25" Padding="10,0,60,0" ToolTip="Schreiben Sie hier eine Nachricht hinein" Foreground="DarkGray" VerticalAlignment="Bottom" GotFocus="Chatbox_OnGotFocus" KeyDown="Chatbox_OnKeyDownHandler">
|
||||
<TextBox x:Name="Chatbox" HorizontalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="Nachricht schreiben" VerticalScrollBarVisibility="Hidden" MaxHeight="200" Visibility="Visible" BorderThickness="0,0,0,0"
|
||||
VerticalContentAlignment="Center" MinHeight="25" Padding="10,0,60,0" ToolTip="Schreiben Sie hier eine Nachricht hinein" Foreground="DarkGray" VerticalAlignment="Center" GotFocus="Chatbox_OnGotFocus" KeyDown="Chatbox_OnKeyDownHandler">
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
<Setter Property="CornerRadius" Value="2"/>
|
||||
<!-- <Setter Property="Padding" Value="10,0,60,0" />-->
|
||||
</Style>
|
||||
</TextBox.Resources>
|
||||
@@ -366,12 +393,12 @@
|
||||
|
||||
<!-- StackPanel Zur test zwecken Style="{x:Null}"-->
|
||||
<StackPanel Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Orientation="Horizontal">
|
||||
<Button Grid.Column="1" Margin="1,0,0,0" x:Name="MediaButton" Background="Transparent" Width="25" BorderThickness="0" VerticalAlignment="Bottom" ToolTip="Datei einfügen" Click="MediaButton_OnClick" >
|
||||
<Image Height="15" Width="15" Source='pack://application:,,,/ChatController;component/Ressourcen/paperclip2.png' Margin="3" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center"/>
|
||||
<Button Grid.Column="1" Margin="1,0,0,0" x:Name="MediaButton" Background="Transparent" Height="25" Width="28" BorderThickness="0" Padding="0" VerticalAlignment="Bottom" ToolTip="Datei einfügen" Click="MediaButton_OnClick" >
|
||||
<Image Height="22" Width="22" Source='pack://application:,,,/ChatController;component/Ressourcen/paperclip2.png' RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center"/>
|
||||
</Button>
|
||||
|
||||
<Button Grid.Column="2" Width="25" BorderThickness="0" Background="Transparent" x:Name="EmojiButton" Margin="2,0,0,0" VerticalAlignment="Bottom" ToolTip="Emoji einfügen" Click="EmojiButton_OnClick">
|
||||
<Image Height="15" Width="15" Source='pack://application:,,,/ChatController;component/Ressourcen/glucklicher.png' Margin="3" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" />
|
||||
<Button Grid.Column="2" Width="28" Height="25" BorderThickness="0" Background="Transparent" x:Name="EmojiButton" Margin="2,0,0,0" Padding="0" VerticalAlignment="Bottom" ToolTip="Emoji einfügen" Click="EmojiButton_OnClick">
|
||||
<Image Height="24" Width="24" Source='pack://application:,,,/ChatController;component/Ressourcen/glucklicher.png' RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -379,7 +406,7 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<Button x:Name="SendButton" Content="Senden" HorizontalAlignment="Stretch" Margin="2,0,0,0" Grid.Column="2" VerticalAlignment="Bottom" Click="SendButton_OnClick" Background="#ff5e00" Height="25" >
|
||||
<Button x:Name="SendButton" Content=" Senden " HorizontalAlignment="Stretch" Margin="2,0,0,0" Grid.Column="2" VerticalAlignment="Bottom" Click="SendButton_OnClick" Background="{StaticResource ButtonForeground}" Height="25" >
|
||||
<Button.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ChatController
|
||||
|
||||
private ChatEmojiiControl _emojiView;
|
||||
|
||||
private IOrderedEnumerable<KontaktMessageBuilder> _Orderedmessagelist;
|
||||
private IOrderedEnumerable<ChatMessage> _Orderedmessagelist;
|
||||
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
|
||||
|
||||
private ChatDatenUebergabe _chatDaten;
|
||||
@@ -49,7 +49,7 @@ namespace ChatController
|
||||
private bool scrollPrueferAktivieren = false;
|
||||
|
||||
public Thread newThread;
|
||||
public bool threadBool = true;
|
||||
public bool disableKontaktNachrichtenThread = true;
|
||||
|
||||
public Thread AlleKontakteThread;
|
||||
public bool AlleNachrichtenThreadBool = true;
|
||||
@@ -68,6 +68,7 @@ namespace ChatController
|
||||
public ChatMainControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
ReloadGruppen.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public void InitMitChatdaten(ChatDatenUebergabe cdu)
|
||||
@@ -90,9 +91,9 @@ namespace ChatController
|
||||
|
||||
public AktuellerKontakt GetAktuellenKontakt()
|
||||
{
|
||||
if (AktChatUser != null)
|
||||
if (AktChatUserList != null)
|
||||
{
|
||||
var kontakt = (AktuellerKontakt) AktChatUser.Items[0];
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
if (kontakt.CustomerPersonOid == null)
|
||||
{
|
||||
@@ -107,13 +108,13 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
|
||||
public List<KontaktMessageBuilder> GetSelectedMessages()
|
||||
public List<ChatMessage> GetSelectedMessages()
|
||||
{
|
||||
List<KontaktMessageBuilder> itemListe = new List<KontaktMessageBuilder>();
|
||||
List<ChatMessage> itemListe = new List<ChatMessage>();
|
||||
|
||||
foreach (Object selecteditem in Chat.SelectedItems)
|
||||
foreach (Object selecteditem in ChatListBox.SelectedItems)
|
||||
{
|
||||
KontaktMessageBuilder Item = selecteditem as KontaktMessageBuilder;
|
||||
ChatMessage Item = selecteditem as ChatMessage;
|
||||
|
||||
//if (Item.MessagePersonOid == 0)
|
||||
//{
|
||||
@@ -151,13 +152,13 @@ namespace ChatController
|
||||
{
|
||||
if(Clientlist.SelectedItem != null)
|
||||
{
|
||||
// StartWaiting();
|
||||
// StartWaiting();
|
||||
disableKontaktNachrichtenThread = true;
|
||||
Cursor = Cursors.Wait;
|
||||
scrollPrueferAktivieren = false;
|
||||
ChatListBox.ItemsSource = null;
|
||||
|
||||
Cursor = Cursors.Wait;
|
||||
scrollPrueferAktivieren = false;
|
||||
Chat.ItemsSource = null;
|
||||
|
||||
AktChatUser.Items.Clear();
|
||||
AktChatUserList.Items.Clear();
|
||||
|
||||
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
|
||||
|
||||
@@ -169,24 +170,24 @@ namespace ChatController
|
||||
|
||||
var aktuellerKontakt = new AktuellerKontakt(kontakt);
|
||||
|
||||
AktChatUser.Items.Add(aktuellerKontakt);
|
||||
AktChatUserList.Items.Add(aktuellerKontakt);
|
||||
_aktuellerKontakt = aktuellerKontakt;
|
||||
|
||||
var x = _chat.LadeChatNachrichtenVomKontakt(aktuellerKontakt);
|
||||
|
||||
Chat.ItemsSource = x;
|
||||
ChatListBox.ItemsSource = x;
|
||||
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
Chat.ContextMenu = _chat.ErstelleKontextMenue();
|
||||
ChatListBox.ContextMenu = _chat.ErstelleKontextMenue();
|
||||
SetContextHandler();
|
||||
scrollPrueferAktivieren = true;
|
||||
|
||||
HorcheAktivNachNachrichten();
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
// EndWaiting();
|
||||
disableKontaktNachrichtenThread = false;
|
||||
// EndWaiting();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -195,7 +196,7 @@ namespace ChatController
|
||||
//ab Hier Kontext Menü
|
||||
private void SetContextHandler()
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
|
||||
foreach (var menuItemText in menuItemName2Callback.Keys)
|
||||
{
|
||||
@@ -229,9 +230,9 @@ namespace ChatController
|
||||
|
||||
private void Item2OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
foreach (var items in Chat.SelectedItems)
|
||||
foreach (var items in ChatListBox.SelectedItems)
|
||||
{
|
||||
var item = (KontaktMessageBuilder)items;
|
||||
var item = (ChatMessage)items;
|
||||
|
||||
_chat.SpeichernUnterFunkion(item);
|
||||
}
|
||||
@@ -239,16 +240,16 @@ namespace ChatController
|
||||
|
||||
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
_chat.Einfuegen(kontakt.GroupId,this);
|
||||
}
|
||||
|
||||
private void Item4OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
string chatmessages = "";
|
||||
foreach (var items in Chat.SelectedItems)
|
||||
foreach (var items in ChatListBox.SelectedItems)
|
||||
{
|
||||
var item = (KontaktMessageBuilder)items;
|
||||
var item = (ChatMessage)items;
|
||||
|
||||
chatmessages += item.UserMessage + "\n";
|
||||
}
|
||||
@@ -259,35 +260,35 @@ namespace ChatController
|
||||
|
||||
private void Chat_OnContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
{
|
||||
var chatItems = Chat.SelectedItems;
|
||||
var chatItems = ChatListBox.SelectedItems;
|
||||
|
||||
if (chatItems.Count > 0)
|
||||
{
|
||||
foreach (var items in chatItems)
|
||||
{
|
||||
var item = items as KontaktMessageBuilder;
|
||||
var item = items as ChatMessage;
|
||||
if (item != null && item.ImageSources != null)
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[0];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[0];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if (item.ImageSources == null && item.Dokpfad == null)
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem) contextItems[2];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[2];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
@@ -298,7 +299,7 @@ namespace ChatController
|
||||
else
|
||||
{
|
||||
//Schalte speichern unter Aus
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[0];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
@@ -309,49 +310,49 @@ namespace ChatController
|
||||
|
||||
if (d.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||
}
|
||||
else if (d.GetDataPresent(DataFormats.Text))
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||
}
|
||||
else if (d.GetDataPresent(DataFormats.Bitmap))
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
//prüfe ob dokumentation erlaubt
|
||||
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||
if (kontakt.CustomerPersonOid == null && Chat.ContextMenu.Items.Count > 3)
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
if (kontakt.CustomerPersonOid == null && ChatListBox.ContextMenu.Items.Count > 3)
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[3];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else if (Chat.ContextMenu.Items.Count > 3)
|
||||
else if (ChatListBox.ContextMenu.Items.Count > 3)
|
||||
{
|
||||
var contextItems = Chat.ContextMenu.Items;
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[3];
|
||||
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Chat.ContextMenu.Items.Count == 0)
|
||||
if (ChatListBox.ContextMenu.Items.Count == 0)
|
||||
{
|
||||
Chat.ContextMenu.Visibility = Visibility.Collapsed;
|
||||
ChatListBox.ContextMenu.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -368,9 +369,9 @@ namespace ChatController
|
||||
#region Sende Media Nachrichten
|
||||
private void MediaButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AktChatUser.Items.Count > 0)
|
||||
if (AktChatUserList.Items.Count > 0)
|
||||
{
|
||||
var kontakt = (AktuellerKontakt) AktChatUser.Items[0];
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
var medium = _chat.HoleMedium();
|
||||
|
||||
@@ -380,28 +381,28 @@ namespace ChatController
|
||||
|
||||
if (!convertetMedia.Equals(""))
|
||||
{
|
||||
_chat.AddeMediumDerNachrichtView(convertetMedia);
|
||||
_chat.AddeMediumDerNachrichtView(convertetMedia,medium);
|
||||
|
||||
CollectionViewSource.GetDefaultView(Chat.ItemsSource).Refresh();
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
_chat.SendeMediumAnKontakt(kontakt, convertetMedia);
|
||||
_chat.SendeMediumAnKontakt(kontakt, convertetMedia,medium);
|
||||
|
||||
if (!convertetMedia.Equals("") && File.Exists(convertetMedia))
|
||||
if (!convertetMedia.Equals("") && !convertetMedia.Equals(medium) && File.Exists(convertetMedia))
|
||||
{
|
||||
File.Delete(convertetMedia);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Die gewählte Datei ist zu groß!", "Fehler", MessageBoxButton.OK);
|
||||
MessageBox.Show("Die gewählte Datei ist zu groß!", "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Bitte einen Kontakt auswählen!","Fehler",MessageBoxButton.OK);
|
||||
MessageBox.Show("Bitte wählen Sie einen Kontakt aus.","ownChat",MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -409,18 +410,18 @@ namespace ChatController
|
||||
#region Sende Normale Nachrichten
|
||||
private void SendButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!AktChatUser.Items.IsEmpty && !Chatbox.Text.Equals("") && isChatBoxOnFocus)
|
||||
if (!AktChatUserList.Items.IsEmpty && !Chatbox.Text.Equals("") && isChatBoxOnFocus)
|
||||
{
|
||||
if (!Chatbox.Text.Equals(""))
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
_chat.AddeNachrichtDerView(Chatbox.Text);
|
||||
|
||||
CollectionViewSource.GetDefaultView(Chat.ItemsSource).Refresh();
|
||||
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
|
||||
@@ -436,7 +437,7 @@ namespace ChatController
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AktChatUser.Items.IsEmpty)
|
||||
if (AktChatUserList.Items.IsEmpty)
|
||||
{
|
||||
MessageBox.Show("Bitte wählen Sie einen Chatpartner aus.", "Fehler", MessageBoxButton.OK);
|
||||
if (Chatbox.Text.Equals(""))
|
||||
@@ -477,15 +478,15 @@ namespace ChatController
|
||||
{
|
||||
if (e.Key == Key.Return)
|
||||
{
|
||||
if (!AktChatUser.Items.IsEmpty && !Chatbox.Text.Equals(""))
|
||||
if (!AktChatUserList.Items.IsEmpty && !Chatbox.Text.Equals(""))
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
_chat.AddeNachrichtDerView(Chatbox.Text);
|
||||
|
||||
CollectionViewSource.GetDefaultView(Chat.ItemsSource).Refresh();
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
|
||||
@@ -495,7 +496,7 @@ namespace ChatController
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AktChatUser.Items.IsEmpty)
|
||||
if (AktChatUserList.Items.IsEmpty)
|
||||
{
|
||||
MessageBox.Show("Bitte wählen Sie einen Chatpartner aus.", "Fehler", MessageBoxButton.OK);
|
||||
}
|
||||
@@ -532,7 +533,7 @@ namespace ChatController
|
||||
#region Nachladen weiterer Chat Nachrichten
|
||||
private void Chat_OnScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
List<ScrollBar> scrollBarList = GetVisualChildCollection<ScrollBar>(Chat);
|
||||
List<ScrollBar> scrollBarList = GetVisualChildCollection<ScrollBar>(ChatListBox);
|
||||
foreach (ScrollBar scrollBar in scrollBarList)
|
||||
{
|
||||
if (scrollBar.Orientation == Orientation.Horizontal)
|
||||
@@ -562,19 +563,19 @@ namespace ChatController
|
||||
Cursor = Cursors.Wait;
|
||||
//StartWaiting();
|
||||
scrollPrueferAktivieren = false;
|
||||
|
||||
Chat.Items.MoveCurrentToFirst();
|
||||
KontaktMessageBuilder item = Chat.Items.CurrentItem as KontaktMessageBuilder;
|
||||
|
||||
Chat.ItemsSource = null;
|
||||
|
||||
ChatListBox.Items.MoveCurrentToFirst();
|
||||
ChatMessage item = ChatListBox.Items.CurrentItem as ChatMessage;
|
||||
|
||||
ChatListBox.ItemsSource = null;
|
||||
|
||||
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
|
||||
|
||||
var xy = _chat.LadeWeiterNachrichten(kontakt);
|
||||
|
||||
Chat.ItemsSource = xy;
|
||||
|
||||
Chat.ScrollIntoView(item);
|
||||
ChatListBox.ItemsSource = xy;
|
||||
|
||||
ChatListBox.ScrollIntoView(item);
|
||||
//EndWaiting();
|
||||
Cursor = Cursors.Arrow;
|
||||
}
|
||||
@@ -620,15 +621,13 @@ namespace ChatController
|
||||
|
||||
private void HorcheAktivNachNachrichten()
|
||||
{
|
||||
threadBool = false;
|
||||
|
||||
if (newThread != null)
|
||||
{
|
||||
newThread.Join();
|
||||
newThread = null;
|
||||
}
|
||||
|
||||
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
//thred besser verwalten
|
||||
newThread = new Thread(DoWork);
|
||||
@@ -639,44 +638,41 @@ namespace ChatController
|
||||
|
||||
private void DoWork(object o)
|
||||
{
|
||||
threadBool = true;
|
||||
|
||||
bool _schaueNachMs = false;
|
||||
|
||||
var kontakt = (AktuellerKontakt) o;
|
||||
while (true)
|
||||
{
|
||||
_schaueNachMs = _chat.SchaueNachNeuenNachrichten(kontakt);
|
||||
|
||||
if (_schaueNachMs == true)
|
||||
if (!disableKontaktNachrichtenThread)
|
||||
{
|
||||
|
||||
this.Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Background,
|
||||
(Action)delegate
|
||||
_schaueNachMs = _chat.SchaueNachNeuenNachrichten(kontakt);
|
||||
|
||||
if (_schaueNachMs == true)
|
||||
{
|
||||
if(kontakt != null) {
|
||||
|
||||
var x = _chat.LadeChatNachrichtenVomKontakt(kontakt);
|
||||
|
||||
CollectionViewSource.GetDefaultView(Chat.ItemsSource).Refresh();
|
||||
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
_schaueNachMs = false;
|
||||
|
||||
|
||||
this.Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Background,
|
||||
(Action) delegate
|
||||
{
|
||||
if (kontakt != null)
|
||||
{
|
||||
|
||||
var x = _chat.LadeChatNachrichtenVomKontakt(kontakt);
|
||||
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (threadBool == false)
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//Task.Delay(2000);
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
|
||||
@@ -708,9 +704,9 @@ namespace ChatController
|
||||
|
||||
AktuellerKontakt aktuellerKontakt = null;
|
||||
|
||||
if (AktChatUser.HasItems)
|
||||
if (AktChatUserList.HasItems)
|
||||
{
|
||||
aktuellerKontakt = (AktuellerKontakt) AktChatUser.Items[0];
|
||||
aktuellerKontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
}
|
||||
|
||||
foreach (var liste in _kontaktlist)
|
||||
@@ -784,19 +780,19 @@ namespace ChatController
|
||||
|
||||
#endregion
|
||||
|
||||
#region Zeige Erhaltene Daten per doppelclick An In Dem Fall Bilder Zurzeit
|
||||
#region Zeige Erhaltene Daten per doppelclick An
|
||||
|
||||
private void Chat_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
StartWaiting();
|
||||
var chatItems = Chat.SelectedItems;
|
||||
var chatItems = ChatListBox.SelectedItems;
|
||||
|
||||
if (chatItems.Count > 0)
|
||||
{
|
||||
foreach (var items in chatItems)
|
||||
{
|
||||
var item = items as KontaktMessageBuilder;
|
||||
var item = items as ChatMessage;
|
||||
|
||||
if (item != null && item.ImageSources != null)
|
||||
{
|
||||
@@ -947,37 +943,7 @@ namespace ChatController
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Neue Für Bewoplaner | Nicht integriert | Wird nicht mehr gebraucht ?? wegnehmen
|
||||
private void DoSynchroForBewoplaner()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true) {
|
||||
// UebergebeMessageInfoDatenFuerDb();
|
||||
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
|
||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
|
||||
_kontaktlist = x;
|
||||
|
||||
//ErhalteMessageInfoVonDb();
|
||||
|
||||
Clientlist.Items.Refresh();
|
||||
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Es is ein Fehler bei der Kontakt Aktualisierung aufgetreten.\nFehler:\n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region speichern sowie lesen der MessageSyncDatei / stylezwecke (OwnChat only)
|
||||
public void SpeichereMessageInfoInDatei()
|
||||
{
|
||||
@@ -1055,8 +1021,7 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ChatController.HauptKlassen
|
||||
public class Chat
|
||||
{
|
||||
private readonly List<KontaktlistBuilder> Kontaktliste = new List<KontaktlistBuilder>();
|
||||
private readonly List<KontaktMessageBuilder> Messages = new List<KontaktMessageBuilder>();
|
||||
private readonly List<ChatMessage> Messages = new List<ChatMessage>();
|
||||
|
||||
public ChatDatenUebergabe ChatDaten;
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace ChatController.HauptKlassen
|
||||
#endregion
|
||||
|
||||
#region Lade Nachrichten vom Kontakt in den Chat
|
||||
public IOrderedEnumerable<KontaktMessageBuilder> LadeChatNachrichtenVomKontakt(AktuellerKontakt kontakt)
|
||||
public IOrderedEnumerable<ChatMessage> LadeChatNachrichtenVomKontakt(AktuellerKontakt kontakt)
|
||||
{
|
||||
if (kontakt != null)
|
||||
{
|
||||
@@ -243,29 +243,27 @@ namespace ChatController.HauptKlassen
|
||||
//if (textn.Equals(""))
|
||||
// textn = ChatMessage.Original_Filename;
|
||||
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
timeformated,ChatMessage.File, ChatMessage.Original_Filename));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, true, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
ChatMessage.File, ChatMessage.Original_Filename));
|
||||
}
|
||||
else
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true,ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, true,ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
//MP4 und gifs und so unbehandelten dreck
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true,ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, true,ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, timeformated)); //dd MMMM yyyy HH:mm:ss
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated, true)); //dd MMMM yyyy HH:mm:ss
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -289,44 +287,42 @@ namespace ChatController.HauptKlassen
|
||||
if (ImageExtensions.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
timeformated,ChatMessage.File, ChatMessage.Original_Filename));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, false, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
ChatMessage.File, ChatMessage.Original_Filename));
|
||||
}
|
||||
else
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
//Dokument
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
//ALLERLEI UNBEHANDELTER KRAM
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,
|
||||
textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, ChatMessage.File,
|
||||
timeformated));
|
||||
timeformated, false, ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Message
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var x = Messages.OrderBy(r => r.InternalSendTime);
|
||||
var x = Messages.OrderBy(r => r.SendTime);
|
||||
|
||||
return x;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Messages.OrderBy(r => r.InternalSendTime);
|
||||
return Messages.OrderBy(r => r.SendTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +333,9 @@ namespace ChatController.HauptKlassen
|
||||
BitmapImage bix = new BitmapImage();
|
||||
bix.BeginInit();
|
||||
bix.UriSource = new Uri(link);
|
||||
bix.CacheOption = BitmapCacheOption.OnDemand;
|
||||
bix.EndInit();
|
||||
|
||||
|
||||
return bix;
|
||||
}
|
||||
@@ -407,6 +405,7 @@ namespace ChatController.HauptKlassen
|
||||
try
|
||||
{
|
||||
Stream dataStream = response.GetResponseStream();
|
||||
|
||||
StreamReader reader = new StreamReader(dataStream);
|
||||
|
||||
string responseFromServer = reader.ReadToEnd();
|
||||
@@ -431,7 +430,7 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
#region Lade Weiter Nachrichten
|
||||
|
||||
public IOrderedEnumerable<KontaktMessageBuilder> LadeWeiterNachrichten(KontaktlistBuilder kontakt)
|
||||
public IOrderedEnumerable<ChatMessage> LadeWeiterNachrichten(KontaktlistBuilder kontakt)
|
||||
{
|
||||
if (_hasNextPage == true)
|
||||
{
|
||||
@@ -461,29 +460,27 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
if (ImageExtensions.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
timeformated, ChatMessage.File,ChatMessage.Original_Filename));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, true, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
ChatMessage.File,ChatMessage.Original_Filename));
|
||||
}
|
||||
else
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, true, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Der Ganze Unbehndelte Kram
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, true, ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -507,37 +504,35 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
if (ImageExtensions.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
timeformated, ChatMessage.File,ChatMessage.Original_Filename));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, false, LadeBildNach(ChatMessage.Smaller_Image),
|
||||
ChatMessage.File,ChatMessage.Original_Filename));
|
||||
}
|
||||
else
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
//Dokument
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Der Ganze Unbehandelte Kram MP4 und So
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,textn,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, ChatMessage.File,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated.ToString("dd MMM | HH:mm"), false, timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var x = Messages.OrderBy(r => r.InternalSendTime);
|
||||
var x = Messages.OrderBy(r => r.SendTime);
|
||||
|
||||
return x;
|
||||
}
|
||||
@@ -612,6 +607,7 @@ namespace ChatController.HauptKlassen
|
||||
long timespan = System.Convert.ToInt64(span.TotalSeconds);
|
||||
//long timespan = //lastTs.TotalSeconds;
|
||||
|
||||
//Debug.Print(String.Format("Kontakt: {0}, Anzahl: {1}", kontakt.Name, _userMessages.Response.Messages.Length));
|
||||
if (_userMessages != null && _userMessages.Response.Messages.Length > 0)
|
||||
{
|
||||
timespan = _userMessages.Response.Messages.First().Created_At;
|
||||
@@ -865,8 +861,8 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
var time = DateTime.Now;
|
||||
|
||||
Messages.Add(new KontaktMessageBuilder(username, nachricht,
|
||||
time.ToString("dd MMM | HH:mm"), true, time));
|
||||
Messages.Add(new ChatMessage(username, nachricht,
|
||||
time, true));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -956,7 +952,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}
|
||||
|
||||
public void AddeMediumDerNachrichtView(string file)
|
||||
public void AddeMediumDerNachrichtView(string file,string originalFilePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1010,62 +1006,31 @@ namespace ChatController.HauptKlassen
|
||||
System.Windows.Controls.Image img = new System.Windows.Controls.Image();
|
||||
img.Source = bImg;
|
||||
|
||||
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, bImg,
|
||||
timeformated, file, Path.GetFileName(file)));
|
||||
//original image
|
||||
string filename = Path.GetFileName(originalFilePath).ToLower();
|
||||
|
||||
filename = filename.Replace(".bmp", ".jpg");
|
||||
|
||||
//Path.GetFileName(file)
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, filename ,
|
||||
timeformated, true, bImg,
|
||||
file, filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//var image = new BitmapImage();
|
||||
|
||||
//using (var ms = new System.IO.MemoryStream(mdatei))
|
||||
//{
|
||||
|
||||
// image.BeginInit();
|
||||
// image.CacheOption = BitmapCacheOption.OnLoad; // here
|
||||
// image.StreamSource = ms;
|
||||
// image.EndInit();
|
||||
|
||||
// ms.Dispose();
|
||||
//}
|
||||
|
||||
//int orientationId = 0x0112;
|
||||
|
||||
//if (Img.PropertyIdList.Contains(orientationId))
|
||||
//{
|
||||
// PropertyItem item = Img.GetPropertyItem(orientationId);
|
||||
|
||||
// //image.SetPropertyItem(item);
|
||||
//}
|
||||
|
||||
|
||||
//Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
// timeformated.ToString("dd MMM | HH:mm"), true, image,
|
||||
// timeformated, file, Path.GetFileName(file)));
|
||||
|
||||
|
||||
mss.Dispose();
|
||||
mss.Close();
|
||||
|
||||
//Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
// timeformated.ToString("dd MMM | HH:mm"), true, timeformated, file, Path.GetFileName(file)));
|
||||
|
||||
|
||||
}
|
||||
else if (DokumentExtension.Contains(Path.GetExtension(file).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated.ToString("dd MMM | HH:mm"), true,file,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated, true,file));
|
||||
}
|
||||
else
|
||||
{
|
||||
//MP4 und gifs und so unbehandelten dreck
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, file,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated, true, file));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1092,23 +1057,21 @@ namespace ChatController.HauptKlassen
|
||||
ms.Close();
|
||||
ImageSource logo = biImg;
|
||||
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(filename),
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, logo,
|
||||
timeformated, filename, Path.GetFileName(filename)));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(filename),
|
||||
timeformated, true, logo, filename, Path.GetFileName(filename)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(filename),
|
||||
timeformated.ToString("dd MMM | HH:mm"), true, filename,
|
||||
timeformated));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(filename),
|
||||
timeformated, true, filename));
|
||||
}
|
||||
}
|
||||
|
||||
public void SendeMediumAnKontakt(AktuellerKontakt kontakt,string file)
|
||||
public void SendeMediumAnKontakt(AktuellerKontakt kontakt,string file,string originalFilePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
VerarbeiteMedia(file,kontakt);
|
||||
VerarbeiteMedia(file,kontakt,originalFilePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -1116,7 +1079,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}
|
||||
|
||||
private void VerarbeiteMedia(string file,AktuellerKontakt kontakt)
|
||||
private void VerarbeiteMedia(string file,AktuellerKontakt kontakt, string originalFilePath)
|
||||
{
|
||||
byte[] mdatei;
|
||||
using (Stream reader = File.OpenRead(file))
|
||||
@@ -1124,7 +1087,7 @@ namespace ChatController.HauptKlassen
|
||||
mdatei = ReadFully(reader);
|
||||
}
|
||||
|
||||
string filename = Path.GetFileName(file).ToLower();
|
||||
string filename = Path.GetFileName(originalFilePath).ToLower();
|
||||
|
||||
//Medium auflösung auf 80 % vom original setzen
|
||||
//Image x = (Bitmap)((new ImageConverter()).ConvertFrom(mdatei));
|
||||
@@ -1306,9 +1269,7 @@ namespace ChatController.HauptKlassen
|
||||
return RotateFlipType.RotateNoneFlipNone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static byte[] ReadFully(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[32768];
|
||||
@@ -1403,8 +1364,8 @@ namespace ChatController.HauptKlassen
|
||||
return context;
|
||||
}
|
||||
|
||||
#region Speichere Chat Doku/MEdia aufm PC
|
||||
public void SpeichernUnterFunkion(KontaktMessageBuilder item)
|
||||
#region Speichere Chat Doku / Media aufm PC
|
||||
public void SpeichernUnterFunkion(ChatMessage item)
|
||||
{
|
||||
if (item.ImageSources != null)
|
||||
{
|
||||
@@ -1481,7 +1442,7 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fuege Daten Bilder usw via DragAndDrop in den Chat / muss noch bearbeitet werden
|
||||
#region Fuege Daten Bilder usw via DragAndDrop in den Chat
|
||||
public void Einfuegen(long groupOid, ChatMainControl chatMainControl)
|
||||
{
|
||||
var d = System.Windows.Forms.Clipboard.GetDataObject();
|
||||
@@ -1506,10 +1467,10 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
AddMediumContextDerNachrichtView(myBinary,filename);
|
||||
|
||||
CollectionViewSource.GetDefaultView(chatMainControl.Chat.ItemsSource).Refresh();
|
||||
CollectionViewSource.GetDefaultView(chatMainControl.ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
chatMainControl.Chat.Items.MoveCurrentToLast();
|
||||
chatMainControl.Chat.ScrollIntoView(chatMainControl.Chat.Items.CurrentItem);
|
||||
chatMainControl.ChatListBox.Items.MoveCurrentToLast();
|
||||
chatMainControl.ChatListBox.ScrollIntoView(chatMainControl.ChatListBox.Items.CurrentItem);
|
||||
|
||||
|
||||
SendMediaMessage(filename, groupOid, myBinary);
|
||||
@@ -1528,10 +1489,10 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
AddeNachrichtDerView(text);
|
||||
|
||||
CollectionViewSource.GetDefaultView(chatMainControl.Chat.ItemsSource).Refresh();
|
||||
CollectionViewSource.GetDefaultView(chatMainControl.ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
chatMainControl.Chat.Items.MoveCurrentToLast();
|
||||
chatMainControl.Chat.ScrollIntoView(chatMainControl.Chat.Items.CurrentItem);
|
||||
chatMainControl.ChatListBox.Items.MoveCurrentToLast();
|
||||
chatMainControl.ChatListBox.ScrollIntoView(chatMainControl.ChatListBox.Items.CurrentItem);
|
||||
|
||||
SendMessage(text, groupOid);
|
||||
}
|
||||
@@ -1546,10 +1507,10 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
AddMediumContextDerNachrichtView(ImageToByteArray(img),bildname);
|
||||
|
||||
CollectionViewSource.GetDefaultView(chatMainControl.Chat.ItemsSource).Refresh();
|
||||
CollectionViewSource.GetDefaultView(chatMainControl.ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
chatMainControl.Chat.Items.MoveCurrentToLast();
|
||||
chatMainControl.Chat.ScrollIntoView(chatMainControl.Chat.Items.CurrentItem);
|
||||
chatMainControl.ChatListBox.Items.MoveCurrentToLast();
|
||||
chatMainControl.ChatListBox.ScrollIntoView(chatMainControl.ChatListBox.Items.CurrentItem);
|
||||
|
||||
SendMediaMessage(bildname,groupOid, ImageToByteArray(img));
|
||||
}
|
||||
@@ -1614,7 +1575,7 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
#endregion
|
||||
|
||||
#region Zeige Kontakt Bild / hat noch probleme -> Show Kontakt
|
||||
#region Zeige Kontakt Bild
|
||||
|
||||
public void ShowKontaktPicture(AktuellerKontakt curItem )
|
||||
{
|
||||
@@ -1636,23 +1597,26 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
form.StartPosition = FormStartPosition.CenterScreen;
|
||||
form.Size = imgbit.Size;
|
||||
form.Height += 60;
|
||||
form.MinimumSize = new Size(150,150);
|
||||
|
||||
var width = (int)Math.Round(System.Windows.SystemParameters.PrimaryScreenWidth / 1.25);
|
||||
var height = (int)Math.Round(System.Windows.SystemParameters.PrimaryScreenWidth / 2);
|
||||
|
||||
|
||||
form.MaximumSize = new Size(width,height);
|
||||
form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
|
||||
form.MaximizeBox = false;
|
||||
|
||||
form.Text = "ownChat Bild Voschau";
|
||||
form.Text = "ownChat";
|
||||
form.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
PictureBox pb = new PictureBox();
|
||||
pb.Dock = DockStyle.Fill;
|
||||
pb.Image = imgbit;
|
||||
|
||||
pb.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
pb.SizeMode = PictureBoxSizeMode.CenterImage;
|
||||
|
||||
pb.MaximumSize = new Size(500,500);
|
||||
|
||||
@@ -1666,7 +1630,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowPicture(KontaktMessageBuilder curItem)
|
||||
public void ShowPicture(ChatMessage curItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1686,26 +1650,6 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
using (Form form = new Form())
|
||||
{
|
||||
//Image imgg = new Image();
|
||||
|
||||
//BitmapImage bix = new BitmapImage();
|
||||
//using (var stream = new MemoryStream(e.Result))
|
||||
//{
|
||||
// bix.BeginInit();
|
||||
// bix.CacheOption = BitmapCacheOption.OnLoad;
|
||||
// bix.StreamSource = stream;
|
||||
// bix.EndInit();
|
||||
//}
|
||||
|
||||
//imgg.Source = bix;
|
||||
|
||||
//BmpBitmapEncoder encoder = new BmpBitmapEncoder();
|
||||
//MemoryStream ms = new MemoryStream();
|
||||
//encoder.Frames.Add(BitmapFrame.Create((BitmapSource) imgg.Source));
|
||||
//encoder.Save(ms);
|
||||
//System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
|
||||
|
||||
//##################################################################################
|
||||
MemoryStream ms = new MemoryStream(e.Result);
|
||||
System.Drawing.Image Img = System.Drawing.Image.FromStream(ms);
|
||||
|
||||
@@ -1770,7 +1714,7 @@ namespace ChatController.HauptKlassen
|
||||
width = dImg.Width;
|
||||
height = dImg.Height;
|
||||
}
|
||||
//#################################
|
||||
|
||||
|
||||
int targetheight = (int)Math.Round(System.Windows.SystemParameters.PrimaryScreenHeight / 1.25);
|
||||
|
||||
@@ -1802,7 +1746,7 @@ namespace ChatController.HauptKlassen
|
||||
height = dImg.Height;
|
||||
}
|
||||
|
||||
//##########################################
|
||||
|
||||
if (width < 150 || height < 150)
|
||||
{
|
||||
width = 150;
|
||||
@@ -1818,24 +1762,22 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
form.MaximizeBox = false;
|
||||
|
||||
form.Text = "ownChat Bild Voschau";
|
||||
form.Text = "ownChat";
|
||||
form.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
PictureBox pb = new PictureBox();
|
||||
pb.Dock = DockStyle.Fill;
|
||||
pb.Image = dImg;//imgbit
|
||||
|
||||
pb.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
pb.SizeMode = PictureBoxSizeMode.CenterImage;
|
||||
|
||||
form.Controls.Add(pb);
|
||||
form.ShowDialog();
|
||||
} //
|
||||
}//
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ms.Dispose();
|
||||
ms.Close();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<!-- <Image Source="Ressourcen/ownchat_logo.png" HorizontalAlignment="Right" VerticalAlignment="Top" Height="200" Width="200" RenderOptions.BitmapScalingMode="HighQuality"/>-->
|
||||
|
||||
<GroupBox Grid.Column="0" Header="Login" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="GroupBoxLogin" Foreground="White">
|
||||
<Border Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="GroupBoxLogin" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
@@ -65,7 +65,7 @@
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Border>
|
||||
<Label x:Name="lblVersion" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="White"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace ownChat
|
||||
|
||||
private ChatEmojisView _emojiView;
|
||||
|
||||
private IOrderedEnumerable<KontaktMessageBuilder> _Orderedmessagelist;
|
||||
private IOrderedEnumerable<ChatMessage> _Orderedmessagelist;
|
||||
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
|
||||
|
||||
private readonly List<KontaktMessageBuilder> _messagelist = new List<KontaktMessageBuilder>();
|
||||
private readonly List<ChatMessage> _messagelist = new List<ChatMessage>();
|
||||
private Thread _sendt;
|
||||
private Thread _erhaltent;
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>true</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>https://app5.bewoplaner.de/chat/</InstallUrl>
|
||||
<InstallUrl>http://app.beyondsoft.de/ownChat/</InstallUrl>
|
||||
<ProductName>ownChat Desktop</ProductName>
|
||||
<PublisherName>beyondSoft GmbH</PublisherName>
|
||||
<MinimumRequiredVersion>1.0.0.9</MinimumRequiredVersion>
|
||||
<ApplicationRevision>10</ApplicationRevision>
|
||||
<MinimumRequiredVersion>1.0.0.13</MinimumRequiredVersion>
|
||||
<ApplicationRevision>14</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
@@ -56,16 +56,17 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>9ED26908E1C665955AF78BD0067260B207C9E8CB</ManifestCertificateThumbprint>
|
||||
<ManifestCertificateThumbprint>D9ACF3EBC5E47956B8D786361F7061E3F6D6F286</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>PrototypChat_TemporaryKey.pfx</ManifestKeyFile>
|
||||
<ManifestKeyFile>
|
||||
</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>ownchat_favicon.ico</ApplicationIcon>
|
||||
@@ -173,4 +174,23 @@
|
||||
<Resource Include="ownchat_favicon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
<!-- Target Name="SignOutput" AfterTargets="CoreCompile">
|
||||
<PropertyGroup>
|
||||
<TimestampServerUrl>http://timestamp.globalsign.com/?signature=sha2</TimestampServerUrl>
|
||||
<ApplicationDescription>BeWoPlaner</ApplicationDescription>
|
||||
<SigningCertificateCriteria>/sha1 64ee47d8851b4f38e5242b6a4d6fba33d8b493ba</SigningCertificateCriteria>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<SignableFiles Include="$(ProjectDir)obj\$(ConfigurationName)\$(TargetName)$(TargetExt)" />
|
||||
</ItemGroup>
|
||||
<Exec Command=""$(ProjectDir)\SignTool" sign /a /tr "$(TimestampServerUrl)" /td SHA256 "%(SignableFiles.Identity)"" />
|
||||
</Target -->
|
||||
</Project>
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<EnableSecurityDebugging>false</EnableSecurityDebugging>
|
||||
<PublishUrlHistory>D:\Projects\beyondSoft\Chat\publish\</PublishUrlHistory>
|
||||
<InstallUrlHistory>https://app5.bewoplaner.de/chat/</InstallUrlHistory>
|
||||
<InstallUrlHistory>http://app.beyondsoft.de/ownChat/|https://app5.bewoplaner.de/chat/</InstallUrlHistory>
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
|
||||
Reference in New Issue
Block a user