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:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:BeWo="clr-namespace:BeWo"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace BeWo.View
|
||||
namespace ChatController
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WaitLayer.xaml
|
||||
/// </summary>
|
||||
public partial class ChatControlWaitLayer : UserControl
|
||||
public partial class ChatControlWaitLayer
|
||||
{
|
||||
public ChatControlWaitLayer()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,8 @@
|
||||
<Compile Include="ChatControlWaitLayer.xaml.cs">
|
||||
<DependentUpon>ChatControlWaitLayer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\Constants.cs" />
|
||||
<Compile Include="Utilities\Utils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="ChatEmojiiControl.xaml">
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ChatController.ChatKlassen
|
||||
{
|
||||
public class ChatMessage
|
||||
{
|
||||
//Chat Ansicht
|
||||
//Chat-Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme)
|
||||
{
|
||||
Username = username;
|
||||
@@ -17,17 +17,11 @@ namespace ChatController.ChatKlassen
|
||||
IsMyMessage = isme;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
if (IsHyperlink(message))
|
||||
{
|
||||
VisibilityRegelung("HyperlinkMessage");
|
||||
}
|
||||
else {
|
||||
VisibilityRegelung("Message");
|
||||
}
|
||||
|
||||
VisibilityRegelung(IsHyperlink(message) ? "HyperlinkMessage" : "Message");
|
||||
}
|
||||
|
||||
// Image Ansicht
|
||||
// Image-Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
@@ -44,7 +38,7 @@ namespace ChatController.ChatKlassen
|
||||
VisibilityRegelung("Image");
|
||||
}
|
||||
|
||||
//Image PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
|
||||
//Image-PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
@@ -59,21 +53,25 @@ namespace ChatController.ChatKlassen
|
||||
VisibilityRegelung("Default_Image");
|
||||
}
|
||||
|
||||
//Dokument Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string url)
|
||||
//Dokumenten-Ansicht
|
||||
public ChatMessage(string username, string message, DateTime sendtime, string pSmallerImagePath, bool isme, string url)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
IsMyMessage = isme;
|
||||
|
||||
Dokpfad = (object) url;
|
||||
Dokpfad = url;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
VisibilityRegelung("Dokumente");
|
||||
Thumbnail = Utilities.Utils.CreateImageSourceFromPath(pSmallerImagePath);
|
||||
|
||||
VisibilityRegelung("Dokumente");
|
||||
}
|
||||
|
||||
public ImageSource Thumbnail { get; }
|
||||
|
||||
#region Farbgebung
|
||||
private void Farbgebung(bool isme)
|
||||
{
|
||||
@@ -151,32 +149,21 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
public static bool IsHyperlink(string word)
|
||||
{
|
||||
// First check to make sure the word has at least one of the characters we need to make a hyperlink
|
||||
try
|
||||
{
|
||||
if (word.IndexOfAny(@":.\/".ToCharArray()) != -1)
|
||||
{
|
||||
if (Uri.IsWellFormedUriString(word, UriKind.Absolute))
|
||||
{
|
||||
// The string is an Absolute URI
|
||||
if (word.StartsWith("http://")) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return word.StartsWith("http://");
|
||||
}
|
||||
else if (UrlRegex.IsMatch(word))
|
||||
|
||||
if (UrlRegex.IsMatch(word))
|
||||
{
|
||||
//hier der Bereich hin der die uri splittet wenn neben dem link auch text gesendet wird
|
||||
|
||||
|
||||
Uri uri = new Uri(word, UriKind.RelativeOrAbsolute);
|
||||
var uri = new Uri(word, UriKind.RelativeOrAbsolute);
|
||||
|
||||
if (!uri.IsAbsoluteUri)
|
||||
{
|
||||
// rebuild it it with http to turn it into an Absolute URI
|
||||
uri = new Uri(@"http://" + word, UriKind.Absolute);
|
||||
}
|
||||
|
||||
@@ -201,93 +188,79 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Variablen
|
||||
|
||||
public bool IsMyMessage { get; set; }
|
||||
public string Username { get; private set; }
|
||||
public string UserMessage { get; private set; }
|
||||
public DateTime SendTime { get; private set; }
|
||||
public string Username { get; }
|
||||
public string UserMessage { get; }
|
||||
public DateTime SendTime { get; }
|
||||
|
||||
public string UserTimeStringLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsMyMessage)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Username; //String.Format("{0} {1}", Username, SendTimeString);
|
||||
}
|
||||
}
|
||||
public string UserTimeStringLeft => IsMyMessage ? null : Username;
|
||||
|
||||
public string UserTimeStringRight
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (!IsMyMessage)
|
||||
//{
|
||||
// return null;
|
||||
//}
|
||||
return SendTimeString;
|
||||
}
|
||||
}
|
||||
public string UserTimeStringRight => SendTimeString;
|
||||
|
||||
public string SendTimeString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SendTime.Date == DateTime.Today)
|
||||
{
|
||||
return String.Format("Heute {0:HH:mm}", SendTime);
|
||||
}
|
||||
return SendTime.ToString("dd.MMM HH:mm");
|
||||
}
|
||||
}
|
||||
//public long MessagePersonOid { get; private set; }
|
||||
public string SendTimeString => SendTime.Date == DateTime.Today ? $"Heute {SendTime:HH:mm}" : SendTime.ToString("dd.MMM HH:mm");
|
||||
|
||||
public Brush ChatColor { get; private set; }
|
||||
|
||||
public string Posi { get; private set; }
|
||||
|
||||
public string OriginalImage { get; private set; }
|
||||
public string OriginalImageName { get; private set; }
|
||||
public string OriginalImage { get; }
|
||||
public string OriginalImageName { get; }
|
||||
|
||||
public Visibility ChatVisibility { get; set; }
|
||||
public Visibility HyperlinkVisibility { get; set; }
|
||||
|
||||
|
||||
private Visibility _pictureVisibility;
|
||||
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
|
||||
public Visibility PictureVisibility
|
||||
{
|
||||
get => _pictureVisibility;
|
||||
set
|
||||
{
|
||||
_pictureVisibility = value;
|
||||
OnPropertyChanged(nameof(PictureVisibility));
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _picturePlaceHolderVisibility;
|
||||
public Visibility PicturePlaceHolderVisibility { get { return _picturePlaceHolderVisibility; } set { _picturePlaceHolderVisibility = value; OnPropertyChanged("PicturePlaceHolderVisibility"); } }
|
||||
public Visibility PicturePlaceHolderVisibility
|
||||
{
|
||||
get => _picturePlaceHolderVisibility;
|
||||
set
|
||||
{
|
||||
_picturePlaceHolderVisibility = value;
|
||||
OnPropertyChanged(nameof(PicturePlaceHolderVisibility));
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _gifPictureVisibility;
|
||||
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
|
||||
|
||||
public Visibility GifPictureVisibility
|
||||
{
|
||||
get => _gifPictureVisibility;
|
||||
set
|
||||
{
|
||||
_gifPictureVisibility = value;
|
||||
OnPropertyChanged(nameof(GifPictureVisibility));
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility DokumentVisibility { get; set; }
|
||||
public ImageSource ImageSources { get; private set; }
|
||||
public object Dokpfad { get; private set; }
|
||||
public ImageSource ImageSources { get; }
|
||||
public object Dokpfad { get; }
|
||||
|
||||
public long? ChatMessageOid { get; private set; }
|
||||
|
||||
|
||||
//Farbe Links MEssageHeader
|
||||
private Brush _farbeLinksColor;
|
||||
public Brush FarbeLinksColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeLinksColor;
|
||||
}
|
||||
get => _farbeLinksColor;
|
||||
set
|
||||
{
|
||||
|
||||
_farbeLinksColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeLinksColor");
|
||||
OnPropertyChanged(nameof(FarbeLinksColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,31 +268,22 @@ namespace ChatController.ChatKlassen
|
||||
private Brush _farbeRechtsColor;
|
||||
public Brush FarbeRechtsColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeRechtsColor;
|
||||
}
|
||||
get => _farbeRechtsColor;
|
||||
set
|
||||
{
|
||||
|
||||
_farbeRechtsColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeRechtsColor");
|
||||
OnPropertyChanged(nameof(FarbeRechtsColor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
<!--Dokument bereich -->
|
||||
<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" />
|
||||
<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"/>
|
||||
<!-- <Button HorizontalAlignment="Center" VerticalAlignment="Center" Content="Dokument Anzeigen" Height="25" Tag="{Binding Dokpfad}" Click="OpenDokument_OnClick " >
|
||||
<Button.Resources>
|
||||
|
||||
@@ -4,65 +4,53 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media.TextFormatting;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using BeWo.View;
|
||||
|
||||
using ChatController.ChatKlassen;
|
||||
using ChatController.HauptKlassen;
|
||||
using ChatController.Klassen;
|
||||
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace ChatController
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ChatMainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ChatMainControl : UserControl
|
||||
public partial class ChatMainControl
|
||||
{
|
||||
#region Vokabeln
|
||||
private Chat _chat;
|
||||
private AktuellerKontakt _aktuellerKontakt;
|
||||
private Chat _Chat;
|
||||
private AktuellerKontakt _AktuellerKontakt;
|
||||
|
||||
private bool isChatBoxOnFocus = false;
|
||||
private bool _IsChatBoxOnFocus;
|
||||
|
||||
private ChatEmojiiControl _emojiView;
|
||||
private ChatEmojiiControl _EmojiView;
|
||||
|
||||
private IOrderedEnumerable<ChatMessage> _Orderedmessagelist;
|
||||
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
|
||||
private IOrderedEnumerable<ChatMessage> _OrderedMessages;
|
||||
private IOrderedEnumerable<KontaktlistBuilder> _ContactList;
|
||||
|
||||
private ChatDatenUebergabe _chatDaten;
|
||||
private bool _ScrollPrueferAktivieren;
|
||||
|
||||
private bool scrollPrueferAktivieren = false;
|
||||
|
||||
public Thread newThread;
|
||||
private Thread _NewThread;
|
||||
public bool disableKontaktNachrichtenThread = true;
|
||||
|
||||
public Thread AlleKontakteThread;
|
||||
public bool AlleNachrichtenThreadBool = true;
|
||||
private double? AlleNachrichtenCount = null;
|
||||
private List<String> createdTempFiles = new List<String>();
|
||||
private Thread _AlleKontakteThread;
|
||||
public bool _AlleNachrichtenThreadBool = true;
|
||||
private readonly 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 event CloseDelegate OnClose;
|
||||
|
||||
private bool _isDesktopVersion = true;
|
||||
private bool _IsDesktopVersion = true;
|
||||
#endregion
|
||||
|
||||
public ChatMainControl()
|
||||
@@ -73,14 +61,13 @@ namespace ChatController
|
||||
|
||||
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;
|
||||
|
||||
HorcheAlleGruppenNachrichten();
|
||||
@@ -89,73 +76,50 @@ namespace ChatController
|
||||
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 null;
|
||||
}
|
||||
|
||||
return kontakt;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return kontakt?.CustomerOid == null ? null : kontakt;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return itemListe.Count > 0 ? itemListe : null;
|
||||
}
|
||||
|
||||
#region Style setter für ownChatDesktop Version
|
||||
public void SetzteStyleAufNull()
|
||||
public void ResetStyle()
|
||||
{
|
||||
EmojiButton.Style = null;
|
||||
MediaButton.Style = null;
|
||||
ReloadGruppen.Visibility = Visibility.Visible;
|
||||
_isDesktopVersion = false;
|
||||
_IsDesktopVersion = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Lade KontaktDaten und Lade sie in den Chat
|
||||
private void AktChatUser_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
_chat.ShowKontaktPicture(_aktuellerKontakt);
|
||||
_Chat.ShowKontaktPicture(_AktuellerKontakt);
|
||||
}
|
||||
|
||||
private void Clientlist_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if(Clientlist.SelectedItem != null)
|
||||
{
|
||||
// StartWaiting();
|
||||
disableKontaktNachrichtenThread = true;
|
||||
Cursor = Cursors.Wait;
|
||||
scrollPrueferAktivieren = false;
|
||||
_ScrollPrueferAktivieren = false;
|
||||
ChatListBox.ItemsSource = null;
|
||||
|
||||
AktChatUserList.Items.Clear();
|
||||
@@ -171,38 +135,28 @@ namespace ChatController
|
||||
var aktuellerKontakt = new AktuellerKontakt(kontakt);
|
||||
|
||||
AktChatUserList.Items.Add(aktuellerKontakt);
|
||||
_aktuellerKontakt = aktuellerKontakt;
|
||||
_AktuellerKontakt = aktuellerKontakt;
|
||||
|
||||
var x = _chat.LadeChatNachrichtenVomKontakt(aktuellerKontakt);
|
||||
var chatMessages = _Chat.LadeChatNachrichtenVomKontakt(aktuellerKontakt);
|
||||
|
||||
ChatListBox.ItemsSource = x;
|
||||
|
||||
//ChatListBox.Items.MoveCurrentToLast();
|
||||
//ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
ChatListBox.ItemsSource = chatMessages;
|
||||
|
||||
if (VisualTreeHelper.GetChildrenCount(ChatListBox) > 0)
|
||||
{
|
||||
Border border = (Border)VisualTreeHelper.GetChild(ChatListBox, 0);
|
||||
ScrollViewer scrollViewer = (ScrollViewer)VisualTreeHelper.GetChild(border, 0);
|
||||
var border = (Border) VisualTreeHelper.GetChild(ChatListBox, 0);
|
||||
var scrollViewer = (ScrollViewer) VisualTreeHelper.GetChild(border, 0);
|
||||
scrollViewer.ScrollToBottom();
|
||||
}
|
||||
|
||||
//if (ChatListBox.Items.Count > 0)
|
||||
//{
|
||||
// ChatListBox.SelectedIndex = ChatListBox.Items.Count - 1;
|
||||
// ChatListBox.ScrollIntoView(ChatListBox.SelectedItem);
|
||||
//}
|
||||
|
||||
ChatListBox.ContextMenu = _chat.ErstelleKontextMenue();
|
||||
ChatListBox.ContextMenu = _Chat.ErstelleKontextMenue();
|
||||
SetContextHandler();
|
||||
scrollPrueferAktivieren = true;
|
||||
_ScrollPrueferAktivieren = true;
|
||||
|
||||
HorcheAktivNachNachrichten();
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
|
||||
disableKontaktNachrichtenThread = false;
|
||||
// EndWaiting();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -213,9 +167,9 @@ namespace ChatController
|
||||
{
|
||||
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();
|
||||
|
||||
@@ -249,14 +203,14 @@ namespace ChatController
|
||||
{
|
||||
var item = (ChatMessage)items;
|
||||
|
||||
_chat.SpeichernUnterFunkion(item);
|
||||
_Chat.SpeichernUnterFunkion(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
_chat.Einfuegen(kontakt.GroupId,this);
|
||||
_Chat.Einfuegen(kontakt.GroupId,this);
|
||||
}
|
||||
|
||||
private void Item4OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
@@ -270,7 +224,7 @@ namespace ChatController
|
||||
}
|
||||
|
||||
if(!chatmessages.Equals(""))
|
||||
_chat.Kopieren(chatmessages, 1);
|
||||
_Chat.Kopieren(chatmessages, 1);
|
||||
}
|
||||
|
||||
private void Chat_OnContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||
@@ -374,9 +328,9 @@ namespace ChatController
|
||||
|
||||
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
|
||||
@@ -388,21 +342,21 @@ namespace ChatController
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
var medium = _chat.HoleMedium();
|
||||
var medium = _Chat.HoleMedium();
|
||||
|
||||
if(medium != null) {
|
||||
|
||||
string convertetMedia = _chat.ScaleImage(medium, Path.GetExtension(medium.ToUpperInvariant()));
|
||||
string convertetMedia = _Chat.ScaleImage(medium, Path.GetExtension(medium.ToUpperInvariant()));
|
||||
|
||||
if (!convertetMedia.Equals(""))
|
||||
{
|
||||
_chat.AddeMediumDerNachrichtView(convertetMedia,medium);
|
||||
_Chat.AddeMediumDerNachrichtView(convertetMedia,medium);
|
||||
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
_chat.SendeMediumAnKontakt(kontakt, convertetMedia,medium);
|
||||
_Chat.SendeMediumAnKontakt(kontakt, convertetMedia,medium);
|
||||
|
||||
if (!convertetMedia.Equals("") && !convertetMedia.Equals(medium) && File.Exists(convertetMedia))
|
||||
{
|
||||
@@ -425,20 +379,20 @@ namespace ChatController
|
||||
#region Sende Normale Nachrichten
|
||||
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(""))
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
_chat.AddeNachrichtDerView(Chatbox.Text);
|
||||
_Chat.AddeNachrichtDerView(Chatbox.Text);
|
||||
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
_Chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
|
||||
Chatbox.Text = "";
|
||||
|
||||
@@ -446,7 +400,7 @@ namespace ChatController
|
||||
{
|
||||
Chatbox.Text = "Nachricht schreiben";
|
||||
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
||||
isChatBoxOnFocus = false;
|
||||
_IsChatBoxOnFocus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -459,7 +413,7 @@ namespace ChatController
|
||||
{
|
||||
Chatbox.Text = "Nachricht schreiben";
|
||||
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
||||
isChatBoxOnFocus = false;
|
||||
_IsChatBoxOnFocus = false;
|
||||
}
|
||||
}
|
||||
else if (Chatbox.Text.Equals(""))
|
||||
@@ -469,7 +423,7 @@ namespace ChatController
|
||||
{
|
||||
Chatbox.Text = "Nachricht schreiben";
|
||||
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
|
||||
isChatBoxOnFocus = false;
|
||||
_IsChatBoxOnFocus = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,7 +435,7 @@ namespace ChatController
|
||||
{
|
||||
Chatbox.Text = "";
|
||||
Chatbox.Foreground = new SolidColorBrush(Colors.Black);
|
||||
isChatBoxOnFocus = true;
|
||||
_IsChatBoxOnFocus = true;
|
||||
}
|
||||
|
||||
//hier bereich wie Dokumentieren
|
||||
@@ -497,13 +451,13 @@ namespace ChatController
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
_chat.AddeNachrichtDerView(Chatbox.Text);
|
||||
_Chat.AddeNachrichtDerView(Chatbox.Text);
|
||||
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
_Chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
|
||||
|
||||
Chatbox.Text = "";
|
||||
@@ -554,7 +508,7 @@ namespace ChatController
|
||||
if (scrollBar.Orientation == Orientation.Horizontal)
|
||||
{
|
||||
scrollBar.ValueChanged += HorizontalScrollbarChanged;
|
||||
scrollPrueferAktivieren = true;
|
||||
_ScrollPrueferAktivieren = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -565,7 +519,7 @@ namespace ChatController
|
||||
|
||||
private void VerticalScrollbarChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
|
||||
{
|
||||
if (scrollPrueferAktivieren == true)
|
||||
if (_ScrollPrueferAktivieren == true)
|
||||
{
|
||||
var x = (ScrollBar) sender;
|
||||
|
||||
@@ -577,7 +531,7 @@ namespace ChatController
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
//StartWaiting();
|
||||
scrollPrueferAktivieren = false;
|
||||
_ScrollPrueferAktivieren = false;
|
||||
|
||||
ChatListBox.Items.MoveCurrentToFirst();
|
||||
ChatMessage item = ChatListBox.Items.CurrentItem as ChatMessage;
|
||||
@@ -586,7 +540,7 @@ namespace ChatController
|
||||
|
||||
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
|
||||
|
||||
var xy = _chat.LadeWeiterNachrichten(kontakt);
|
||||
var xy = _Chat.LadeWeiterNachrichten(kontakt);
|
||||
|
||||
ChatListBox.ItemsSource = xy;
|
||||
|
||||
@@ -636,18 +590,18 @@ namespace ChatController
|
||||
|
||||
private void HorcheAktivNachNachrichten()
|
||||
{
|
||||
if (newThread != null)
|
||||
if (_NewThread != null)
|
||||
{
|
||||
newThread.Join();
|
||||
newThread = null;
|
||||
_NewThread.Join();
|
||||
_NewThread = null;
|
||||
}
|
||||
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
//thred besser verwalten
|
||||
newThread = new Thread(DoWork);
|
||||
newThread.IsBackground = true;
|
||||
newThread.Start(kontakt);
|
||||
_NewThread = new Thread(DoWork);
|
||||
_NewThread.IsBackground = true;
|
||||
_NewThread.Start(kontakt);
|
||||
|
||||
}
|
||||
|
||||
@@ -662,7 +616,7 @@ namespace ChatController
|
||||
|
||||
if (!disableKontaktNachrichtenThread)
|
||||
{
|
||||
_schaueNachMs = _chat.SchaueNachNeuenNachrichten(kontakt);
|
||||
_schaueNachMs = _Chat.SchaueNachNeuenNachrichten(kontakt);
|
||||
|
||||
if (_schaueNachMs == true)
|
||||
{
|
||||
@@ -674,7 +628,7 @@ namespace ChatController
|
||||
if (kontakt != null)
|
||||
{
|
||||
|
||||
var x = _chat.LadeChatNachrichtenVomKontakt(kontakt);
|
||||
var x = _Chat.LadeChatNachrichtenVomKontakt(kontakt);
|
||||
|
||||
CollectionViewSource.GetDefaultView(ChatListBox.ItemsSource).Refresh();
|
||||
|
||||
@@ -700,16 +654,16 @@ namespace ChatController
|
||||
#region Für alle Nachrichten Count Listener
|
||||
private void HorcheAlleGruppenNachrichten()
|
||||
{
|
||||
AlleKontakteThread = new Thread(DoWorkAlleNachrichten);
|
||||
AlleKontakteThread.IsBackground = true;
|
||||
AlleKontakteThread.Start();
|
||||
_AlleKontakteThread = new Thread(DoWorkAlleNachrichten);
|
||||
_AlleKontakteThread.IsBackground = true;
|
||||
_AlleKontakteThread.Start();
|
||||
}
|
||||
|
||||
private void DoWorkAlleNachrichten()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
var x = _chat.SchaueNachAllenMessageCounts();
|
||||
var x = _Chat.SchaueNachAllenMessageCounts();
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
@@ -717,7 +671,7 @@ namespace ChatController
|
||||
DispatcherPriority.Background,
|
||||
(Action)delegate
|
||||
{
|
||||
var alist = _chat.NeueGroupklassenKontakte();
|
||||
var alist = _Chat.NeueGroupklassenKontakte();
|
||||
|
||||
AktuellerKontakt aktuellerKontakt = null;
|
||||
|
||||
@@ -726,7 +680,7 @@ namespace ChatController
|
||||
aktuellerKontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
}
|
||||
|
||||
foreach (var liste in _kontaktlist)
|
||||
foreach (var liste in _ContactList)
|
||||
{
|
||||
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
|
||||
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
|
||||
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;
|
||||
}
|
||||
@@ -814,7 +768,7 @@ namespace ChatController
|
||||
if (item != null && item.ImageSources != null)
|
||||
{
|
||||
StartWaiting();
|
||||
_chat.ShowPicture(item, EndWaiting);
|
||||
_Chat.ShowPicture(item, EndWaiting);
|
||||
}
|
||||
else if(item != null && item.Dokpfad != null)
|
||||
{
|
||||
@@ -864,7 +818,7 @@ namespace ChatController
|
||||
StartWaiting();
|
||||
|
||||
string path = Path.Combine(Path.GetTempPath(), filename);
|
||||
createdTempFiles.Add(path);
|
||||
_CreatedTempFiles.Add(path);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
@@ -956,11 +910,11 @@ namespace ChatController
|
||||
|
||||
SpeichereMessageInfoInDatei();
|
||||
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
var aktuelleGruppen = _Chat.GruppenAktuallisieren();
|
||||
|
||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
var x = _Chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
|
||||
_kontaktlist = x;
|
||||
_ContactList = x;
|
||||
|
||||
LeseMessageInfoAusDatei();
|
||||
|
||||
@@ -980,7 +934,7 @@ namespace ChatController
|
||||
public void SpeichereMessageInfoInDatei()
|
||||
{
|
||||
List<KontaktlistBuilder> aa = new List<KontaktlistBuilder>();
|
||||
foreach (var kontakt in _kontaktlist)
|
||||
foreach (var kontakt in _ContactList)
|
||||
{
|
||||
if(kontakt.SetzeGelesen == 0 && !kontakt.ReceiveMs.Equals("")) {
|
||||
aa.Add(kontakt);
|
||||
@@ -988,21 +942,21 @@ namespace ChatController
|
||||
}
|
||||
|
||||
if(aa.Count>0)
|
||||
_chat.SpeichereTimeStampsInDatei(aa);
|
||||
_Chat.SpeichereTimeStampsInDatei(aa);
|
||||
}
|
||||
|
||||
public void LeseMessageInfoAusDatei()
|
||||
{
|
||||
List<KontaktlistBuilder> aa = new List<KontaktlistBuilder>();
|
||||
foreach (var kontakt in _kontaktlist)
|
||||
foreach (var kontakt in _ContactList)
|
||||
{
|
||||
aa.Add(kontakt);
|
||||
}
|
||||
|
||||
var liste = _chat.PruefeTimeStampsBeiStart(aa);
|
||||
var liste = _Chat.PruefeTimeStampsBeiStart(aa);
|
||||
|
||||
if(liste != null) {
|
||||
foreach (var kon in _kontaktlist)
|
||||
foreach (var kon in _ContactList)
|
||||
{
|
||||
foreach (var item in liste)
|
||||
{
|
||||
@@ -1041,7 +995,7 @@ namespace ChatController
|
||||
{
|
||||
if (liste != null)
|
||||
{
|
||||
foreach (var kon in _kontaktlist)
|
||||
foreach (var kon in _ContactList)
|
||||
{
|
||||
foreach (var item in liste)
|
||||
{
|
||||
@@ -1058,7 +1012,7 @@ namespace ChatController
|
||||
|
||||
public void DeleteTempFiles()
|
||||
{
|
||||
foreach (var file in createdTempFiles)
|
||||
foreach (var file in _CreatedTempFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -251,14 +251,12 @@ namespace ChatController.HauptKlassen
|
||||
else
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, true,ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, true, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
//MP4 und gifs und so unbehandelten dreck
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, true,ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, true,ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -296,22 +294,18 @@ namespace ChatController.HauptKlassen
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
//Dokument
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
//ALLERLEI UNBEHANDELTER KRAM
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,
|
||||
textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Message
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text,
|
||||
timeformated, false));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, ChatMessage.Text, timeformated, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,14 +459,12 @@ namespace ChatController.HauptKlassen
|
||||
else
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, true, ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, true, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Der Ganze Unbehndelte Kram
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, true, ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, true, ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -510,14 +502,12 @@ namespace ChatController.HauptKlassen
|
||||
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||
{
|
||||
//Dokument
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Der Ganze Unbehandelte Kram MP4 und So
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn,
|
||||
timeformated, false, ChatMessage.File));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name,textn, timeformated, ChatMessage.Smaller_Image, false, ChatMessage.File));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1017,14 +1007,12 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
else if (DokumentExtension.Contains(Path.GetExtension(file).ToUpperInvariant()))
|
||||
{
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated, true,file));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file), timeformated, ChatMessage.Smaller_Image, true,file));
|
||||
}
|
||||
else
|
||||
{
|
||||
//MP4 und gifs und so unbehandelten dreck
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file),
|
||||
timeformated, true, file));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(file), timeformated, ChatMessage.Smaller_Image, true, file));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1056,8 +1044,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(filename),
|
||||
timeformated, true, filename));
|
||||
Messages.Add(new ChatMessage(ChatMessage.User_Name, Path.GetFileName(filename), timeformated, ChatMessage.Smaller_Image, true, filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace ChatController.HauptKlassen
|
||||
// Display the status.
|
||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||
|
||||
string responseFromServer = ReadStream(response);
|
||||
string responseFromServer = Utilities.Utils.ReadStream(response);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -334,7 +334,7 @@ namespace ChatController.HauptKlassen
|
||||
// Display the status.
|
||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||
|
||||
string responseFromServer = ReadStream(response);
|
||||
string responseFromServer = Utilities.Utils.ReadStream(response);
|
||||
|
||||
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
|
||||
|
||||
public long GetMaiximumAllowedFileUploadSize(string token, string customerid)
|
||||
@@ -405,7 +379,7 @@ namespace ChatController.HauptKlassen
|
||||
// Display the status.
|
||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||
|
||||
string responseFromServer = ReadStream(response);
|
||||
string responseFromServer = Utilities.Utils.ReadStream(response);
|
||||
|
||||
var definiti = new {file_upload_max_size = ""};
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ namespace ChatController
|
||||
lblVersion.Content = String.Format("Version: {0}", _version);
|
||||
|
||||
#if DEBUG
|
||||
TextBoxBenutzerName.Text = "BaeurleC";
|
||||
TextBoxPasswort.Password = "asFdgAE5ERfdsew4!";
|
||||
TextBoxBenutzerName.Text = "JettenL";
|
||||
TextBoxPasswort.Password = "Blubb123";
|
||||
#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.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.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.HauptKlassen;
|
||||
|
||||
namespace ownChat
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für ChatEmojisView.xaml
|
||||
/// </summary>
|
||||
public partial class ChatEmojisView
|
||||
{
|
||||
|
||||
private ChatEmoji _emojii;
|
||||
|
||||
public ChatEmojisView(ChatMainControl chatMainControler)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
cem.InitChatView(chatMainControler);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ChatEmojisView_OnFocusableChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (ChatEmojiView.Visibility == Visibility.Visible)
|
||||
{
|
||||
ChatEmojiView.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
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"
|
||||
|
||||
mc:Ignorable="d" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
|
||||
Title="ownChat Desktop" Height="500" Width="700" >
|
||||
<Grid>
|
||||
<cc:LoginControl OnLogin="LoginControl_OnOnLogin"></cc:LoginControl>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -1,45 +1,21 @@
|
||||
using System;
|
||||
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;
|
||||
using ChatController.Klassen;
|
||||
|
||||
namespace ownChat
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für LoginMaske.xaml
|
||||
/// </summary>
|
||||
public partial class LoginMaske : Window
|
||||
public partial class LoginMaske
|
||||
{
|
||||
|
||||
public LoginMaske()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.Title = "ownChat Desktop";
|
||||
Title = "ownChat Desktop";
|
||||
}
|
||||
|
||||
|
||||
private void LoginControl_OnOnLogin(ChatDatenUebergabe cdu)
|
||||
{
|
||||
MainWindow window = new MainWindow(cdu);
|
||||
window.Show();
|
||||
var mainWindow = new MainWindow(cdu);
|
||||
mainWindow.Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ownChat"
|
||||
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
|
||||
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">
|
||||
|
||||
@@ -1,133 +1,50 @@
|
||||
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.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 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;
|
||||
|
||||
|
||||
namespace ownChat
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
public partial class MainWindow
|
||||
{
|
||||
private readonly Chat _chat;
|
||||
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;
|
||||
private readonly ChatEmojisView _EmojiView;
|
||||
|
||||
public MainWindow(ChatDatenUebergabe x)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
ChatMainControl.InitMitChatdaten(x);
|
||||
ChatMainControl.SetzteStyleAufNull();
|
||||
//ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem);
|
||||
|
||||
ChatMainControl.ResetStyle();
|
||||
|
||||
_EmojiView = new ChatEmojisView(ChatMainControl);
|
||||
}
|
||||
|
||||
private void ChatMainControl_OnOnEmojii(System.Windows.Controls.Button emojiButton)
|
||||
{
|
||||
if (_emojiView == null) {
|
||||
_emojiView = new ChatEmojisView(ChatMainControl);
|
||||
_EmojiView.Visibility = Visibility.Visible;
|
||||
|
||||
var x = emojiButton.PointToScreen(new Point(0, 0));
|
||||
PresentationSource source = PresentationSource.FromVisual(emojiButton);
|
||||
var pointToScreen = emojiButton.PointToScreen(new Point(0, 0));
|
||||
var presentationSource = 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
|
||||
|
||||
|
||||
_emojiView.Show();
|
||||
}
|
||||
else
|
||||
if(presentationSource?.CompositionTarget != null)
|
||||
{
|
||||
if (_emojiView.Visibility == Visibility.Visible)
|
||||
{
|
||||
_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
|
||||
}
|
||||
_EmojiView.Top = pointToScreen.Y / presentationSource.CompositionTarget.TransformToDevice.M22 - _EmojiView.Height - 5;
|
||||
_EmojiView.Left = pointToScreen.X / presentationSource.CompositionTarget.TransformToDevice.M11 - 270;
|
||||
}
|
||||
}
|
||||
|
||||
private void MainWindow_OnClosed(object sender, EventArgs e)
|
||||
{
|
||||
//_emojiView = null;
|
||||
//ChatMainControl.SpeichereMessageInfoInDatei();
|
||||
//// Environment.Exit(0);
|
||||
//LoginMaske newLogin = new LoginMaske();
|
||||
//newLogin.Show();
|
||||
|
||||
ChatMainControl.SpeichereMessageInfoInDatei();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private void ChatMainControl_OnOnClose()
|
||||
{
|
||||
//this.Close();
|
||||
ChatMainControl.SpeichereMessageInfoInDatei();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user