tr
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<UserControl x:Class="BeWo.View.ChatControlWaitLayer"
|
<UserControl x:Class="ChatController.ChatControlWaitLayer"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:BeWo="clr-namespace:BeWo"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using System.Windows.Controls;
|
namespace ChatController
|
||||||
|
|
||||||
namespace BeWo.View
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
public partial class ChatControlWaitLayer
|
||||||
/// Interaction logic for WaitLayer.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class ChatControlWaitLayer : UserControl
|
|
||||||
{
|
{
|
||||||
public ChatControlWaitLayer()
|
public ChatControlWaitLayer()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,6 +84,8 @@
|
|||||||
<Compile Include="ChatControlWaitLayer.xaml.cs">
|
<Compile Include="ChatControlWaitLayer.xaml.cs">
|
||||||
<DependentUpon>ChatControlWaitLayer.xaml</DependentUpon>
|
<DependentUpon>ChatControlWaitLayer.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Utilities\Constants.cs" />
|
||||||
|
<Compile Include="Utilities\Utils.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="ChatEmojiiControl.xaml">
|
<Page Include="ChatEmojiiControl.xaml">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace ChatController.ChatKlassen
|
|||||||
{
|
{
|
||||||
public class ChatMessage
|
public class ChatMessage
|
||||||
{
|
{
|
||||||
//Chat Ansicht
|
//Chat-Ansicht
|
||||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme)
|
public ChatMessage(string username, string message, DateTime sendtime, bool isme)
|
||||||
{
|
{
|
||||||
Username = username;
|
Username = username;
|
||||||
@@ -17,17 +17,11 @@ namespace ChatController.ChatKlassen
|
|||||||
IsMyMessage = isme;
|
IsMyMessage = isme;
|
||||||
|
|
||||||
Farbgebung(isme);
|
Farbgebung(isme);
|
||||||
|
|
||||||
if (IsHyperlink(message))
|
VisibilityRegelung(IsHyperlink(message) ? "HyperlinkMessage" : "Message");
|
||||||
{
|
|
||||||
VisibilityRegelung("HyperlinkMessage");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
VisibilityRegelung("Message");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image Ansicht
|
// Image-Ansicht
|
||||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName)
|
public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName)
|
||||||
{
|
{
|
||||||
Username = username;
|
Username = username;
|
||||||
@@ -44,7 +38,7 @@ namespace ChatController.ChatKlassen
|
|||||||
VisibilityRegelung("Image");
|
VisibilityRegelung("Image");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
|
//Image-PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
|
||||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string originalImage, string imageName)
|
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string originalImage, string imageName)
|
||||||
{
|
{
|
||||||
Username = username;
|
Username = username;
|
||||||
@@ -59,21 +53,25 @@ namespace ChatController.ChatKlassen
|
|||||||
VisibilityRegelung("Default_Image");
|
VisibilityRegelung("Default_Image");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Dokument Ansicht
|
//Dokumenten-Ansicht
|
||||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string url)
|
public ChatMessage(string username, string message, DateTime sendtime, string pSmallerImagePath, bool isme, string url)
|
||||||
{
|
{
|
||||||
Username = username;
|
Username = username;
|
||||||
UserMessage = message;
|
UserMessage = message;
|
||||||
SendTime = sendtime;
|
SendTime = sendtime;
|
||||||
IsMyMessage = isme;
|
IsMyMessage = isme;
|
||||||
|
|
||||||
Dokpfad = (object) url;
|
Dokpfad = url;
|
||||||
|
|
||||||
Farbgebung(isme);
|
Farbgebung(isme);
|
||||||
|
|
||||||
VisibilityRegelung("Dokumente");
|
Thumbnail = Utilities.Utils.CreateImageSourceFromPath(pSmallerImagePath);
|
||||||
|
|
||||||
|
VisibilityRegelung("Dokumente");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImageSource Thumbnail { get; }
|
||||||
|
|
||||||
#region Farbgebung
|
#region Farbgebung
|
||||||
private void Farbgebung(bool isme)
|
private void Farbgebung(bool isme)
|
||||||
{
|
{
|
||||||
@@ -151,32 +149,21 @@ namespace ChatController.ChatKlassen
|
|||||||
|
|
||||||
public static bool IsHyperlink(string word)
|
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
|
try
|
||||||
{
|
{
|
||||||
if (word.IndexOfAny(@":.\/".ToCharArray()) != -1)
|
if (word.IndexOfAny(@":.\/".ToCharArray()) != -1)
|
||||||
{
|
{
|
||||||
if (Uri.IsWellFormedUriString(word, UriKind.Absolute))
|
if (Uri.IsWellFormedUriString(word, UriKind.Absolute))
|
||||||
{
|
{
|
||||||
// The string is an Absolute URI
|
return word.StartsWith("http://");
|
||||||
if (word.StartsWith("http://")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (UrlRegex.IsMatch(word))
|
|
||||||
|
if (UrlRegex.IsMatch(word))
|
||||||
{
|
{
|
||||||
//hier der Bereich hin der die uri splittet wenn neben dem link auch text gesendet wird
|
var uri = new Uri(word, UriKind.RelativeOrAbsolute);
|
||||||
|
|
||||||
|
|
||||||
Uri uri = new Uri(word, UriKind.RelativeOrAbsolute);
|
|
||||||
|
|
||||||
if (!uri.IsAbsoluteUri)
|
if (!uri.IsAbsoluteUri)
|
||||||
{
|
{
|
||||||
// rebuild it it with http to turn it into an Absolute URI
|
|
||||||
uri = new Uri(@"http://" + word, UriKind.Absolute);
|
uri = new Uri(@"http://" + word, UriKind.Absolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,93 +188,79 @@ namespace ChatController.ChatKlassen
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Variablen
|
#region Variablen
|
||||||
|
|
||||||
public bool IsMyMessage { get; set; }
|
public bool IsMyMessage { get; set; }
|
||||||
public string Username { get; private set; }
|
public string Username { get; }
|
||||||
public string UserMessage { get; private set; }
|
public string UserMessage { get; }
|
||||||
public DateTime SendTime { get; private set; }
|
public DateTime SendTime { get; }
|
||||||
|
|
||||||
public string UserTimeStringLeft
|
public string UserTimeStringLeft => IsMyMessage ? null : Username;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (IsMyMessage)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return Username; //String.Format("{0} {1}", Username, SendTimeString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string UserTimeStringRight
|
public string UserTimeStringRight => SendTimeString;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
//if (!IsMyMessage)
|
|
||||||
//{
|
|
||||||
// return null;
|
|
||||||
//}
|
|
||||||
return SendTimeString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SendTimeString
|
public string SendTimeString => SendTime.Date == DateTime.Today ? $"Heute {SendTime:HH:mm}" : SendTime.ToString("dd.MMM HH:mm");
|
||||||
{
|
|
||||||
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 Brush ChatColor { get; private set; }
|
||||||
|
|
||||||
public string Posi { get; private set; }
|
public string Posi { get; private set; }
|
||||||
|
|
||||||
public string OriginalImage { get; private set; }
|
public string OriginalImage { get; }
|
||||||
public string OriginalImageName { get; private set; }
|
public string OriginalImageName { get; }
|
||||||
|
|
||||||
public Visibility ChatVisibility { get; set; }
|
public Visibility ChatVisibility { get; set; }
|
||||||
public Visibility HyperlinkVisibility { get; set; }
|
public Visibility HyperlinkVisibility { get; set; }
|
||||||
|
|
||||||
|
|
||||||
private Visibility _pictureVisibility;
|
private Visibility _pictureVisibility;
|
||||||
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
|
public Visibility PictureVisibility
|
||||||
|
{
|
||||||
|
get => _pictureVisibility;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_pictureVisibility = value;
|
||||||
|
OnPropertyChanged(nameof(PictureVisibility));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Visibility _picturePlaceHolderVisibility;
|
private Visibility _picturePlaceHolderVisibility;
|
||||||
public Visibility PicturePlaceHolderVisibility { get { return _picturePlaceHolderVisibility; } set { _picturePlaceHolderVisibility = value; OnPropertyChanged("PicturePlaceHolderVisibility"); } }
|
public Visibility PicturePlaceHolderVisibility
|
||||||
|
{
|
||||||
|
get => _picturePlaceHolderVisibility;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_picturePlaceHolderVisibility = value;
|
||||||
|
OnPropertyChanged(nameof(PicturePlaceHolderVisibility));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Visibility _gifPictureVisibility;
|
private Visibility _gifPictureVisibility;
|
||||||
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
|
public Visibility GifPictureVisibility
|
||||||
|
{
|
||||||
|
get => _gifPictureVisibility;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_gifPictureVisibility = value;
|
||||||
|
OnPropertyChanged(nameof(GifPictureVisibility));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Visibility DokumentVisibility { get; set; }
|
public Visibility DokumentVisibility { get; set; }
|
||||||
public ImageSource ImageSources { get; private set; }
|
public ImageSource ImageSources { get; }
|
||||||
public object Dokpfad { get; private set; }
|
public object Dokpfad { get; }
|
||||||
|
|
||||||
public long? ChatMessageOid { get; private set; }
|
public long? ChatMessageOid { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
//Farbe Links MEssageHeader
|
//Farbe Links MEssageHeader
|
||||||
private Brush _farbeLinksColor;
|
private Brush _farbeLinksColor;
|
||||||
public Brush FarbeLinksColor
|
public Brush FarbeLinksColor
|
||||||
{
|
{
|
||||||
get
|
get => _farbeLinksColor;
|
||||||
{
|
|
||||||
return _farbeLinksColor;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
||||||
_farbeLinksColor = value;
|
_farbeLinksColor = value;
|
||||||
|
OnPropertyChanged(nameof(FarbeLinksColor));
|
||||||
OnPropertyChanged("FarbeLinksColor");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,31 +268,22 @@ namespace ChatController.ChatKlassen
|
|||||||
private Brush _farbeRechtsColor;
|
private Brush _farbeRechtsColor;
|
||||||
public Brush FarbeRechtsColor
|
public Brush FarbeRechtsColor
|
||||||
{
|
{
|
||||||
get
|
get => _farbeRechtsColor;
|
||||||
{
|
|
||||||
return _farbeRechtsColor;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
||||||
_farbeRechtsColor = value;
|
_farbeRechtsColor = value;
|
||||||
|
OnPropertyChanged(nameof(FarbeRechtsColor));
|
||||||
OnPropertyChanged("FarbeRechtsColor");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
protected virtual void OnPropertyChanged(string propertyName)
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
var handler = PropertyChanged;
|
var handler = PropertyChanged;
|
||||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -331,7 +331,7 @@
|
|||||||
<!--Dokument bereich -->
|
<!--Dokument bereich -->
|
||||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
|
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
|
||||||
<StackPanel Orientation="Vertical">
|
<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" />
|
<Image ToolTip="Dokument öffnen" Height="100" Width="150" Source="{Binding Path=Thumbnail}" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}" FontSize="14"/>
|
<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 HorizontalAlignment="Center" VerticalAlignment="Center" Content="Dokument Anzeigen" Height="25" Tag="{Binding Dokpfad}" Click="OpenDokument_OnClick " >
|
||||||
<Button.Resources>
|
<Button.Resources>
|
||||||
|
|||||||
@@ -4,65 +4,53 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Media.TextFormatting;
|
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using BeWo.View;
|
|
||||||
using ChatController.ChatKlassen;
|
using ChatController.ChatKlassen;
|
||||||
using ChatController.HauptKlassen;
|
using ChatController.HauptKlassen;
|
||||||
using ChatController.Klassen;
|
using ChatController.Klassen;
|
||||||
|
|
||||||
using Path = System.IO.Path;
|
using Path = System.IO.Path;
|
||||||
|
|
||||||
namespace ChatController
|
namespace ChatController
|
||||||
{
|
{
|
||||||
/// <summary>
|
public partial class ChatMainControl
|
||||||
/// Interaktionslogik für ChatMainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class ChatMainControl : UserControl
|
|
||||||
{
|
{
|
||||||
#region Vokabeln
|
#region Vokabeln
|
||||||
private Chat _chat;
|
private Chat _Chat;
|
||||||
private AktuellerKontakt _aktuellerKontakt;
|
private AktuellerKontakt _AktuellerKontakt;
|
||||||
|
|
||||||
private bool isChatBoxOnFocus = false;
|
private bool _IsChatBoxOnFocus;
|
||||||
|
|
||||||
private ChatEmojiiControl _emojiView;
|
private ChatEmojiiControl _EmojiView;
|
||||||
|
|
||||||
private IOrderedEnumerable<ChatMessage> _Orderedmessagelist;
|
private IOrderedEnumerable<ChatMessage> _OrderedMessages;
|
||||||
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
|
private IOrderedEnumerable<KontaktlistBuilder> _ContactList;
|
||||||
|
|
||||||
private ChatDatenUebergabe _chatDaten;
|
private bool _ScrollPrueferAktivieren;
|
||||||
|
|
||||||
private bool scrollPrueferAktivieren = false;
|
private Thread _NewThread;
|
||||||
|
|
||||||
public Thread newThread;
|
|
||||||
public bool disableKontaktNachrichtenThread = true;
|
public bool disableKontaktNachrichtenThread = true;
|
||||||
|
|
||||||
public Thread AlleKontakteThread;
|
private Thread _AlleKontakteThread;
|
||||||
public bool AlleNachrichtenThreadBool = true;
|
public bool _AlleNachrichtenThreadBool = true;
|
||||||
private double? AlleNachrichtenCount = null;
|
private readonly List<string> _CreatedTempFiles = new List<string>();
|
||||||
private List<String> createdTempFiles = new List<String>();
|
|
||||||
|
|
||||||
private Dictionary<String, Action<string>> menuItemName2Callback = new Dictionary<string, Action<string>>();
|
private Dictionary<string, Action<string>> _MenuItemName2Callback = new Dictionary<string, Action<string>>();
|
||||||
|
|
||||||
public delegate void CloseDelegate();
|
public delegate void CloseDelegate();
|
||||||
|
|
||||||
public event CloseDelegate OnClose;
|
public event CloseDelegate OnClose;
|
||||||
|
|
||||||
private bool _isDesktopVersion = true;
|
private bool _IsDesktopVersion = true;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public ChatMainControl()
|
public ChatMainControl()
|
||||||
@@ -73,14 +61,13 @@ namespace ChatController
|
|||||||
|
|
||||||
public void InitMitChatdaten(ChatDatenUebergabe cdu)
|
public void InitMitChatdaten(ChatDatenUebergabe cdu)
|
||||||
{
|
{
|
||||||
_chatDaten = cdu;
|
_Chat = new Chat(cdu);
|
||||||
_chat = new Chat(cdu);
|
|
||||||
|
|
||||||
_kontaktlist = _chat.GroupklassenInChatKontakteUmwandler();
|
_ContactList = _Chat.GroupklassenInChatKontakteUmwandler();
|
||||||
|
|
||||||
Clientlist.ItemsSource = _kontaktlist;
|
Clientlist.ItemsSource = _ContactList;
|
||||||
|
|
||||||
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
|
var view = (CollectionView) CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
|
||||||
view.Filter = UserFilter;
|
view.Filter = UserFilter;
|
||||||
|
|
||||||
HorcheAlleGruppenNachrichten();
|
HorcheAlleGruppenNachrichten();
|
||||||
@@ -89,73 +76,50 @@ namespace ChatController
|
|||||||
Clientlist.Items.Refresh();
|
Clientlist.Items.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AktuellerKontakt GetAktuellenKontakt()
|
public AktuellerKontakt GetCurrentContact()
|
||||||
{
|
{
|
||||||
if (AktChatUserList != null)
|
var kontakt = (AktuellerKontakt) AktChatUserList?.Items[0];
|
||||||
{
|
|
||||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
|
||||||
|
|
||||||
if (kontakt.CustomerOid == null)
|
return kontakt?.CustomerOid == null ? null : kontakt;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kontakt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChatMessage> GetSelectedMessages()
|
public List<ChatMessage> GetSelectedMessages()
|
||||||
{
|
{
|
||||||
List<ChatMessage> itemListe = new List<ChatMessage>();
|
var itemListe = new List<ChatMessage>();
|
||||||
|
|
||||||
foreach (Object selecteditem in ChatListBox.SelectedItems)
|
foreach (var selectedItem in ChatListBox.SelectedItems)
|
||||||
{
|
{
|
||||||
ChatMessage Item = selecteditem as ChatMessage;
|
var Item = selectedItem as ChatMessage;
|
||||||
|
|
||||||
//if (Item.MessagePersonOid == 0)
|
itemListe.Add(Item);
|
||||||
//{
|
|
||||||
itemListe.Add(Item);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemListe.Count > 0) {
|
return itemListe.Count > 0 ? itemListe : null;
|
||||||
|
|
||||||
return itemListe;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Style setter für ownChatDesktop Version
|
#region Style setter für ownChatDesktop Version
|
||||||
public void SetzteStyleAufNull()
|
public void ResetStyle()
|
||||||
{
|
{
|
||||||
EmojiButton.Style = null;
|
EmojiButton.Style = null;
|
||||||
MediaButton.Style = null;
|
MediaButton.Style = null;
|
||||||
ReloadGruppen.Visibility = Visibility.Visible;
|
ReloadGruppen.Visibility = Visibility.Visible;
|
||||||
_isDesktopVersion = false;
|
_IsDesktopVersion = false;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Lade KontaktDaten und Lade sie in den Chat
|
#region Lade KontaktDaten und Lade sie in den Chat
|
||||||
private void AktChatUser_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void AktChatUser_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
_chat.ShowKontaktPicture(_aktuellerKontakt);
|
_Chat.ShowKontaktPicture(_AktuellerKontakt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Clientlist_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Clientlist_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if(Clientlist.SelectedItem != null)
|
if(Clientlist.SelectedItem != null)
|
||||||
{
|
{
|
||||||
// StartWaiting();
|
|
||||||
disableKontaktNachrichtenThread = true;
|
disableKontaktNachrichtenThread = true;
|
||||||
Cursor = Cursors.Wait;
|
Cursor = Cursors.Wait;
|
||||||
scrollPrueferAktivieren = false;
|
_ScrollPrueferAktivieren = false;
|
||||||
ChatListBox.ItemsSource = null;
|
ChatListBox.ItemsSource = null;
|
||||||
|
|
||||||
AktChatUserList.Items.Clear();
|
AktChatUserList.Items.Clear();
|
||||||
@@ -171,38 +135,28 @@ namespace ChatController
|
|||||||
var aktuellerKontakt = new AktuellerKontakt(kontakt);
|
var aktuellerKontakt = new AktuellerKontakt(kontakt);
|
||||||
|
|
||||||
AktChatUserList.Items.Add(aktuellerKontakt);
|
AktChatUserList.Items.Add(aktuellerKontakt);
|
||||||
_aktuellerKontakt = aktuellerKontakt;
|
_AktuellerKontakt = aktuellerKontakt;
|
||||||
|
|
||||||
var x = _chat.LadeChatNachrichtenVomKontakt(aktuellerKontakt);
|
var chatMessages = _Chat.LadeChatNachrichtenVomKontakt(aktuellerKontakt);
|
||||||
|
|
||||||
ChatListBox.ItemsSource = x;
|
ChatListBox.ItemsSource = chatMessages;
|
||||||
|
|
||||||
//ChatListBox.Items.MoveCurrentToLast();
|
|
||||||
//ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
|
||||||
|
|
||||||
if (VisualTreeHelper.GetChildrenCount(ChatListBox) > 0)
|
if (VisualTreeHelper.GetChildrenCount(ChatListBox) > 0)
|
||||||
{
|
{
|
||||||
Border border = (Border)VisualTreeHelper.GetChild(ChatListBox, 0);
|
var border = (Border) VisualTreeHelper.GetChild(ChatListBox, 0);
|
||||||
ScrollViewer scrollViewer = (ScrollViewer)VisualTreeHelper.GetChild(border, 0);
|
var scrollViewer = (ScrollViewer) VisualTreeHelper.GetChild(border, 0);
|
||||||
scrollViewer.ScrollToBottom();
|
scrollViewer.ScrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (ChatListBox.Items.Count > 0)
|
ChatListBox.ContextMenu = _Chat.ErstelleKontextMenue();
|
||||||
//{
|
|
||||||
// ChatListBox.SelectedIndex = ChatListBox.Items.Count - 1;
|
|
||||||
// ChatListBox.ScrollIntoView(ChatListBox.SelectedItem);
|
|
||||||
//}
|
|
||||||
|
|
||||||
ChatListBox.ContextMenu = _chat.ErstelleKontextMenue();
|
|
||||||
SetContextHandler();
|
SetContextHandler();
|
||||||
scrollPrueferAktivieren = true;
|
_ScrollPrueferAktivieren = true;
|
||||||
|
|
||||||
HorcheAktivNachNachrichten();
|
HorcheAktivNachNachrichten();
|
||||||
Cursor = Cursors.Arrow;
|
Cursor = Cursors.Arrow;
|
||||||
|
|
||||||
|
|
||||||
disableKontaktNachrichtenThread = false;
|
disableKontaktNachrichtenThread = false;
|
||||||
// EndWaiting();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -213,9 +167,9 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
var contextItems = ChatListBox.ContextMenu.Items;
|
var contextItems = ChatListBox.ContextMenu.Items;
|
||||||
|
|
||||||
foreach (var menuItemText in menuItemName2Callback.Keys)
|
foreach (var menuItemText in _MenuItemName2Callback.Keys)
|
||||||
{
|
{
|
||||||
var cb = menuItemName2Callback[menuItemText];
|
var cb = _MenuItemName2Callback[menuItemText];
|
||||||
|
|
||||||
MenuItem item = new MenuItem();
|
MenuItem item = new MenuItem();
|
||||||
|
|
||||||
@@ -249,14 +203,14 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
var item = (ChatMessage)items;
|
var item = (ChatMessage)items;
|
||||||
|
|
||||||
_chat.SpeichernUnterFunkion(item);
|
_Chat.SpeichernUnterFunkion(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
|
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||||
{
|
{
|
||||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||||
_chat.Einfuegen(kontakt.GroupId,this);
|
_Chat.Einfuegen(kontakt.GroupId,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Item4OnClick(object sender, RoutedEventArgs routedEventArgs)
|
private void Item4OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||||
@@ -270,7 +224,7 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!chatmessages.Equals(""))
|
if(!chatmessages.Equals(""))
|
||||||
_chat.Kopieren(chatmessages, 1);
|
_Chat.Kopieren(chatmessages, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Chat_OnContextMenuOpening(object sender, ContextMenuEventArgs e)
|
private void Chat_OnContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||||
@@ -374,9 +328,9 @@ namespace ChatController
|
|||||||
|
|
||||||
public void AddContextMenu(string menuItemText, Action<string> callBackAction)
|
public void AddContextMenu(string menuItemText, Action<string> callBackAction)
|
||||||
{
|
{
|
||||||
if (!menuItemName2Callback.ContainsKey(menuItemText))
|
if (!_MenuItemName2Callback.ContainsKey(menuItemText))
|
||||||
{
|
{
|
||||||
menuItemName2Callback.Add(menuItemText, callBackAction);
|
_MenuItemName2Callback.Add(menuItemText, callBackAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -388,21 +342,21 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||||
|
|
||||||
var medium = _chat.HoleMedium();
|
var medium = _Chat.HoleMedium();
|
||||||
|
|
||||||
if(medium != null) {
|
if(medium != null) {
|
||||||
|
|
||||||
string convertetMedia = _chat.ScaleImage(medium, Path.GetExtension(medium.ToUpperInvariant()));
|
string convertetMedia = _Chat.ScaleImage(medium, Path.GetExtension(medium.ToUpperInvariant()));
|
||||||
|
|
||||||
if (!convertetMedia.Equals(""))
|
if (!convertetMedia.Equals(""))
|
||||||
{
|
{
|
||||||
_chat.AddeMediumDerNachrichtView(convertetMedia,medium);
|
_Chat.AddeMediumDerNachrichtView(convertetMedia,medium);
|
||||||
|
|
||||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||||
ChatListBox.Items.MoveCurrentToLast();
|
ChatListBox.Items.MoveCurrentToLast();
|
||||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||||
|
|
||||||
_chat.SendeMediumAnKontakt(kontakt, convertetMedia,medium);
|
_Chat.SendeMediumAnKontakt(kontakt, convertetMedia,medium);
|
||||||
|
|
||||||
if (!convertetMedia.Equals("") && !convertetMedia.Equals(medium) && File.Exists(convertetMedia))
|
if (!convertetMedia.Equals("") && !convertetMedia.Equals(medium) && File.Exists(convertetMedia))
|
||||||
{
|
{
|
||||||
@@ -425,20 +379,20 @@ namespace ChatController
|
|||||||
#region Sende Normale Nachrichten
|
#region Sende Normale Nachrichten
|
||||||
private void SendButton_OnClick(object sender, RoutedEventArgs e)
|
private void SendButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!AktChatUserList.Items.IsEmpty && !Chatbox.Text.Equals("") && isChatBoxOnFocus)
|
if (!AktChatUserList.Items.IsEmpty && !Chatbox.Text.Equals("") && _IsChatBoxOnFocus)
|
||||||
{
|
{
|
||||||
if (!Chatbox.Text.Equals(""))
|
if (!Chatbox.Text.Equals(""))
|
||||||
{
|
{
|
||||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||||
|
|
||||||
_chat.AddeNachrichtDerView(Chatbox.Text);
|
_Chat.AddeNachrichtDerView(Chatbox.Text);
|
||||||
|
|
||||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||||
|
|
||||||
ChatListBox.Items.MoveCurrentToLast();
|
ChatListBox.Items.MoveCurrentToLast();
|
||||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||||
|
|
||||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
_Chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||||
|
|
||||||
Chatbox.Text = "";
|
Chatbox.Text = "";
|
||||||
|
|
||||||
@@ -446,7 +400,7 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
Chatbox.Text = "Nachricht schreiben";
|
Chatbox.Text = "Nachricht schreiben";
|
||||||
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
||||||
isChatBoxOnFocus = false;
|
_IsChatBoxOnFocus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,7 +413,7 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
Chatbox.Text = "Nachricht schreiben";
|
Chatbox.Text = "Nachricht schreiben";
|
||||||
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
||||||
isChatBoxOnFocus = false;
|
_IsChatBoxOnFocus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Chatbox.Text.Equals(""))
|
else if (Chatbox.Text.Equals(""))
|
||||||
@@ -469,7 +423,7 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
Chatbox.Text = "Nachricht schreiben";
|
Chatbox.Text = "Nachricht schreiben";
|
||||||
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
||||||
isChatBoxOnFocus = false;
|
_IsChatBoxOnFocus = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -481,7 +435,7 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
Chatbox.Text = "";
|
Chatbox.Text = "";
|
||||||
Chatbox.Foreground = new SolidColorBrush(Colors.Black);
|
Chatbox.Foreground = new SolidColorBrush(Colors.Black);
|
||||||
isChatBoxOnFocus = true;
|
_IsChatBoxOnFocus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//hier bereich wie Dokumentieren
|
//hier bereich wie Dokumentieren
|
||||||
@@ -497,13 +451,13 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||||
|
|
||||||
_chat.AddeNachrichtDerView(Chatbox.Text);
|
_Chat.AddeNachrichtDerView(Chatbox.Text);
|
||||||
|
|
||||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||||
ChatListBox.Items.MoveCurrentToLast();
|
ChatListBox.Items.MoveCurrentToLast();
|
||||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||||
|
|
||||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
_Chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||||
|
|
||||||
|
|
||||||
Chatbox.Text = "";
|
Chatbox.Text = "";
|
||||||
@@ -554,7 +508,7 @@ namespace ChatController
|
|||||||
if (scrollBar.Orientation == Orientation.Horizontal)
|
if (scrollBar.Orientation == Orientation.Horizontal)
|
||||||
{
|
{
|
||||||
scrollBar.ValueChanged += HorizontalScrollbarChanged;
|
scrollBar.ValueChanged += HorizontalScrollbarChanged;
|
||||||
scrollPrueferAktivieren = true;
|
_ScrollPrueferAktivieren = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -565,7 +519,7 @@ namespace ChatController
|
|||||||
|
|
||||||
private void VerticalScrollbarChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
|
private void VerticalScrollbarChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
|
||||||
{
|
{
|
||||||
if (scrollPrueferAktivieren == true)
|
if (_ScrollPrueferAktivieren == true)
|
||||||
{
|
{
|
||||||
var x = (ScrollBar) sender;
|
var x = (ScrollBar) sender;
|
||||||
|
|
||||||
@@ -577,7 +531,7 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
Cursor = Cursors.Wait;
|
Cursor = Cursors.Wait;
|
||||||
//StartWaiting();
|
//StartWaiting();
|
||||||
scrollPrueferAktivieren = false;
|
_ScrollPrueferAktivieren = false;
|
||||||
|
|
||||||
ChatListBox.Items.MoveCurrentToFirst();
|
ChatListBox.Items.MoveCurrentToFirst();
|
||||||
ChatMessage item = ChatListBox.Items.CurrentItem as ChatMessage;
|
ChatMessage item = ChatListBox.Items.CurrentItem as ChatMessage;
|
||||||
@@ -586,7 +540,7 @@ namespace ChatController
|
|||||||
|
|
||||||
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
|
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
|
||||||
|
|
||||||
var xy = _chat.LadeWeiterNachrichten(kontakt);
|
var xy = _Chat.LadeWeiterNachrichten(kontakt);
|
||||||
|
|
||||||
ChatListBox.ItemsSource = xy;
|
ChatListBox.ItemsSource = xy;
|
||||||
|
|
||||||
@@ -636,18 +590,18 @@ namespace ChatController
|
|||||||
|
|
||||||
private void HorcheAktivNachNachrichten()
|
private void HorcheAktivNachNachrichten()
|
||||||
{
|
{
|
||||||
if (newThread != null)
|
if (_NewThread != null)
|
||||||
{
|
{
|
||||||
newThread.Join();
|
_NewThread.Join();
|
||||||
newThread = null;
|
_NewThread = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||||
|
|
||||||
//thred besser verwalten
|
//thred besser verwalten
|
||||||
newThread = new Thread(DoWork);
|
_NewThread = new Thread(DoWork);
|
||||||
newThread.IsBackground = true;
|
_NewThread.IsBackground = true;
|
||||||
newThread.Start(kontakt);
|
_NewThread.Start(kontakt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +616,7 @@ namespace ChatController
|
|||||||
|
|
||||||
if (!disableKontaktNachrichtenThread)
|
if (!disableKontaktNachrichtenThread)
|
||||||
{
|
{
|
||||||
_schaueNachMs = _chat.SchaueNachNeuenNachrichten(kontakt);
|
_schaueNachMs = _Chat.SchaueNachNeuenNachrichten(kontakt);
|
||||||
|
|
||||||
if (_schaueNachMs == true)
|
if (_schaueNachMs == true)
|
||||||
{
|
{
|
||||||
@@ -674,7 +628,7 @@ namespace ChatController
|
|||||||
if (kontakt != null)
|
if (kontakt != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var x = _chat.LadeChatNachrichtenVomKontakt(kontakt);
|
var x = _Chat.LadeChatNachrichtenVomKontakt(kontakt);
|
||||||
|
|
||||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||||
|
|
||||||
@@ -700,16 +654,16 @@ namespace ChatController
|
|||||||
#region Für alle Nachrichten Count Listener
|
#region Für alle Nachrichten Count Listener
|
||||||
private void HorcheAlleGruppenNachrichten()
|
private void HorcheAlleGruppenNachrichten()
|
||||||
{
|
{
|
||||||
AlleKontakteThread = new Thread(DoWorkAlleNachrichten);
|
_AlleKontakteThread = new Thread(DoWorkAlleNachrichten);
|
||||||
AlleKontakteThread.IsBackground = true;
|
_AlleKontakteThread.IsBackground = true;
|
||||||
AlleKontakteThread.Start();
|
_AlleKontakteThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoWorkAlleNachrichten()
|
private void DoWorkAlleNachrichten()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var x = _chat.SchaueNachAllenMessageCounts();
|
var x = _Chat.SchaueNachAllenMessageCounts();
|
||||||
|
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
{
|
{
|
||||||
@@ -717,7 +671,7 @@ namespace ChatController
|
|||||||
DispatcherPriority.Background,
|
DispatcherPriority.Background,
|
||||||
(Action)delegate
|
(Action)delegate
|
||||||
{
|
{
|
||||||
var alist = _chat.NeueGroupklassenKontakte();
|
var alist = _Chat.NeueGroupklassenKontakte();
|
||||||
|
|
||||||
AktuellerKontakt aktuellerKontakt = null;
|
AktuellerKontakt aktuellerKontakt = null;
|
||||||
|
|
||||||
@@ -726,7 +680,7 @@ namespace ChatController
|
|||||||
aktuellerKontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
aktuellerKontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var liste in _kontaktlist)
|
foreach (var liste in _ContactList)
|
||||||
{
|
{
|
||||||
foreach (var neu in alist)
|
foreach (var neu in alist)
|
||||||
{
|
{
|
||||||
@@ -749,16 +703,16 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//abchecken ob neue Groupid in liste vorhanden , wenn nicht dann adde neuen kontakt der liste hinzu
|
//abchecken ob neue Groupid in liste vorhanden , wenn nicht dann adde neuen kontakt der liste hinzu
|
||||||
if (!_kontaktlist.Contains(neu))
|
if (!_ContactList.Contains(neu))
|
||||||
{
|
{
|
||||||
_kontaktlist.ToList().Add(neu);
|
_ContactList.ToList().Add(neu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//umgekert ist eine kontakt aus der liste nicht mehr in neu muss diese raus
|
//umgekert ist eine kontakt aus der liste nicht mehr in neu muss diese raus
|
||||||
if (!alist.Contains(liste))
|
if (!alist.Contains(liste))
|
||||||
{
|
{
|
||||||
_kontaktlist.ToList().Remove(liste);
|
_ContactList.ToList().Remove(liste);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,7 +723,7 @@ namespace ChatController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AlleNachrichtenThreadBool == false)
|
if (_AlleNachrichtenThreadBool == false)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -814,7 +768,7 @@ namespace ChatController
|
|||||||
if (item != null && item.ImageSources != null)
|
if (item != null && item.ImageSources != null)
|
||||||
{
|
{
|
||||||
StartWaiting();
|
StartWaiting();
|
||||||
_chat.ShowPicture(item, EndWaiting);
|
_Chat.ShowPicture(item, EndWaiting);
|
||||||
}
|
}
|
||||||
else if(item != null && item.Dokpfad != null)
|
else if(item != null && item.Dokpfad != null)
|
||||||
{
|
{
|
||||||
@@ -864,7 +818,7 @@ namespace ChatController
|
|||||||
StartWaiting();
|
StartWaiting();
|
||||||
|
|
||||||
string path = Path.Combine(Path.GetTempPath(), filename);
|
string path = Path.Combine(Path.GetTempPath(), filename);
|
||||||
createdTempFiles.Add(path);
|
_CreatedTempFiles.Add(path);
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
using (WebClient webClient = new WebClient())
|
using (WebClient webClient = new WebClient())
|
||||||
@@ -956,11 +910,11 @@ namespace ChatController
|
|||||||
|
|
||||||
SpeichereMessageInfoInDatei();
|
SpeichereMessageInfoInDatei();
|
||||||
|
|
||||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
var aktuelleGruppen = _Chat.GruppenAktuallisieren();
|
||||||
|
|
||||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
var x = _Chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||||
|
|
||||||
_kontaktlist = x;
|
_ContactList = x;
|
||||||
|
|
||||||
LeseMessageInfoAusDatei();
|
LeseMessageInfoAusDatei();
|
||||||
|
|
||||||
@@ -980,7 +934,7 @@ namespace ChatController
|
|||||||
public void SpeichereMessageInfoInDatei()
|
public void SpeichereMessageInfoInDatei()
|
||||||
{
|
{
|
||||||
List<KontaktlistBuilder> aa = new List<KontaktlistBuilder>();
|
List<KontaktlistBuilder> aa = new List<KontaktlistBuilder>();
|
||||||
foreach (var kontakt in _kontaktlist)
|
foreach (var kontakt in _ContactList)
|
||||||
{
|
{
|
||||||
if(kontakt.SetzeGelesen == 0 && !kontakt.ReceiveMs.Equals("")) {
|
if(kontakt.SetzeGelesen == 0 && !kontakt.ReceiveMs.Equals("")) {
|
||||||
aa.Add(kontakt);
|
aa.Add(kontakt);
|
||||||
@@ -988,21 +942,21 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(aa.Count>0)
|
if(aa.Count>0)
|
||||||
_chat.SpeichereTimeStampsInDatei(aa);
|
_Chat.SpeichereTimeStampsInDatei(aa);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LeseMessageInfoAusDatei()
|
public void LeseMessageInfoAusDatei()
|
||||||
{
|
{
|
||||||
List<KontaktlistBuilder> aa = new List<KontaktlistBuilder>();
|
List<KontaktlistBuilder> aa = new List<KontaktlistBuilder>();
|
||||||
foreach (var kontakt in _kontaktlist)
|
foreach (var kontakt in _ContactList)
|
||||||
{
|
{
|
||||||
aa.Add(kontakt);
|
aa.Add(kontakt);
|
||||||
}
|
}
|
||||||
|
|
||||||
var liste = _chat.PruefeTimeStampsBeiStart(aa);
|
var liste = _Chat.PruefeTimeStampsBeiStart(aa);
|
||||||
|
|
||||||
if(liste != null) {
|
if(liste != null) {
|
||||||
foreach (var kon in _kontaktlist)
|
foreach (var kon in _ContactList)
|
||||||
{
|
{
|
||||||
foreach (var item in liste)
|
foreach (var item in liste)
|
||||||
{
|
{
|
||||||
@@ -1041,7 +995,7 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
if (liste != null)
|
if (liste != null)
|
||||||
{
|
{
|
||||||
foreach (var kon in _kontaktlist)
|
foreach (var kon in _ContactList)
|
||||||
{
|
{
|
||||||
foreach (var item in liste)
|
foreach (var item in liste)
|
||||||
{
|
{
|
||||||
@@ -1058,7 +1012,7 @@ namespace ChatController
|
|||||||
|
|
||||||
public void DeleteTempFiles()
|
public void DeleteTempFiles()
|
||||||
{
|
{
|
||||||
foreach (var file in createdTempFiles)
|
foreach (var file in _CreatedTempFiles)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -251,14 +251,12 @@ namespace ChatController.HauptKlassen
|
|||||||
else
|
else
|
||||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
{
|
{
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, true, ChatMessage.File));
|
||||||
timeformated, true,ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//MP4 und gifs und so unbehandelten dreck
|
//MP4 und gifs und so unbehandelten dreck
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, true,ChatMessage.File));
|
||||||
timeformated, true,ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -296,22 +294,18 @@ namespace ChatController.HauptKlassen
|
|||||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
{
|
{
|
||||||
//Dokument
|
//Dokument
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||||
timeformated, false, ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//ALLERLEI UNBEHANDELTER KRAM
|
//ALLERLEI UNBEHANDELTER KRAM
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||||
textn,
|
|
||||||
timeformated, false, ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Message
|
//Message
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text, timeformated, false));
|
||||||
timeformated, false));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,14 +459,12 @@ namespace ChatController.HauptKlassen
|
|||||||
else
|
else
|
||||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
{
|
{
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, true, ChatMessage.File));
|
||||||
timeformated, true, ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Der Ganze Unbehndelte Kram
|
// Der Ganze Unbehndelte Kram
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, true, ChatMessage.File));
|
||||||
timeformated, true, ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -510,14 +502,12 @@ namespace ChatController.HauptKlassen
|
|||||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
{
|
{
|
||||||
//Dokument
|
//Dokument
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||||
timeformated, false, ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Der Ganze Unbehandelte Kram MP4 und So
|
//Der Ganze Unbehandelte Kram MP4 und So
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||||
timeformated, false, ChatMessage.File));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1017,14 +1007,12 @@ namespace ChatController.HauptKlassen
|
|||||||
}
|
}
|
||||||
else if (DokumentExtension.Contains(Path.GetExtension(file).ToUpperInvariant()))
|
else if (DokumentExtension.Contains(Path.GetExtension(file).ToUpperInvariant()))
|
||||||
{
|
{
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file),
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file), timeformated, ChatMessage.Smaller_Image, true,file));
|
||||||
timeformated, true,file));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//MP4 und gifs und so unbehandelten dreck
|
//MP4 und gifs und so unbehandelten dreck
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file),
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file), timeformated, ChatMessage.Smaller_Image, true, file));
|
||||||
timeformated, true, file));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1056,8 +1044,7 @@ namespace ChatController.HauptKlassen
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(filename),
|
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(filename), timeformated, ChatMessage.Smaller_Image, true, filename));
|
||||||
timeformated, true, filename));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace ChatController.HauptKlassen
|
|||||||
// Display the status.
|
// Display the status.
|
||||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||||
|
|
||||||
string responseFromServer = ReadStream(response);
|
string responseFromServer = Utilities.Utils.ReadStream(response);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -334,7 +334,7 @@ namespace ChatController.HauptKlassen
|
|||||||
// Display the status.
|
// Display the status.
|
||||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||||
|
|
||||||
string responseFromServer = ReadStream(response);
|
string responseFromServer = Utilities.Utils.ReadStream(response);
|
||||||
|
|
||||||
if (!responseFromServer.Equals(""))
|
if (!responseFromServer.Equals(""))
|
||||||
{
|
{
|
||||||
@@ -357,32 +357,6 @@ namespace ChatController.HauptKlassen
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ReadStream(WebResponse response)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Stream dataStream = response.GetResponseStream();
|
|
||||||
|
|
||||||
StreamReader reader = new StreamReader(dataStream);
|
|
||||||
|
|
||||||
string responseFromServer = reader.ReadToEnd();
|
|
||||||
|
|
||||||
|
|
||||||
dataStream.Dispose();
|
|
||||||
reader.Dispose();
|
|
||||||
|
|
||||||
dataStream.Close();
|
|
||||||
reader.Close();
|
|
||||||
|
|
||||||
return responseFromServer;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
// MessageBox.Show(e.Message);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Maximal erlaubte File Größe
|
#region Maximal erlaubte File Größe
|
||||||
|
|
||||||
public long GetMaiximumAllowedFileUploadSize(string token, string customerid)
|
public long GetMaiximumAllowedFileUploadSize(string token, string customerid)
|
||||||
@@ -405,7 +379,7 @@ namespace ChatController.HauptKlassen
|
|||||||
// Display the status.
|
// Display the status.
|
||||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||||
|
|
||||||
string responseFromServer = ReadStream(response);
|
string responseFromServer = Utilities.Utils.ReadStream(response);
|
||||||
|
|
||||||
var definiti = new {file_upload_max_size = ""};
|
var definiti = new {file_upload_max_size = ""};
|
||||||
|
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ namespace ChatController
|
|||||||
lblVersion.Content = String.Format("Version: {0}", _version);
|
lblVersion.Content = String.Format("Version: {0}", _version);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
TextBoxBenutzerName.Text = "BaeurleC";
|
TextBoxBenutzerName.Text = "JettenL";
|
||||||
TextBoxPasswort.Password = "asFdgAE5ERfdsew4!";
|
TextBoxPasswort.Password = "Blubb123";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
ChatController/Utilities/Constants.cs
Normal file
30
ChatController/Utilities/Constants.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ChatController.Utilities
|
||||||
|
{
|
||||||
|
public static class Constants
|
||||||
|
{
|
||||||
|
public static readonly List<string> ImageFileExtensions = new List<string> { ".JPG", ".JPE", ".BMP", ".GIF", ".PNG", ".JPEG" };
|
||||||
|
public static readonly List<string> DocumentFileExtension = new List<string> { ".TXT", ".PPT", ".XLS", ".DOC", ".PDF" };
|
||||||
|
|
||||||
|
public static readonly string TeamDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/team_default.png";
|
||||||
|
public static readonly string EmployeeDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/employee_default.png";
|
||||||
|
public static readonly string CustomerDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/client_default.png";
|
||||||
|
public static readonly string NormalGroupDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/mitarbeiter-team-avatar.png";
|
||||||
|
|
||||||
|
public static readonly string Token = "Token";
|
||||||
|
public static readonly string CustomerId = "CustomerID";
|
||||||
|
|
||||||
|
public static readonly string MaxUploadFileSizeUrl = "/api/ownchat/uploadmaxsize";
|
||||||
|
public static readonly string LoginWithChatCodeUrl = "/api/user/loginwithchatcode";
|
||||||
|
public static readonly string GetChatGroupsUrl = "/api/chat/groups";
|
||||||
|
public static readonly string LoadMessagesForGroupUrl = "/api/chat/messages?groupid=";
|
||||||
|
public static readonly string LoadOwnChatNewsUrl = "/api/ownchat/news/";
|
||||||
|
|
||||||
|
public static readonly string UrlPageParameter = "&page=";
|
||||||
|
|
||||||
|
public static readonly string ConfigFile = "ownChat.txt";
|
||||||
|
public static readonly string CompanyName = "beyondSoft";
|
||||||
|
public static readonly string ApplicationFolderName = "OwnChat";
|
||||||
|
}
|
||||||
|
}
|
||||||
146
ChatController/Utilities/Utils.cs
Normal file
146
ChatController/Utilities/Utils.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace ChatController.Utilities
|
||||||
|
{
|
||||||
|
public class Utils
|
||||||
|
{
|
||||||
|
public static ImageSource AvatarToImageSourceConverter(string pAvatarPath, bool pIsEmployee)
|
||||||
|
{
|
||||||
|
return CreateImageSourceFromPath(pAvatarPath, false, pIsEmployee);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageSource CreateChatGroupPictureImageSource(string pPicturePath, bool pIsGroup, bool pIsEmployee)
|
||||||
|
{
|
||||||
|
return CreateImageSourceFromPath(pPicturePath, pIsGroup, pIsEmployee);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ImageSource GetDefaultImageSource(bool pIsGroup, bool pIsEmployee)
|
||||||
|
{
|
||||||
|
var defaultImage = Constants.EmployeeDefaultImagePath;
|
||||||
|
|
||||||
|
if (pIsGroup)
|
||||||
|
{
|
||||||
|
defaultImage = pIsEmployee ? Constants.TeamDefaultImagePath : Constants.NormalGroupDefaultImagePath;
|
||||||
|
}
|
||||||
|
else if (!pIsEmployee)
|
||||||
|
{
|
||||||
|
defaultImage = Constants.CustomerDefaultImagePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
var resultBitmapImage = new BitmapImage();
|
||||||
|
|
||||||
|
resultBitmapImage.BeginInit();
|
||||||
|
resultBitmapImage.UriSource = new Uri(defaultImage);
|
||||||
|
resultBitmapImage.EndInit();
|
||||||
|
|
||||||
|
return resultBitmapImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageSource CreateImageSourceFromPath(string pPathToImageFile, bool pIsGroup = false, bool pIsEmployee = false)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(pPathToImageFile))
|
||||||
|
{
|
||||||
|
Bitmap bitmap;
|
||||||
|
var request = WebRequest.Create(pPathToImageFile);
|
||||||
|
using (var response = request.GetResponse())
|
||||||
|
{
|
||||||
|
using (var stream = response.GetResponseStream())
|
||||||
|
{
|
||||||
|
if (stream != null)
|
||||||
|
{
|
||||||
|
bitmap = new Bitmap(stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GetDefaultImageSource(pIsGroup, pIsEmployee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var memoryStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
bitmap.Save(memoryStream, ImageFormat.Png);
|
||||||
|
|
||||||
|
memoryStream.Position = 0;
|
||||||
|
|
||||||
|
var bitmapImage = new BitmapImage();
|
||||||
|
|
||||||
|
bitmapImage.BeginInit();
|
||||||
|
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
|
bitmapImage.StreamSource = memoryStream;
|
||||||
|
bitmapImage.EndInit();
|
||||||
|
|
||||||
|
memoryStream.Dispose();
|
||||||
|
memoryStream.Close();
|
||||||
|
|
||||||
|
return bitmapImage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetDefaultImageSource(pIsGroup, pIsEmployee);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageSource CreateImageSourceFromSmallerImage(string pUri)
|
||||||
|
{
|
||||||
|
Bitmap bitmap;
|
||||||
|
var request = WebRequest.Create(pUri);
|
||||||
|
using(var response = request.GetResponse())
|
||||||
|
{
|
||||||
|
using(var stream = response.GetResponseStream())
|
||||||
|
{
|
||||||
|
if(stream == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bitmap = new Bitmap(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using(var memoryStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
bitmap.Save(memoryStream, ImageFormat.Png);
|
||||||
|
memoryStream.Position = 0;
|
||||||
|
|
||||||
|
var bitmapImage = new BitmapImage();
|
||||||
|
|
||||||
|
bitmapImage.BeginInit();
|
||||||
|
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
|
bitmapImage.StreamSource = memoryStream;
|
||||||
|
bitmapImage.EndInit();
|
||||||
|
|
||||||
|
memoryStream.Dispose();
|
||||||
|
memoryStream.Close();
|
||||||
|
|
||||||
|
return bitmapImage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ReadStream(WebResponse response)
|
||||||
|
{
|
||||||
|
var dataStream = response.GetResponseStream();
|
||||||
|
|
||||||
|
if (dataStream == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reader = new StreamReader(dataStream);
|
||||||
|
var responseFromServer = reader.ReadToEnd();
|
||||||
|
|
||||||
|
dataStream.Dispose();
|
||||||
|
reader.Dispose();
|
||||||
|
|
||||||
|
dataStream.Close();
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
return responseFromServer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,51 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Threading;
|
|
||||||
using ChatController;
|
using ChatController;
|
||||||
using ChatController.HauptKlassen;
|
|
||||||
|
|
||||||
namespace ownChat
|
namespace ownChat
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für ChatEmojisView.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class ChatEmojisView
|
public partial class ChatEmojisView
|
||||||
{
|
{
|
||||||
|
|
||||||
private ChatEmoji _emojii;
|
|
||||||
|
|
||||||
public ChatEmojisView(ChatMainControl chatMainControler)
|
public ChatEmojisView(ChatMainControl chatMainControler)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
cem.InitChatView(chatMainControler);
|
cem.InitChatView(chatMainControler);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ChatEmojisView_OnFocusableChanged(object sender, EventArgs e)
|
private void ChatEmojisView_OnFocusableChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ChatEmojiView.Visibility == Visibility.Visible)
|
if (ChatEmojiView.Visibility == Visibility.Visible)
|
||||||
{
|
{
|
||||||
ChatEmojiView.Visibility = Visibility.Collapsed;
|
ChatEmojiView.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,11 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:ownChat" Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png"
|
Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png"
|
||||||
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
|
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
|
||||||
|
|
||||||
mc:Ignorable="d" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
|
mc:Ignorable="d" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
|
||||||
Title="ownChat Desktop" Height="500" Width="700" >
|
Title="ownChat Desktop" Height="500" Width="700" >
|
||||||
<Grid>
|
<Grid>
|
||||||
<cc:LoginControl OnLogin="LoginControl_OnOnLogin"></cc:LoginControl>
|
<cc:LoginControl OnLogin="LoginControl_OnOnLogin"></cc:LoginControl>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,45 +1,21 @@
|
|||||||
using System;
|
using ChatController.Klassen;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Web;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using ChatController.HauptKlassen;
|
|
||||||
using ChatController.Klassen;
|
|
||||||
|
|
||||||
namespace ownChat
|
namespace ownChat
|
||||||
{
|
{
|
||||||
/// <summary>
|
public partial class LoginMaske
|
||||||
/// Interaktionslogik für LoginMaske.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class LoginMaske : Window
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public LoginMaske()
|
public LoginMaske()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.Title = "ownChat Desktop";
|
Title = "ownChat Desktop";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LoginControl_OnOnLogin(ChatDatenUebergabe cdu)
|
private void LoginControl_OnOnLogin(ChatDatenUebergabe cdu)
|
||||||
{
|
{
|
||||||
MainWindow window = new MainWindow(cdu);
|
var mainWindow = new MainWindow(cdu);
|
||||||
window.Show();
|
mainWindow.Show();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:ownChat"
|
|
||||||
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
|
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
|
||||||
mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png"
|
mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png"
|
||||||
Title="ownChat Desktop" Height="700" Width="900" x:Name="MainView" Closed="MainWindow_OnClosed">
|
Title="ownChat Desktop" Height="700" Width="900" x:Name="MainView" Closed="MainWindow_OnClosed">
|
||||||
|
|||||||
@@ -1,133 +1,50 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.UI.WebControls;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Windows.Forms.VisualStyles;
|
|
||||||
using ChatController;
|
|
||||||
using ChatController.ChatKlassen;
|
|
||||||
using ChatController.HauptKlassen;
|
|
||||||
using ChatController.Klassen;
|
using ChatController.Klassen;
|
||||||
|
|
||||||
using Brush = System.Windows.Media.Brush;
|
|
||||||
using Button = System.Windows.Forms.Button;
|
|
||||||
using ContextMenu = System.Windows.Controls.ContextMenu;
|
|
||||||
using Image = System.Windows.Controls.Image;
|
|
||||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
|
||||||
using MenuItem = System.Windows.Controls.MenuItem;
|
|
||||||
using MessageBox = System.Windows.MessageBox;
|
|
||||||
using Path = System.IO.Path;
|
|
||||||
using Point = System.Windows.Point;
|
using Point = System.Windows.Point;
|
||||||
|
|
||||||
|
|
||||||
namespace ownChat
|
namespace ownChat
|
||||||
{
|
{
|
||||||
/// <summary>
|
public partial class MainWindow
|
||||||
/// Interaktionslogik für MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow : Window
|
|
||||||
{
|
{
|
||||||
private readonly Chat _chat;
|
private readonly ChatEmojisView _EmojiView;
|
||||||
private AktuellerKontakt _aktuellerKontakt;
|
|
||||||
|
|
||||||
private bool isChatBoxOnFocus = false;
|
|
||||||
|
|
||||||
private ChatEmojisView _emojiView;
|
|
||||||
|
|
||||||
private IOrderedEnumerable<ChatMessage> _Orderedmessagelist;
|
|
||||||
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
|
|
||||||
|
|
||||||
private readonly List<ChatMessage> _messagelist = new List<ChatMessage>();
|
|
||||||
private Thread _sendt;
|
|
||||||
private Thread _erhaltent;
|
|
||||||
|
|
||||||
public MainWindow(ChatDatenUebergabe x)
|
public MainWindow(ChatDatenUebergabe x)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
ChatMainControl.InitMitChatdaten(x);
|
ChatMainControl.InitMitChatdaten(x);
|
||||||
ChatMainControl.SetzteStyleAufNull();
|
ChatMainControl.ResetStyle();
|
||||||
//ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem);
|
|
||||||
|
|
||||||
|
|
||||||
|
_EmojiView = new ChatEmojisView(ChatMainControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChatMainControl_OnOnEmojii(System.Windows.Controls.Button emojiButton)
|
private void ChatMainControl_OnOnEmojii(System.Windows.Controls.Button emojiButton)
|
||||||
{
|
{
|
||||||
if (_emojiView == null) {
|
_EmojiView.Visibility = Visibility.Visible;
|
||||||
_emojiView = new ChatEmojisView(ChatMainControl);
|
|
||||||
|
|
||||||
var x = emojiButton.PointToScreen(new Point(0, 0));
|
var pointToScreen = emojiButton.PointToScreen(new Point(0, 0));
|
||||||
PresentationSource source = PresentationSource.FromVisual(emojiButton);
|
var presentationSource = PresentationSource.FromVisual(emojiButton);
|
||||||
|
|
||||||
_emojiView.Top = (x.Y / source.CompositionTarget.TransformToDevice.M22) - _emojiView.Height - 5; //- 5
|
if(presentationSource?.CompositionTarget != null)
|
||||||
_emojiView.Left = (x.X / source.CompositionTarget.TransformToDevice.M11) - 270; //x.X / source.CompositionTarget.TransformToDevice.M11
|
|
||||||
|
|
||||||
|
|
||||||
_emojiView.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (_emojiView.Visibility == Visibility.Visible)
|
_EmojiView.Top = pointToScreen.Y / presentationSource.CompositionTarget.TransformToDevice.M22 - _EmojiView.Height - 5;
|
||||||
{
|
_EmojiView.Left = pointToScreen.X / presentationSource.CompositionTarget.TransformToDevice.M11 - 270;
|
||||||
_emojiView.Visibility = Visibility.Collapsed;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_emojiView.Visibility = Visibility.Visible;
|
|
||||||
|
|
||||||
var x = emojiButton.PointToScreen(new Point(0, 0));
|
|
||||||
PresentationSource source = PresentationSource.FromVisual(emojiButton);
|
|
||||||
|
|
||||||
_emojiView.Top = (x.Y / source.CompositionTarget.TransformToDevice.M22) - _emojiView.Height - 5; //- 5
|
|
||||||
_emojiView.Left = (x.X / source.CompositionTarget.TransformToDevice.M11) - 270; //x.X / source.CompositionTarget.TransformToDevice.M11
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_OnClosed(object sender, EventArgs e)
|
private void MainWindow_OnClosed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//_emojiView = null;
|
|
||||||
//ChatMainControl.SpeichereMessageInfoInDatei();
|
|
||||||
//// Environment.Exit(0);
|
|
||||||
//LoginMaske newLogin = new LoginMaske();
|
|
||||||
//newLogin.Show();
|
|
||||||
|
|
||||||
ChatMainControl.SpeichereMessageInfoInDatei();
|
ChatMainControl.SpeichereMessageInfoInDatei();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChatMainControl_OnOnClose()
|
private void ChatMainControl_OnOnClose()
|
||||||
{
|
{
|
||||||
//this.Close();
|
|
||||||
ChatMainControl.SpeichereMessageInfoInDatei();
|
ChatMainControl.SpeichereMessageInfoInDatei();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user