Fixes
This commit is contained in:
@@ -149,7 +149,7 @@ namespace ChatController
|
||||
{
|
||||
doSync = _chat.DoSynchronisation(_chatDaten.ApiKey, _chatDaten.Kundennummer);
|
||||
|
||||
if (true || doSync)
|
||||
if (doSync)
|
||||
{
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
|
||||
@@ -446,6 +446,7 @@ namespace ChatController
|
||||
|
||||
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
|
||||
|
||||
// neu performance versuch Adde
|
||||
|
||||
Chatbox.Text = "";
|
||||
|
||||
@@ -804,9 +805,9 @@ namespace ChatController
|
||||
break;
|
||||
}
|
||||
|
||||
Task.Delay(5000);
|
||||
//Task.Delay(5000);
|
||||
|
||||
//Thread.Sleep(5000);
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -833,21 +834,32 @@ namespace ChatController
|
||||
|
||||
private void Chat_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
StartWaiting();
|
||||
var chatItems = Chat.SelectedItems;
|
||||
|
||||
if (chatItems.Count > 0) {
|
||||
if (chatItems.Count > 0)
|
||||
{
|
||||
foreach (var items in chatItems)
|
||||
{
|
||||
var item = items as KontaktMessageBuilder;
|
||||
|
||||
if (item != null && item.ImageSources != null)
|
||||
{
|
||||
|
||||
|
||||
_chat.ShowPicture(item);
|
||||
|
||||
EndWaiting();
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EndWaiting();
|
||||
Cursor = Cursors.Arrow;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -954,45 +966,17 @@ namespace ChatController
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
|
||||
//StartWaiting();
|
||||
//if (_isDesktopVersion)
|
||||
//{
|
||||
// var doSync = _chat.DoSynchronisation(_chatDaten.ApiKey, _chatDaten.Kundennummer);
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
|
||||
// if (doSync)
|
||||
// {
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
|
||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
CollectionViewSource.GetDefaultView(Clientlist.ItemsSource).Refresh();
|
||||
//Clientlist.Items.Refresh();
|
||||
|
||||
_kontaktlist = x;
|
||||
LeseMessageInfoAusDatei();
|
||||
|
||||
Clientlist.Items.Refresh();
|
||||
|
||||
Cursor = Cursors.Arrow;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Cursor = Cursors.Arrow;
|
||||
// // EndWaiting();
|
||||
// if (OnClose != null)
|
||||
// {
|
||||
// OnClose();
|
||||
// }
|
||||
//}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
|
||||
// var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
|
||||
// _kontaktlist = x;
|
||||
|
||||
// Clientlist.Items.Refresh();
|
||||
|
||||
// Cursor = Cursors.Arrow;
|
||||
//}
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ using System.Windows.Media.Imaging;
|
||||
using ChatController.ChatKlassen;
|
||||
using ChatController.Klassen;
|
||||
using Newtonsoft.Json;
|
||||
using Application = System.Windows.Forms.Application;
|
||||
using Clipboard = System.Windows.Forms.Clipboard;
|
||||
using ContextMenu = System.Windows.Controls.ContextMenu;
|
||||
using Cursor = System.Windows.Input.Cursor;
|
||||
@@ -526,11 +527,13 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
TimeSpan lastTs = DateTime.UtcNow.TimeOfDay;
|
||||
|
||||
double timespan = lastTs.TotalSeconds;
|
||||
TimeSpan span = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
|
||||
long timespan = System.Convert.ToInt64(span.TotalSeconds);
|
||||
//long timespan = //lastTs.TotalSeconds;
|
||||
|
||||
if (_userMessages != null && _userMessages.Response.Messages.Length > 0)
|
||||
{
|
||||
timespan = _userMessages.Response.Messages.First().CreatetdAt;
|
||||
timespan = _userMessages.Response.Messages.First().Created_At;
|
||||
}
|
||||
|
||||
if (kontakt != null)
|
||||
@@ -558,7 +561,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}
|
||||
|
||||
private double? SendeTimestamp(long groupId,double lastStamp)
|
||||
private double? SendeTimestamp(long groupId,long lastStamp)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -596,18 +599,16 @@ namespace ChatController.HauptKlassen
|
||||
#region Prüfe für alle ob neue Nachrichten vorhanden sind
|
||||
|
||||
public double SchaueNachAllenMessageCounts()
|
||||
{
|
||||
TimeSpan lastTs = DateTime.UtcNow.TimeOfDay;
|
||||
{
|
||||
TimeSpan span = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
|
||||
long unixTime = System.Convert.ToInt64(span.TotalSeconds);
|
||||
|
||||
double timespan = lastTs.TotalSeconds;
|
||||
|
||||
var x = SendeTimestampForEach(0, timespan);
|
||||
|
||||
|
||||
var x = SendeTimestampForEach(0, unixTime);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
private double SendeTimestampForEach(long groupId, double lastStamp)
|
||||
private double SendeTimestampForEach(long groupId, long lastStamp)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1134,6 +1135,11 @@ namespace ChatController.HauptKlassen
|
||||
form.MaximumSize = new Size(500,500);
|
||||
form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
|
||||
form.MaximizeBox = false;
|
||||
|
||||
form.Text = "ownChat Bild Voschau";
|
||||
form.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
PictureBox pb = new PictureBox();
|
||||
pb.Dock = DockStyle.Fill;
|
||||
pb.Image = imgbit;
|
||||
@@ -1199,6 +1205,11 @@ namespace ChatController.HauptKlassen
|
||||
form.MaximumSize = new Size(500,500);
|
||||
form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
|
||||
form.MaximizeBox = false;
|
||||
|
||||
form.Text = "ownChat Bild Voschau";
|
||||
form.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
PictureBox pb = new PictureBox();
|
||||
pb.Dock = DockStyle.Fill;
|
||||
pb.Image = imgbit;
|
||||
@@ -1321,33 +1332,45 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
try
|
||||
{
|
||||
Kontaktliste.Clear();
|
||||
foreach (var kontakt in chatDaten.Response)
|
||||
{
|
||||
|
||||
foreach (var value in kontakt.Value)
|
||||
{
|
||||
string message = "";
|
||||
DateTime timestamp = new DateTime();
|
||||
//var val = Kontaktliste.Find(item => item.GroupId == value.Oid);
|
||||
|
||||
var lastMS = value.LastMessage;
|
||||
//if (val == null) //was tun wenn der nicht merh drinne ist ?? dann ist das ja auch null
|
||||
//{
|
||||
string message = "";
|
||||
DateTime timestamp = new DateTime();
|
||||
|
||||
var lastMS = value.LastMessage;
|
||||
|
||||
|
||||
if (lastMS != null)
|
||||
{
|
||||
if (lastMS.Text != null)
|
||||
if (lastMS != null)
|
||||
{
|
||||
message = lastMS.Text;
|
||||
timestamp = DateTime.Parse(lastMS.Timestamp.Date);
|
||||
if (lastMS.Text != null)
|
||||
{
|
||||
message = lastMS.Text;
|
||||
timestamp = DateTime.Parse(lastMS.Timestamp.Date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (message.Equals("") && value.LastMessage != null && !value.LastMessage.File.Equals(""))
|
||||
{
|
||||
message = Path.GetFileName(value.LastMessage.File);
|
||||
}
|
||||
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));
|
||||
//null steht für employee
|
||||
Kontaktliste.Add(new KontaktlistBuilder(value.Name,
|
||||
AvatarToImageSourceConverter(value.Avatar),
|
||||
message, timestamp, value.Oid, null));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// //Item Bereits vorhanden
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<TextBox x:Name="TextBoxBenutzerName" Grid.Column="1" Grid.Row="2" Margin="3" VerticalContentAlignment="Center" />
|
||||
|
||||
<Label Grid.Column="0" Grid.Row="3" Margin="3" Foreground="White">Passwort:</Label>
|
||||
<PasswordBox x:Name="TextBoxPasswort" Grid.Column="1" Grid.Row="3" Margin="3" VerticalContentAlignment="Center"/>
|
||||
<PasswordBox x:Name="TextBoxPasswort" Grid.Column="1" Grid.Row="3" Margin="3" VerticalContentAlignment="Center" KeyUp="TextBoxPasswort_OnKeyUp"/>
|
||||
|
||||
<!--
|
||||
<CheckBox x:Name="Merken" Margin="3" Content="Passwort Speichern" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4"/>-->
|
||||
|
||||
@@ -11,9 +11,9 @@ using System.Threading;
|
||||
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.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
@@ -22,7 +22,11 @@ using System.Windows.Shapes;
|
||||
using ChatController.HauptKlassen;
|
||||
using ChatController.Klassen;
|
||||
using Newtonsoft.Json;
|
||||
using Cursors = System.Windows.Input.Cursors;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using Path = System.IO.Path;
|
||||
using UserControl = System.Windows.Controls.UserControl;
|
||||
|
||||
namespace ChatController
|
||||
{
|
||||
@@ -59,13 +63,26 @@ namespace ChatController
|
||||
}
|
||||
|
||||
private void AnmeldenButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Anmelden();
|
||||
}
|
||||
|
||||
private void TextBoxPasswort_OnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Return)
|
||||
{
|
||||
Anmelden();
|
||||
}
|
||||
}
|
||||
|
||||
private void Anmelden()
|
||||
{
|
||||
try
|
||||
{
|
||||
//TODO Abfrage einführen die prüft ob eine verbindung ueberhaupt hergestellt werde kann | FehlerMeldungen Genauer Definieren
|
||||
if (!TextBoxKundennummer.Text.Equals("") && !TextBoxChatCode.Text.Equals("") &&
|
||||
!TextBoxBenutzerName.Text.Equals("") && !TextBoxPasswort.Password.Equals(""))
|
||||
{
|
||||
{
|
||||
Cursor = Cursors.Wait;
|
||||
|
||||
Login _login = new Login(TextBoxKundennummer.Text, TextBoxChatCode.Text, TextBoxBenutzerName.Text, TextBoxPasswort.Password);
|
||||
@@ -106,7 +123,7 @@ namespace ChatController
|
||||
Cursor = Cursors.Arrow;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Speichern / Laden / Löschen der Datei
|
||||
|
||||
@@ -284,7 +301,7 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAndCreateUserAppDataPath()
|
||||
private static string GetAndCreateUserAppDataPath()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -460,6 +477,8 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ChatController.Klassen
|
||||
public string Original_Filename { get; set; }
|
||||
public string Smaller_Image { get; set; }
|
||||
public LastMessageTimeStamp Timestamp { get; set; }
|
||||
public long CreatetdAt { get; set; }
|
||||
public long Created_At { get; set; }
|
||||
public long UserId { get; set; }
|
||||
public string User_Name { get; set; }
|
||||
public string UserPicture { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user