cb
This commit is contained in:
@@ -54,7 +54,7 @@ namespace ChatController
|
||||
public Thread AlleKontakteThread;
|
||||
public bool AlleNachrichtenThreadBool = true;
|
||||
private double? AlleNachrichtenCount = null;
|
||||
|
||||
private List<String> createdTempFiles = new List<String>();
|
||||
|
||||
private Dictionary<String, Action<string>> menuItemName2Callback = new Dictionary<string, Action<string>>();
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace ChatController
|
||||
{
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
|
||||
if (kontakt.CustomerPersonOid == null)
|
||||
if (kontakt.CustomerOid == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -177,8 +177,21 @@ namespace ChatController
|
||||
|
||||
ChatListBox.ItemsSource = x;
|
||||
|
||||
ChatListBox.Items.MoveCurrentToLast();
|
||||
ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
//ChatListBox.Items.MoveCurrentToLast();
|
||||
//ChatListBox.ScrollIntoView(ChatListBox.Items.CurrentItem);
|
||||
|
||||
if (VisualTreeHelper.GetChildrenCount(ChatListBox) > 0)
|
||||
{
|
||||
Border border = (Border)VisualTreeHelper.GetChild(ChatListBox, 0);
|
||||
ScrollViewer 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();
|
||||
SetContextHandler();
|
||||
@@ -186,6 +199,8 @@ namespace ChatController
|
||||
|
||||
HorcheAktivNachNachrichten();
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
|
||||
disableKontaktNachrichtenThread = false;
|
||||
// EndWaiting();
|
||||
}
|
||||
@@ -335,7 +350,7 @@ namespace ChatController
|
||||
|
||||
//prüfe ob dokumentation erlaubt
|
||||
var kontakt = (AktuellerKontakt)AktChatUserList.Items[0];
|
||||
if (kontakt.CustomerPersonOid == null && ChatListBox.ContextMenu.Items.Count > 3)
|
||||
if (kontakt.CustomerOid == null && ChatListBox.ContextMenu.Items.Count > 3)
|
||||
{
|
||||
var contextItems = ChatListBox.ContextMenu.Items;
|
||||
var ContextItemSpeichernUnter = (MenuItem)contextItems[3];
|
||||
@@ -643,6 +658,8 @@ namespace ChatController
|
||||
var kontakt = (AktuellerKontakt) o;
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (!disableKontaktNachrichtenThread)
|
||||
{
|
||||
_schaueNachMs = _chat.SchaueNachNeuenNachrichten(kontakt);
|
||||
@@ -673,7 +690,7 @@ namespace ChatController
|
||||
{
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(2000);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -785,7 +802,7 @@ namespace ChatController
|
||||
private void Chat_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
StartWaiting();
|
||||
|
||||
var chatItems = ChatListBox.SelectedItems;
|
||||
|
||||
if (chatItems.Count > 0)
|
||||
@@ -796,7 +813,8 @@ namespace ChatController
|
||||
|
||||
if (item != null && item.ImageSources != null)
|
||||
{
|
||||
_chat.ShowPicture(item);
|
||||
StartWaiting();
|
||||
_chat.ShowPicture(item, EndWaiting);
|
||||
}
|
||||
else if(item != null && item.Dokpfad != null)
|
||||
{
|
||||
@@ -805,12 +823,10 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
|
||||
EndWaiting();
|
||||
Cursor = Cursors.Arrow;
|
||||
}
|
||||
else
|
||||
{
|
||||
EndWaiting();
|
||||
Cursor = Cursors.Arrow;
|
||||
}
|
||||
}
|
||||
@@ -842,25 +858,41 @@ namespace ChatController
|
||||
}
|
||||
|
||||
private void LoadDokument(string link, String filename)
|
||||
{
|
||||
string path = @"c:\temp\" + filename;
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
webClient.DownloadFile(link, path);
|
||||
}
|
||||
StartWaiting();
|
||||
|
||||
if (File.Exists(path))
|
||||
string path = Path.Combine(Path.GetTempPath(), filename);
|
||||
createdTempFiles.Add(path);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
webClient.DownloadFile(link, path);
|
||||
}
|
||||
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Process.Start(path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start(path);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
Process.Start(path);
|
||||
}
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
EndWaiting();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1023,5 +1055,21 @@ namespace ChatController
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void DeleteTempFiles()
|
||||
{
|
||||
foreach (var file in createdTempFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(file))
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user