anpassungen

This commit is contained in:
Waldi
2016-11-21 13:19:56 +01:00
parent 6cfe3975b9
commit 5debd09a6c
2 changed files with 96 additions and 64 deletions

View File

@@ -151,7 +151,7 @@ namespace BeWo.View
}));
}
public void SetText(String text, String nameclient, long personoid)
public void SetText(String text, String nameclient, long personoid,int mediaart, byte[] media)
{
try
{
@@ -171,8 +171,42 @@ namespace BeWo.View
curItem.Receivems = "";
Chat.Items.Add(new KontakMessageBuilder(nameclient, text, DateTime.Now.ToString(), personoid,false,false,null));
if (mediaart == 0)
{
Chat.Items.Add(new KontakMessageBuilder(nameclient, text, DateTime.Now.ToString(), personoid,
false, false, null));
}
else
{
switch (mediaart)
{
case 1:
var bild = DecodeBild(media);
Chat.Items.Add(new KontakMessageBuilder(
BeWoApp.LoggedOnUser.Employee.FirstName, text,
DateTime.Now.ToString(), personoid, false, false, true, false, bild,
null, null, false, null, 0));
break;
case 2:
object[] x = new object[2];
x[0] = text;
x[1] = media;
x[2] = 0;
Chat.Items.Add(new KontakMessageBuilder(BeWoApp.LoggedOnUser.Employee.FirstName, text,
DateTime.Now.ToString(), personoid, false, false, false, true, null,
text, null, false, x,0));
break;
case 3:
Chat.Items.Add(new KontakMessageBuilder(BeWoApp.LoggedOnUser.Employee.FirstName,
text, DateTime.Now.ToString(), curItem.EmpfaengerOid, true, true, false, false, null, null, null, false, null, 0));
break;
}
}
Chat.Items.MoveCurrentToLast();
Chat.ScrollIntoView(Chat.Items.CurrentItem);
}
@@ -2040,54 +2074,68 @@ namespace BeWo.View
var dokarray = (object[]) btn.Tag;
string file = dokarray[0].ToString();
// byte[] dokBytes = (byte[]) dokarray[1];
byte[] dokByte = (byte[]) dokarray[1];
long? chatMessageOid = (long?) dokarray[2];
byte[] dokBytes = ServiceFacade.DoCustomerServiceSync(r => r.GetChatMedia(chatMessageOid.Value));
if(dokBytes != null){
string path = @"c:\temp\" + file;
if (File.Exists(path))
{
try
{
File.Delete(path);
using (FileStream SourceStream = File.Open(path, FileMode.OpenOrCreate))
{
SourceStream.Seek(0, SeekOrigin.End);
SourceStream.Write(dokBytes, 0, dokBytes.Length);
}
}
catch (Exception)
{
}
}
else
{
using (FileStream SourceStream = File.Open(path, FileMode.OpenOrCreate))
{
SourceStream.Seek(0, SeekOrigin.End);
SourceStream.Write(dokBytes, 0, dokBytes.Length);
}
}
Process.Start(path);
if(!Speicherpfad.ContainsKey(file))
Speicherpfad.Add(file,path);
byte[] dokBytes;
if (dokByte == null)
{
dokBytes = ServiceFacade.DoCustomerServiceSync(r => r.GetChatMedia(chatMessageOid.Value));
LoadDokument(dokBytes, file);
}
else
{
MessageBox.Show("Die Datei wurde nicht Gefunden","Info",MessageBoxButton.OK);
LoadDokument(dokByte, file);
}
}
}
}
private void LoadDokument(byte[] dokBytes, String file)
{
if (dokBytes != null)
{
string path = @"c:\temp\" + file;
if (File.Exists(path))
{
try
{
File.Delete(path);
using (FileStream SourceStream = File.Open(path, FileMode.OpenOrCreate))
{
SourceStream.Seek(0, SeekOrigin.End);
SourceStream.Write(dokBytes, 0, dokBytes.Length);
}
}
catch (Exception)
{
}
}
else
{
using (FileStream SourceStream = File.Open(path, FileMode.OpenOrCreate))
{
SourceStream.Seek(0, SeekOrigin.End);
SourceStream.Write(dokBytes, 0, dokBytes.Length);
}
}
Process.Start(path);
if (!Speicherpfad.ContainsKey(file))
Speicherpfad.Add(file, path);
}
else
{
MessageBox.Show("Die Datei wurde nicht Gefunden", "Info", MessageBoxButton.OK);
}
}
//private void myProcess_Exited(object sender, EventArgs e)
//{
// var x = (Process)sender;
@@ -2500,6 +2548,8 @@ namespace BeWo.View
BeWoApp.LoggedOnUser.Employee.FirstName, list.ChatText,
list.Uhrzeit.ToString(), empfaengerOid, false, false, false, true, null,
list.ChatText, null, false, datenmengen,list.ChatMessagesOid));
}
}
}

View File

@@ -1584,33 +1584,15 @@ namespace BeWo.View
case DataIdentifier.Message:
if (paket.MediaTyp == 0)
{
UebergebeNachricht(paket.ChatMessage, person[0].FirstName, persoid);
}
else
{
//Bearbeite weil übergebe Speziall message
UebergebeNachricht(paket.ChatMessage, person[0].FirstName, persoid);
}
UebergebeNachricht(paket.ChatMessage, person[0].FirstName, persoid,paket.MediaTyp,paket.MediaDatei);
break;
case DataIdentifier.Team:
if (paket.MediaTyp == 0)
{
UebergebeTeamNachricht(paket.ChatMessage, person[0].FirstName + " " + person[0].LastName,
paket.RecipientPersonOid);
}
else
{
//Bearbeite weil speziall ms.
UebergebeTeamNachricht(paket.ChatMessage, person[0].FirstName + " " + person[0].LastName,
paket.RecipientPersonOid);
}
paket.RecipientPersonOid,paket.MediaTyp,paket.MediaDatei);
break;
}
}
@@ -1667,7 +1649,7 @@ namespace BeWo.View
}
public void UebergebeNachricht(String text,String name, long personoid)
public void UebergebeNachricht(String text,String name, long personoid,int mediaart,byte[] media)
{
try
{
@@ -1681,7 +1663,7 @@ namespace BeWo.View
if (chatView.Visibility == Visibility.Visible && curItem.EmpfaengerOid.Equals(personoid))
{
chatView.SetText(text, name, personoid);
chatView.SetText(text, name, personoid,mediaart,media);
}
else if (!curItem.EmpfaengerOid.Equals(personoid))
{
@@ -1707,7 +1689,7 @@ namespace BeWo.View
}
public void UebergebeTeamNachricht(String text, String name, long empfaenger)
public void UebergebeTeamNachricht(String text, String name, long empfaenger, int mediaart, byte[] media)
{
try
{
@@ -1729,7 +1711,7 @@ namespace BeWo.View
{
if (dc.TeamOid == curItem.EmpfaengerOid)
{
chatView.SetText(text, name, dc.TeamOid);
chatView.SetText(text, name, dc.TeamOid, mediaart,media);
}
}
}