BeWo Server-Client update
This commit is contained in:
@@ -146,6 +146,7 @@ public class MainActivityMitarbeiter extends Activity {
|
||||
|
||||
//nachricht an server senden welcher name jetz aktiv connected ist
|
||||
dataOutputStream = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
// name = name + "/1" + "?" + personOid;
|
||||
// byte[] ts = name.getBytes();
|
||||
// dataOutputStream.write(ts);
|
||||
|
||||
@@ -804,8 +804,7 @@ namespace BeWo
|
||||
NavigateTo(GetViewForUIContext(UIContext.Customer));
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
//############# Button Wohnheim klick #######################################################
|
||||
|
||||
private void button_Wohnheim_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DoSaveCheck())
|
||||
@@ -813,8 +812,7 @@ namespace BeWo
|
||||
NavigateTo(GetViewForUIContext(UIContext.Wohnheim));
|
||||
}
|
||||
}
|
||||
//############# Button Wohnheim klick #######################################################
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
private void button_Employee_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DoSaveCheck())
|
||||
@@ -839,7 +837,7 @@ namespace BeWo
|
||||
Cache.GetInstance().ClearAll();
|
||||
_Views = new Dictionary<UIContext, BeWoView>();
|
||||
|
||||
_HomeView.CloseConnection();
|
||||
_HomeView.CloseServerConnection();
|
||||
|
||||
var animation = new DoubleAnimationUsingKeyFrames();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using BeWo.Core.Config;
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.View;
|
||||
|
||||
|
||||
namespace BeWo
|
||||
@@ -78,7 +79,9 @@ namespace BeWo
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BeWoApp.MainControl.HomeView.CloseServerConnection();
|
||||
|
||||
BeWoApp.CurrentBeWo.DocumentWatcher.LoescheTempDateien();
|
||||
|
||||
Application.Current.Shutdown();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<TextBox x:Name="ServerStats" Height="23" Margin="539,13,7,0" TextWrapping="Wrap" VerticalAlignment="Top" ToolTip="Server Info" IsEnabled="False"/>
|
||||
|
||||
<TextBox x:Name="Chatbox" HorizontalAlignment="Left" Margin="174,719,0,11" TextWrapping="Wrap"
|
||||
VerticalContentAlignment="Center" Width="462" Height="25" ToolTip="Schreiben Sie hier eine Nachricht hinein" KeyDown="OnKeyDownHandler" GotFocus="OnFocus" LostFocus="OnDefocus" Text="Nachricht schreiben" Foreground="DarkGray" >
|
||||
VerticalContentAlignment="Center" Width="462" Height="25" ToolTip="Schreiben Sie hier eine Nachricht hinein" KeyDown="OnKeyDownHandler" GotFocus="OnFocus" LostFocus="OnDefocus" Text="Nachricht schreiben" Foreground="DarkGray" >
|
||||
<TextBox.Resources>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -114,11 +114,21 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Header="Eigenschaften" Grid.RowSpan="3" Style="{StaticResource ObjectEditGroupBox}">
|
||||
|
||||
|
||||
<GroupBox Header="Foto" Margin="8 0 8 8" Grid.RowSpan="3" Style="{StaticResource ObjectEditGroupBox}" Grid.Column="0">
|
||||
<Grid>
|
||||
<dxe:ImageEdit MinWidth="250" MaxWidth="300" Height="250" MaxHeight="300" x:Name="Img" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
|
||||
<GroupBox Header="Eigenschaften" Grid.Column="1" Grid.RowSpan="3" Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -201,7 +211,7 @@
|
||||
</GroupBox>
|
||||
|
||||
|
||||
<GroupBox Grid.Column="2" Grid.Row="0" Header="Adresse" Style="{StaticResource ObjectEditGroupBox}">
|
||||
<GroupBox Grid.Column="3" Grid.Row="0" Header="Adresse" Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -222,7 +232,7 @@
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Margin="3" Height="23" Text="{Binding Path=Town, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Grid.Column="2" Grid.Row="1" Header="Kontakt" Style="{StaticResource ObjectEditGroupBox}" Margin="0,20,0,0">
|
||||
<GroupBox Grid.Column="3" Grid.Row="1" Header="Kontakt" Style="{StaticResource ObjectEditGroupBox}" Margin="0,20,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace BeWo.View.Detail
|
||||
tabitem_documents.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
/*Employee Picture
|
||||
//Employee Image
|
||||
if (_ViewModel.EmployeeImage != null)
|
||||
{
|
||||
var biImg = new BitmapImage();
|
||||
@@ -132,7 +132,7 @@ namespace BeWo.View.Detail
|
||||
Img.Source = biImg;
|
||||
}
|
||||
|
||||
Img.EditValueChanged += Image_EditValueChanged;*/
|
||||
Img.EditValueChanged += Image_EditValueChanged;
|
||||
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace BeWo.View.Detail
|
||||
|
||||
public void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
|
||||
{
|
||||
// _ViewModel.CustomerImage = Img.EditValue as byte[];
|
||||
_ViewModel.EmployeeImage = Img.EditValue as byte[];
|
||||
}
|
||||
|
||||
public override bool IsDirty
|
||||
|
||||
@@ -64,7 +64,14 @@ namespace BeWo.View
|
||||
|
||||
SocketPacket socketDaten;
|
||||
String erhaltenerDS;
|
||||
Dictionary<string, MiniChatView> pavlist = new Dictionary<string, MiniChatView>();
|
||||
Dictionary<long, MiniChatView> pavlist = new Dictionary<long, MiniChatView>();
|
||||
|
||||
|
||||
|
||||
//Neue Version : Version 0.55
|
||||
public TcpClient clientSocket = new TcpClient();
|
||||
NetworkStream serverStream;
|
||||
|
||||
//################################################################
|
||||
|
||||
public HomeDragPanelView()
|
||||
@@ -97,9 +104,19 @@ namespace BeWo.View
|
||||
|
||||
//onConnectionStart();
|
||||
|
||||
chatpav = new ChatView("Whats chat", chat.Text, m_workerSocketList);
|
||||
|
||||
this.Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Normal,
|
||||
(Action)delegate
|
||||
{
|
||||
ConnectWithServer();
|
||||
});
|
||||
|
||||
chatpav.Visibility = Visibility.Collapsed;
|
||||
chatpav = new ChatView("Whats chat", chat.Text, clientSocket);
|
||||
|
||||
chatpav.Visibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
//####################################################################
|
||||
}
|
||||
|
||||
@@ -1228,51 +1245,311 @@ namespace BeWo.View
|
||||
}
|
||||
|
||||
|
||||
//############# Sever wurde ausgelagert
|
||||
// hier soll der Client aufruf hin der rest bleibt so wie es ist ( Tcp Gedöns )
|
||||
// Erhalte msg, splitte die objekte, und weise dies der DB und dem Chat zu.
|
||||
//nachricht schreiben funktioniert dann auf die Änliche weise also person oid wird mitgegeben im string mit der msg.
|
||||
//die nachricht schreib funktion muss dann nur ein wenig in der ChatView Klasse angepast werden.
|
||||
/*
|
||||
//############# Sever wurde ausgelagert
|
||||
//-------------- Server Chat Gedöns -----------------------------------------
|
||||
private void ConnectWithServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
TcpClient clientSocket = new TcpClient();
|
||||
int port = 5000; //<----- Port Hier hinein Schreiben
|
||||
var ipAdresse = "192.168.1.103";
|
||||
var port = 5000;
|
||||
|
||||
*
|
||||
*
|
||||
*
|
||||
clientSocket.Connect("Ipadresse hier rein schreiben", port);
|
||||
*
|
||||
*
|
||||
* read die erhaltene Datei
|
||||
*
|
||||
clientSocket.Connect(ipAdresse, port);
|
||||
|
||||
|
||||
|
||||
// Thread prf = new Thread(PruefeServerDisconection); //<---------- gibt eine Nachricht aus wenn die verbindung zum server verloren geht
|
||||
// prf.Start();
|
||||
|
||||
SendAnmeldungsMessagetoServer(clientSocket);
|
||||
|
||||
Thread getMs = new Thread(WaitForMsFromServer);
|
||||
getMs.Start();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Die Verbindung zum Server konnte nicht aufgebaut werden.", "FehlerCode: Hier Fehlercode", MessageBoxButton.OK);
|
||||
|
||||
//Hier den Code zum weiteren Connect versuch auffordern.
|
||||
MessageBox.Show("Verbindung zum Chat-Server konnte nicht aufgebaut werden.", "Fehler: 2010 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
//#####################################
|
||||
|
||||
|
||||
//#################### Serveranwendung System ##################################################
|
||||
public void SendAnmeldungsMessagetoServer(TcpClient s)
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkStream serverStream = s.GetStream();
|
||||
|
||||
String abc = "";
|
||||
|
||||
byte[] outStream = System.Text.Encoding.ASCII.GetBytes("" + BeWoApp.LoggedOnUser.Employee.PersonOid + ";0;" + BeWoApp.LoggedOnUser.LoginName.Length + ";" +
|
||||
abc.Length + ";" +(int)DataIdentifier.Login + ";" + BeWoApp.LoggedOnUser.LoginName + ";" +
|
||||
BeWoApp.Tenant + abc + DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss"));
|
||||
serverStream.Write(outStream, 0, outStream.Length);
|
||||
serverStream.Flush();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Anmeldung am Server zurzeit nicht möglich.", "Fehler: 2020 ", MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void WaitForMsFromServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
// nehme den String auseinander und überprüfe ob es eine liste ist
|
||||
// wenn nicht / schaue auf onReceiveMs || Erstmal ohne While versuchen
|
||||
// while (true)
|
||||
// {
|
||||
if (clientSocket != null)
|
||||
{
|
||||
serverStream = clientSocket.GetStream();
|
||||
|
||||
int buffSize = 0;
|
||||
byte[] inStream = new byte[1024];
|
||||
|
||||
Int32 bits = serverStream.Read(inStream, 0, inStream.Length);
|
||||
|
||||
string data = Encoding.UTF8.GetString(inStream,0,bits);
|
||||
|
||||
|
||||
//String umbauen in Liste und daten wie oid und nachricht und so rausholen
|
||||
|
||||
//Wenn array dann AktList
|
||||
|
||||
|
||||
//ErhalteDatenFromString(data);
|
||||
|
||||
List<long> x = new List<long>();
|
||||
x.Add(2);
|
||||
|
||||
var person = ServiceFacade.DoCustomerServiceSync(s => s.GetPersonsById(x));
|
||||
|
||||
if(!chatpav.CompareWithListItem(2)) // <----- hier muss die person Oid übergeben werden damit das ganze funzt
|
||||
{
|
||||
ErstelleChatViews(person[0].FirstName+" "+person[0].LastName, 2);
|
||||
}
|
||||
|
||||
UebergebeNachricht(data, person[0].FirstName + " " + person[0].LastName, 2);
|
||||
|
||||
/*if(liste > 1 )
|
||||
{
|
||||
UebergebeNachricht("Message", Username,personoid);
|
||||
}
|
||||
else
|
||||
{
|
||||
* ErstelleChatViews("PersonName", Personoid);
|
||||
* AktualisiereOnlineList();
|
||||
}*/
|
||||
|
||||
//MessageBox.Show(data, "Server", MessageBoxButton.OK);
|
||||
}
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (clientSocket.Connected)
|
||||
MessageBox.Show("Beim Erhalten von Nachrichten ist ein Fehler aufgetreten.", "Fehler: 2030 ", MessageBoxButton.OK);
|
||||
|
||||
// hier abfrage hin wenn server nicht mehr vorhanden alle 5 min neuer connect versuch starten
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ErhalteDatenFromString(String message)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// return "";
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Beim Sortieren von Nachrichten ist ein Fehler aufgetreten.", "Fehler: 2040 ", MessageBoxButton.OK);
|
||||
//return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void AktualisiereOnlineList(string name,long oid)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(chatpav.CompareWithListItem(oid))
|
||||
{
|
||||
DeletLoggedOffUsers(name,oid);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Beim Aktualisieren der Online-Liste ist ein Fehler aufgetreten ", "Fehler: 2050 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UebergebeNachricht(String text,String name, long personoid ) // kann sein das fehler passieren
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(
|
||||
DispatcherPriority.Normal,
|
||||
(ThreadStart) delegate
|
||||
{
|
||||
chat.AppendText(name + ": " + text + "\n");
|
||||
chat.ScrollToEnd();
|
||||
|
||||
if (chatpav.Visibility != Visibility.Visible &&
|
||||
pavlist[personoid].Visibility != Visibility.Visible)
|
||||
{
|
||||
pavlist[personoid].Visibility = Visibility.Visible;
|
||||
pavlist[personoid].SetText(text, 1);
|
||||
}
|
||||
else if (pavlist[personoid].Visibility != Visibility.Visible)
|
||||
{
|
||||
chatpav.SetText(text, name, personoid);
|
||||
}
|
||||
else
|
||||
{
|
||||
pavlist[personoid].AppendTextwhileViewOpen(text, 1);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//Continue Waiting for data
|
||||
WaitForMsFromServer();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Nachrichtenübermittlung fehlgeschlagen ", "Fehler: 2060 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void DeletLoggedOffUsers(String personname,long personoid)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(
|
||||
DispatcherPriority.Normal,
|
||||
(ThreadStart)delegate
|
||||
{
|
||||
|
||||
chatpav.RemoveListItem(personoid);
|
||||
chatpav.SetServerStats(personname +" / "+personoid +
|
||||
" Disconnected ! ");
|
||||
|
||||
//Removed die dazugehörige Minichatview
|
||||
pavlist.Remove(personoid);
|
||||
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Es ist ein Fehler aufgetreten, bei dem versucht wurde User aus der Onlineanzeige zu entfernen", "Fehler: 2070 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void PruefeServerDisconection()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
|
||||
|
||||
//Connected ist immer true ??????
|
||||
if (clientSocket.Client.Connected == false)
|
||||
{
|
||||
MessageBox.Show("Die verbindung zum Server wurde unterbrochen", "Info", MessageBoxButton.OK);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Die verbindung zum server Konnte nicht unterbrochen werden", "Fehler: 2080 ", MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ErstelleChatViews(String personName,long personOid)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Erstellen der Views
|
||||
Dispatcher.Invoke(
|
||||
DispatcherPriority.Normal,
|
||||
(ThreadStart)delegate
|
||||
{ //Clientlist.Items.Add(socketDaten.m_clientname);
|
||||
|
||||
|
||||
List<long> x = new List<long>();
|
||||
x.Add(personOid);
|
||||
|
||||
var person = ServiceFacade.DoCustomerServiceSync(s => s.GetPersonsById(x));
|
||||
|
||||
chatpav.SetList(person[0].FirstName + " " + person[0].LastName, personOid);
|
||||
chatpav.SetServerStats(person[0].FirstName + " " + person[0].LastName + " Connected");
|
||||
|
||||
//statt "" war erhalteneDS | neu hinzugefügt
|
||||
pav = new MiniChatView(person[0].FirstName + " " + person[0].LastName, "", chatpav, personOid);
|
||||
pav.Visibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
//Abfrage bei gkleiche Schlüssel weil sonst crash
|
||||
pavlist.Add(personOid, pav);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Das Erstellen der Chat-Views konnt nicht ausgeführt werden", "Fehler: 2090 ", MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CloseServerConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (clientSocket != null)
|
||||
{
|
||||
clientSocket.Close();
|
||||
}
|
||||
|
||||
if (serverStream != null)
|
||||
{
|
||||
serverStream.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception edf)
|
||||
{
|
||||
MessageBox.Show("Beim Versuch ,die verbindung mit dem Server zu trennen, ist ein Fehler unterlaufen ", "Fehler: 2100 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//#################### Ab hier alles Weg Serveranwendung System ##################################################
|
||||
public void onConnectionStart()
|
||||
{
|
||||
try
|
||||
{
|
||||
int port = 5000;
|
||||
String ipAdresse = "127.0.0.1";
|
||||
String ipAdresse = "192.168.1.103";
|
||||
|
||||
m_mainSocket = new Socket(AddressFamily.InterNetwork,
|
||||
SocketType.Stream,
|
||||
@@ -1291,7 +1568,7 @@ namespace BeWo.View
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
MessageBox.Show("Ups, da ist etwas kaput gegangen.","Fehler: 2010 ",MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1315,7 +1592,7 @@ namespace BeWo.View
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
MessageBox.Show("Ups, da ist etwas kaput gegangen.", "Fehler: 2020 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1337,7 +1614,7 @@ namespace BeWo.View
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
MessageBox.Show("Ups, da ist etwas kaput gegangen.", "Fehler: 2030 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1409,7 +1686,7 @@ namespace BeWo.View
|
||||
socketDaten.m_clientpersonoid = persOid;
|
||||
|
||||
|
||||
chatpav.SetList(socketDaten.m_clientname,socketDaten.m_clientpersonoid,socketDaten.m_clientNumber);
|
||||
// chatpav.SetList(socketDaten.m_clientname,socketDaten.m_clientpersonoid,socketDaten.m_clientNumber);
|
||||
chatpav.SetServerStats(splitt[0] + " Connected");
|
||||
|
||||
//statt "" war erhalteneDS | neu hinzugefügt
|
||||
@@ -1418,7 +1695,7 @@ namespace BeWo.View
|
||||
|
||||
|
||||
//Abfrage bei gkleiche Schlüssel weil sonst crash
|
||||
pavlist.Add(socketDaten.m_clientname, pav);
|
||||
pavlist.Add(socketDaten.m_clientpersonoid, pav);
|
||||
});
|
||||
|
||||
|
||||
@@ -1445,14 +1722,14 @@ namespace BeWo.View
|
||||
(ThreadStart) delegate
|
||||
{
|
||||
// Clientlist.Items.Add("Client" + clientCount);
|
||||
chatpav.SetList("Client" + clientCount,socketDaten.m_clientpersonoid,socketDaten.m_clientNumber);
|
||||
// chatpav.SetList("Client" + clientCount,socketDaten.m_clientpersonoid,socketDaten.m_clientNumber);
|
||||
chatpav.SetServerStats("Client" + clientCount + " Connected");
|
||||
|
||||
//statt "" war erhalteneDS | neu hinzugefügt
|
||||
pav = new MiniChatView(socketDaten.m_clientname + clientCount, "", chatpav,socketDaten.m_clientpersonoid);
|
||||
pav.Visibility = Visibility.Collapsed;
|
||||
|
||||
pavlist.Add(socketDaten.m_clientname + clientCount, pav);
|
||||
pavlist.Add(socketDaten.m_clientpersonoid, pav);
|
||||
});
|
||||
|
||||
erstkonntakt = true;
|
||||
@@ -1478,13 +1755,13 @@ namespace BeWo.View
|
||||
(ThreadStart) delegate
|
||||
{
|
||||
//Clientlist.Items.Add("Client" + clientCount);
|
||||
chatpav.SetList("Client" + clientCount,socketDaten.m_clientpersonoid,socketDaten.m_clientNumber);
|
||||
// chatpav.SetList("Client" + clientCount,socketDaten.m_clientpersonoid,socketDaten.m_clientNumber);
|
||||
chatpav.SetServerStats("Client" + clientCount + " Connected");
|
||||
//statt "" war erhalteneDS | neu hinzugefügt
|
||||
pav = new MiniChatView(socketDaten.m_clientname + clientCount, "", chatpav,socketDaten.m_clientpersonoid);
|
||||
pav.Visibility = Visibility.Collapsed;
|
||||
|
||||
pavlist.Add(socketDaten.m_clientname + clientCount, pav);
|
||||
pavlist.Add(socketDaten.m_clientpersonoid, pav);
|
||||
});
|
||||
erstkonntakt = true;
|
||||
|
||||
@@ -1526,18 +1803,18 @@ namespace BeWo.View
|
||||
chat.ScrollToEnd();
|
||||
|
||||
if (chatpav.Visibility != Visibility.Visible &&
|
||||
pavlist[socketDaten.m_clientname].Visibility != Visibility.Visible)
|
||||
pavlist[socketDaten.m_clientpersonoid].Visibility != Visibility.Visible)
|
||||
{
|
||||
pavlist[socketDaten.m_clientname].Visibility = Visibility.Visible;
|
||||
pavlist[socketDaten.m_clientname].SetText(erhaltenerDS, 1);
|
||||
pavlist[socketDaten.m_clientpersonoid].Visibility = Visibility.Visible;
|
||||
pavlist[socketDaten.m_clientpersonoid].SetText(erhaltenerDS, 1);
|
||||
}
|
||||
else if (pavlist[socketDaten.m_clientname].Visibility != Visibility.Visible)
|
||||
else if (pavlist[socketDaten.m_clientpersonoid].Visibility != Visibility.Visible)
|
||||
{
|
||||
chatpav.SetText(erhaltenerDS, socketDaten.m_clientname,socketDaten.m_clientpersonoid);
|
||||
}
|
||||
else
|
||||
{
|
||||
pavlist[socketDaten.m_clientname].AppendTextwhileViewOpen(erhaltenerDS, 1);
|
||||
pavlist[socketDaten.m_clientpersonoid].AppendTextwhileViewOpen(erhaltenerDS, 1);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1562,7 +1839,7 @@ namespace BeWo.View
|
||||
|
||||
chatpav.SetServerStats(socketDaten.m_clientname + " Disconnected ! ");
|
||||
|
||||
pavlist.Remove(socketDaten.m_clientname);
|
||||
pavlist.Remove(socketDaten.m_clientpersonoid);
|
||||
|
||||
m_workerSocketList[socketDaten.m_clientNumber - 1] = null;
|
||||
workerSocket.Close();
|
||||
@@ -1575,7 +1852,7 @@ namespace BeWo.View
|
||||
" Disconnected ! ");
|
||||
|
||||
//Removed die dazugehörige Minichatview
|
||||
pavlist.Remove(socketDaten.m_clientname);
|
||||
pavlist.Remove(socketDaten.m_clientpersonoid);
|
||||
|
||||
m_workerSocketList[socketDaten.m_clientNumber - 1] = null;
|
||||
workerSocket.Close();
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Windows.Threading;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Controls;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace BeWo.View
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace BeWo.View
|
||||
public UserVM ViewModel { get; set; }
|
||||
public int abr = 0;
|
||||
|
||||
//protected ArrayList m_workerSocketList;
|
||||
//protected TCPClient tcpClient;
|
||||
protected ChatView viewChat;
|
||||
|
||||
protected String incommingString;
|
||||
@@ -39,7 +40,7 @@ namespace BeWo.View
|
||||
protected int anzahlDS = 0;
|
||||
//#######################################################################
|
||||
|
||||
public MiniChatView(String CLientName, String chat /*, ArrayList m_workerSocketList*/, ChatView view , long oid)
|
||||
public MiniChatView(String CLientName, String chat /*, TCPClient tcpClient*/, ChatView view , long oid)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -54,7 +55,7 @@ namespace BeWo.View
|
||||
incommingString = chat;
|
||||
incommingName = CLientName;
|
||||
incommingEmpfangOid = oid;
|
||||
// this.m_workerSocketList = m_workerSocketList;
|
||||
// this.tcpClient = tcpClient;
|
||||
|
||||
closeWindow();
|
||||
|
||||
@@ -83,13 +84,16 @@ namespace BeWo.View
|
||||
var myArray = myListDS.ToArray();
|
||||
anzahlDS = 0;
|
||||
//abfrage ob viewchat gesetzt ist
|
||||
viewChat.SetTextFromMiniV(myArray, incommingName,incommingEmpfangOid);
|
||||
viewChat.SetTextFromMiniV(myArray, incommingName, incommingEmpfangOid);
|
||||
viewChat.Visibility = Visibility.Visible;
|
||||
myListDS.Clear();
|
||||
Visibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception edf)
|
||||
{
|
||||
MessageBox.Show("Fehler beim anklicken des Mini-Chats.", "Fehler: 2400 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
public void closeWindow() {
|
||||
@@ -104,7 +108,7 @@ namespace BeWo.View
|
||||
var myArray = myListDS.ToArray();
|
||||
|
||||
anzahlDS = 0;
|
||||
//abfrage ob viewchat gesetzt ist <--- Warum nochmal
|
||||
//abfrage ob viewchat gesetzt ist <---
|
||||
viewChat.SetTextFromMiniV(myArray, incommingName,incommingEmpfangOid);
|
||||
viewChat.Visibility = Visibility.Visible;
|
||||
myListDS.Clear();
|
||||
@@ -117,57 +121,75 @@ namespace BeWo.View
|
||||
|
||||
public void SetText(String text, int nac)
|
||||
{
|
||||
//Hier das zählen aktueller nachrichten anzahl und dessen ausgabe
|
||||
anzahlDS = anzahlDS + nac;
|
||||
try
|
||||
{
|
||||
anzahlDS = anzahlDS + nac; // <-- Hier das zählen aktueller nachrichten anzahl und dessen ausgabe
|
||||
|
||||
//Setzte die anzahl der aktuellen nachrichten
|
||||
Title = anzahlDS + " " + namenInfo;
|
||||
Title = anzahlDS + " " + namenInfo; // <--Setzte die anzahl der aktuellen nachrichten
|
||||
|
||||
incommingString = text;
|
||||
myListDS.Add(incommingString);
|
||||
Minichat.Text = namenInfo+": "+text+"\n";
|
||||
Minichat.ScrollToEnd();
|
||||
incommingString = text;
|
||||
myListDS.Add(incommingString);
|
||||
Minichat.Text = namenInfo + ": " + text + "\n";
|
||||
Minichat.ScrollToEnd();
|
||||
}
|
||||
catch (Exception edf)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Setzen der Nachricht. ", "Fehler: 2410 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
//Wenn noch offen append Text zu current text
|
||||
|
||||
public void AppendTextwhileViewOpen(String text, int nac)
|
||||
{
|
||||
AppendTrue = true;
|
||||
//Hier das zählen aktueller nachrichten anzahl und dessen ausgabe
|
||||
anzahlDS = anzahlDS + nac;
|
||||
try
|
||||
{
|
||||
AppendTrue = true;
|
||||
|
||||
//Setzte die anzahl der aktuellen nachrichten
|
||||
Title = anzahlDS + " " + namenInfo;
|
||||
anzahlDS = anzahlDS + nac; // <-- Hier das zählen aktueller nachrichten anzahl und dessen ausgabe
|
||||
|
||||
incommingString = text;
|
||||
Title = anzahlDS + " " + namenInfo; // <-- Setzte die anzahl der aktuellen nachrichten
|
||||
|
||||
myListDS.Add(incommingString);
|
||||
incommingString = text;
|
||||
|
||||
Minichat.AppendText(namenInfo+": "+text+"\n");
|
||||
Minichat.ScrollToEnd();
|
||||
myListDS.Add(incommingString);
|
||||
|
||||
Minichat.AppendText(namenInfo + ": " + text + "\n");
|
||||
Minichat.ScrollToEnd();
|
||||
}
|
||||
catch (Exception edf)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Anfügen einer weiteren Nachricht.", "Fehler: 2420 ", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Minichat_OnGotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//abfrage ob viewchat gesetzt ist
|
||||
if(viewChat.Visibility != Visibility.Visible){
|
||||
var myArray = myListDS.ToArray();
|
||||
try
|
||||
{
|
||||
//abfrage ob viewchat gesetzt ist
|
||||
if (viewChat.Visibility != Visibility.Visible)
|
||||
{
|
||||
var myArray = myListDS.ToArray();
|
||||
|
||||
anzahlDS = 0;
|
||||
|
||||
viewChat.SetTextFromMiniV(myArray, incommingName,incommingEmpfangOid);
|
||||
viewChat.Visibility = Visibility.Visible;
|
||||
myListDS.Clear();
|
||||
Visibility = Visibility.Collapsed;
|
||||
anzahlDS = 0;
|
||||
|
||||
viewChat.SetTextFromMiniV(myArray, incommingName, incommingEmpfangOid);
|
||||
viewChat.Visibility = Visibility.Visible;
|
||||
myListDS.Clear();
|
||||
Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
catch (Exception edf)
|
||||
{
|
||||
MessageBox.Show("Fehler beim Fokusieren der Minichat-View.", "Fehler: 2430 ", MessageBoxButton.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ##### ***** Sollte der Wunsch bestehen das man im kleinen fenster antworten möchte ***** #####
|
||||
*
|
||||
/* ##### ***** Sollte der Wunsch bestehen das man im kleinen fenster antworten möchte ***** #####
|
||||
|
||||
* private void SendButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//Minichat.AppendText("Server: "+MiniChatbox.Text+"\n");
|
||||
@@ -177,49 +199,16 @@ namespace BeWo.View
|
||||
|
||||
Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
|
||||
//############################## Serveranwendungsgedöns ########################
|
||||
|
||||
//Sendet eine Nachricht zum Clienten
|
||||
|
||||
public void SendMessage()
|
||||
{
|
||||
try
|
||||
{
|
||||
string msg = MiniChatbox.Text;
|
||||
Minichat.AppendText("Server: " + msg + "\n");
|
||||
msg = "Server: " + msg + "\n";
|
||||
byte[] byData = System.Text.Encoding.ASCII.GetBytes(msg);
|
||||
Socket workerSocket = null;
|
||||
for (int i = 0; i < m_workerSocketList.Count; i++)
|
||||
{
|
||||
workerSocket = (Socket)m_workerSocketList[i];
|
||||
if (workerSocket != null)
|
||||
{
|
||||
if (workerSocket.Connected)
|
||||
{
|
||||
workerSocket.Send(byData);
|
||||
}
|
||||
}
|
||||
}
|
||||
* try{
|
||||
Übernehme die SendMEssage von Chatview
|
||||
}catch(Exception edf){
|
||||
* MessageBox.show("Das Senden Einer Nachricht von der Mini-View konnte nicht ausgeführt werden.","Fehle: Hier Fehlercode",MessageButton.Ok);
|
||||
* }
|
||||
}*/
|
||||
|
||||
MiniChatbox.Text = "";
|
||||
}
|
||||
catch (Exception xe)
|
||||
{
|
||||
Console.WriteLine(xe.Message);
|
||||
|
||||
/*Dispatcher.Invoke(
|
||||
DispatcherPriority.Normal,
|
||||
(ThreadStart)delegate { ServerStats.Text = "Ein Fehler im Bereich Message"; });
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
//###############################################################################
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<HintPath>..\..\BeWoPlaner\Lib\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.DynamicProxy">
|
||||
<HintPath>..\..\BeWoPlaner\Lib\Castle.DynamicProxy.dll</HintPath>
|
||||
<HintPath>..\..\beyondSoft\BeWoPlaner\Lib\Castle.DynamicProxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@@ -56,7 +56,7 @@
|
||||
<HintPath>..\Lib\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate.ByteCode.Castle">
|
||||
<HintPath>..\..\BeWoPlaner\Lib\NHibernate.ByteCode.Castle.dll</HintPath>
|
||||
<HintPath>..\..\beyondSoft\BeWoPlaner\Lib\NHibernate.ByteCode.Castle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
@@ -1524,8 +1524,14 @@ namespace BeWo.Data.Access
|
||||
public IEnumerable<ChatMessage> FindAllChatMessages(long senderOid, long empfaengerOid)
|
||||
{
|
||||
var c = CreateCriteriaIsActive<ChatMessage>()
|
||||
.Add(Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, senderOid))
|
||||
.Add(Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, empfaengerOid));
|
||||
.Add(
|
||||
Restrictions.Or(
|
||||
Restrictions.And(
|
||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, senderOid),
|
||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, empfaengerOid)),
|
||||
Restrictions.And(
|
||||
Restrictions.Eq(ChatMessage.PropertyName_SenderPersonOid, empfaengerOid),
|
||||
Restrictions.Eq(ChatMessage.PropertyName_EmpfängerPersonOid, senderOid))));
|
||||
|
||||
return c.List<ChatMessage>();
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
NHibernate.Driver.MySqlDataDriver
|
||||
</property>
|
||||
|
||||
<property name="connection.connection_string">
|
||||
<!-- <property name="connection.connection_string">
|
||||
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
|
||||
</property>
|
||||
</property>-->
|
||||
|
||||
<!--<property name="connection.connection_string">
|
||||
<property name="connection.connection_string">
|
||||
Server=localhost;Password=root;User ID=root;Initial Catalog=1234567890
|
||||
</property>-->
|
||||
</property>
|
||||
|
||||
<property name="dialect">
|
||||
NHibernate.Dialect.MySQLDialect
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pDataContract.PersonNotice = pEntity.Notice;
|
||||
pDataContract.Abbreviation = pEntity.Abbreviation;
|
||||
pDataContract.ActivationType = pEntity.IsActive;
|
||||
pDataContract.Type = pEntity.Type;
|
||||
|
||||
|
||||
if (pEntity.Title != null)
|
||||
{
|
||||
|
||||
@@ -135,6 +135,9 @@ namespace BS.Shared.DataContracts
|
||||
[DataMember]
|
||||
public List<VarFieldDC> VarFields { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public PersonType Type { get; set; }
|
||||
|
||||
public bool ContainsAddressData()
|
||||
{
|
||||
return !Utils.AreAllNullOrEmpty(this.AddressLine1, this.Street, this.PostalCode, this.Town);
|
||||
|
||||
Reference in New Issue
Block a user