diff --git a/ChatController/ChatControlWaitLayer.xaml b/ChatController/ChatControlWaitLayer.xaml
new file mode 100644
index 0000000..4feacf5
--- /dev/null
+++ b/ChatController/ChatControlWaitLayer.xaml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ChatController/ChatControlWaitLayer.xaml.cs b/ChatController/ChatControlWaitLayer.xaml.cs
new file mode 100644
index 0000000..496b153
--- /dev/null
+++ b/ChatController/ChatControlWaitLayer.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace BeWo.View
+{
+ ///
+ /// Interaction logic for WaitLayer.xaml
+ ///
+ public partial class ChatControlWaitLayer : UserControl
+ {
+ public ChatControlWaitLayer()
+ {
+ this.InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ChatController/ChatController.csproj b/ChatController/ChatController.csproj
index 683b040..5a38ec1 100644
--- a/ChatController/ChatController.csproj
+++ b/ChatController/ChatController.csproj
@@ -58,6 +58,7 @@
ChatEmojiiControl.xaml
+
@@ -76,6 +77,9 @@
+
+ ChatControlWaitLayer.xaml
+
@@ -90,6 +94,10 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
diff --git a/ChatController/ChatKlassen/ChatControlExtensions.cs b/ChatController/ChatKlassen/ChatControlExtensions.cs
new file mode 100644
index 0000000..0207ef9
--- /dev/null
+++ b/ChatController/ChatKlassen/ChatControlExtensions.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Windows.Threading;
+using System.Windows;
+
+namespace ChatController.ChatKlassen
+{
+ public static class ChatControlExtensions
+ {
+ private static Action EmptyDelegatee = delegate() { };
+
+ public static void RefreshChatUI(this UIElement uiElement)
+ {
+ uiElement.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegatee);
+ }
+ }
+}
\ No newline at end of file
diff --git a/ChatController/ChatMainControl.xaml b/ChatController/ChatMainControl.xaml
index 8c12616..a89bb75 100644
--- a/ChatController/ChatMainControl.xaml
+++ b/ChatController/ChatMainControl.xaml
@@ -181,7 +181,7 @@
-
+
@@ -254,7 +254,7 @@
-
+
@@ -276,11 +276,12 @@
-
+
+
-
+
+
@@ -329,11 +330,11 @@
diff --git a/ChatController/ChatMainControl.xaml.cs b/ChatController/ChatMainControl.xaml.cs
index 4f2f9e6..1698f00 100644
--- a/ChatController/ChatMainControl.xaml.cs
+++ b/ChatController/ChatMainControl.xaml.cs
@@ -18,6 +18,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
+using BeWo.View;
using ChatController.ChatKlassen;
using ChatController.HauptKlassen;
using ChatController.Klassen;
@@ -77,7 +78,7 @@ namespace ChatController
HorcheAlleGruppenNachrichten();
}
-
+
public AktuellerKontakt GetAktuellenKontakt()
{
if (AktChatUser != null)
@@ -129,7 +130,10 @@ namespace ChatController
private void Clientlist_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
- if(Clientlist.SelectedItem != null) {
+ if(Clientlist.SelectedItem != null)
+ {
+
+ StartWaiting();
Cursor = Cursors.Wait;
scrollPrueferAktivieren = false;
@@ -163,6 +167,8 @@ namespace ChatController
HorcheAktivNachNachrichten();
Cursor = Cursors.Arrow;
+
+ EndWaiting();
}
}
@@ -211,11 +217,9 @@ namespace ChatController
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
_chat.Einfuegen(kontakt.GroupId);
}
-
- //Bug Wegen Klient und so
+
private void Chat_OnContextMenuOpening(object sender, ContextMenuEventArgs e)
{
- //prüfe ob ein Bild angeclickt wurde
var chatItems = Chat.SelectedItems;
if (chatItems.Count > 0)
@@ -274,15 +278,21 @@ namespace ChatController
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
}
-
- //Bug prüfe ob der aktulle Chat partner ein Klient ist
+ //prüfe ob dokumentation erlaubt
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
- if (true && Chat.ContextMenu.Items.Count > 2)
+ if (kontakt.CustomerPersonOid == null && Chat.ContextMenu.Items.Count > 2)
{
var contextItems = Chat.ContextMenu.Items;
var ContextItemSpeichernUnter = (MenuItem)contextItems[2];
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
}
+ else if(Chat.ContextMenu.Items.Count > 2)
+ {
+ var contextItems = Chat.ContextMenu.Items;
+ var ContextItemSpeichernUnter = (MenuItem)contextItems[2];
+ ContextItemSpeichernUnter.Visibility = Visibility.Visible;
+ }
+
if (Chat.ContextMenu.Items.Count == 0)
{
@@ -476,7 +486,9 @@ namespace ChatController
//nix
}
else
- {
+ {
+ Cursor = Cursors.Wait;
+ //StartWaiting();
scrollPrueferAktivieren = false;
Chat.Items.MoveCurrentToFirst();
@@ -490,7 +502,9 @@ namespace ChatController
Chat.ItemsSource = xy;
- Chat.ScrollIntoView(item);
+ Chat.ScrollIntoView(item);
+ //EndWaiting();
+ Cursor = Cursors.Arrow;
}
}
}
@@ -714,7 +728,7 @@ namespace ChatController
#endregion
- #region Zeige Erhaltene Daten An In Dem Fall Bilder Zurzeit
+ #region Zeige Erhaltene Daten per doppelclick An In Dem Fall Bilder Zurzeit
private void Chat_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
@@ -774,5 +788,43 @@ namespace ChatController
#endregion
+ #region Wait Layer
+
+ private ChatControlWaitLayer _waitLayer = null;
+
+ public void StartWaiting()
+ {
+ Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)StartWaitingImmediately);
+ }
+
+ public void StartWaitingImmediately()
+ {
+ if (_waitLayer == null)
+ {
+ _waitLayer = new ChatControlWaitLayer();
+ //Grid.SetColumnSpan(_waitLayer, 3);
+ Grid.SetRowSpan(_waitLayer, 3);
+ GridRechts.Children.Add(_waitLayer);
+ Panel.SetZIndex(_waitLayer, int.MaxValue);
+ _waitLayer.RefreshChatUI();
+ }
+ }
+
+ public void EndWaiting()
+ {
+ Dispatcher.BeginInvoke(
+ DispatcherPriority.Background,
+ (Action)delegate
+ {
+ if (_waitLayer != null)
+ {
+ GridRechts.Children.Remove(_waitLayer);
+ _waitLayer = null;
+ }
+ });
+ }
+
+ #endregion
+
}
}
diff --git a/ChatController/HauptKlassen/Chat.cs b/ChatController/HauptKlassen/Chat.cs
index cb2e0af..4261a6a 100644
--- a/ChatController/HauptKlassen/Chat.cs
+++ b/ChatController/HauptKlassen/Chat.cs
@@ -64,6 +64,7 @@ namespace ChatController.HauptKlassen
var lastMS = value.LastMessage;
+
if (lastMS != null)
{
if (lastMS.Text != null)
@@ -72,6 +73,12 @@ namespace ChatController.HauptKlassen
timestamp = DateTime.Parse(lastMS.Timestamp.Date);
}
}
+
+ if (message.Equals("") && value.LastMessage != null && !value.LastMessage.File.Equals(""))
+ {
+ message = Path.GetFileName(value.LastMessage.File);
+ }
+
//null steht für employee
Kontaktliste.Add(new KontaktlistBuilder(value.Name, AvatarToImageSourceConverter(value.Avatar),
message, timestamp, value.Oid, null));
@@ -169,7 +176,7 @@ namespace ChatController.HauptKlassen
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
{
- Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
+ Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, Path.GetFileName(ChatMessage.File),
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), true,ChatMessage.File,
timeformated));
}
@@ -201,7 +208,7 @@ namespace ChatController.HauptKlassen
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
{
//Dokument
- Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
+ Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name,Path.GetFileName(ChatMessage.File),
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), false, ChatMessage.File,
timeformated));
}
diff --git a/ChatController/LoginControl.xaml.cs b/ChatController/LoginControl.xaml.cs
index 771bec5..bf27fa0 100644
--- a/ChatController/LoginControl.xaml.cs
+++ b/ChatController/LoginControl.xaml.cs
@@ -142,35 +142,37 @@ namespace ChatController
private void SpeichereDatenInDatei()
{
try
- {
- using (StreamWriter sw = new StreamWriter(_dateiPfad))
- {
+ {
+ if (!File.Exists(_dateiPfad)) {
+ using (StreamWriter sw = new StreamWriter(_dateiPfad))
+ {
- Encoding enc = new UTF8Encoding();
- var byt = enc.GetBytes(TextBoxKundennummer.Text);
- var bytes = Convert.ToBase64String(byt);
+ Encoding enc = new UTF8Encoding();
+ var byt = enc.GetBytes(TextBoxKundennummer.Text);
+ var bytes = Convert.ToBase64String(byt);
- var byt2 = enc.GetBytes(TextBoxChatCode.Text);
- var bytes2 = Convert.ToBase64String(byt2);
+ var byt2 = enc.GetBytes(TextBoxChatCode.Text);
+ var bytes2 = Convert.ToBase64String(byt2);
- var byt3 = enc.GetBytes(TextBoxBenutzerName.Text);
- var bytes3 = Convert.ToBase64String(byt3);
+ var byt3 = enc.GetBytes(TextBoxBenutzerName.Text);
+ var bytes3 = Convert.ToBase64String(byt3);
- var byt4 = enc.GetBytes(TextBoxPasswort.Password);
- var bytes4 = Convert.ToBase64String(byt4);
+ var byt4 = enc.GetBytes(TextBoxPasswort.Password);
+ var bytes4 = Convert.ToBase64String(byt4);
- var byt5 = enc.GetBytes(Merken.IsChecked.ToString());
- var bytes5 = Convert.ToBase64String(byt5);
+ var byt5 = enc.GetBytes(Merken.IsChecked.ToString());
+ var bytes5 = Convert.ToBase64String(byt5);
- sw.WriteLine(bytes);
- sw.WriteLine(bytes2);
- sw.WriteLine(bytes3);
- sw.WriteLine(bytes4);
- sw.WriteLine(bytes5);
+ sw.WriteLine(bytes);
+ sw.WriteLine(bytes2);
+ sw.WriteLine(bytes3);
+ sw.WriteLine(bytes4);
+ sw.WriteLine(bytes5);
- File.SetAttributes(_dateiPfad, FileAttributes.ReadOnly);
+ File.SetAttributes(_dateiPfad, FileAttributes.ReadOnly);
+ }
}
}
catch (Exception e)
diff --git a/PrototypChat/.vs/PrototypChat/v15/.suo b/PrototypChat/.vs/PrototypChat/v15/.suo
index 70c3754..55dd87b 100644
Binary files a/PrototypChat/.vs/PrototypChat/v15/.suo and b/PrototypChat/.vs/PrototypChat/v15/.suo differ
diff --git a/PrototypChat/MainWindow.xaml.cs b/PrototypChat/MainWindow.xaml.cs
index 96f3ac7..c318b13 100644
--- a/PrototypChat/MainWindow.xaml.cs
+++ b/PrototypChat/MainWindow.xaml.cs
@@ -71,6 +71,7 @@ namespace PrototypChat
ChatMainControl.InitMitChatdaten(x);
+
//ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem);
}
@@ -106,7 +107,8 @@ namespace PrototypChat
}
}
}
-
+
+
//private void ChatMainControl_OnClickContextMenuItem(String menuItem)
//{