Verschickte Bilder werden jetzt korrekt rotiert angezeigt.
Die Synchronisation der Kontaktliste nach dem Senden einer Nachricht wird korrekt aktualisiert.
This commit is contained in:
@@ -642,6 +642,8 @@ namespace ChatController
|
||||
|
||||
Chatbox.Text = string.Empty;
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
||||
DoSynchro();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,16 +919,16 @@ namespace ChatController.HauptKlassen
|
||||
var windowMaxWidth = imageWidth;
|
||||
var windowMaxHeight = imageHeight;
|
||||
|
||||
if (windowMaxWidth > primaryScreenWidth2 || windowMaxHeight > primaryScreenHeight2)
|
||||
if(windowMaxWidth > .8 * primaryScreenWidth2 || windowMaxHeight > .8 * primaryScreenHeight2)
|
||||
{
|
||||
if (primaryScreenWidth2 > primaryScreenHeight2)
|
||||
if(primaryScreenWidth2 > primaryScreenHeight2)
|
||||
{
|
||||
windowMaxHeight = (int)(.9 * primaryScreenHeight2);
|
||||
windowMaxHeight = (int)(.8 * primaryScreenHeight2);
|
||||
windowMaxWidth = (int)(windowMaxHeight * imageAspectRatio);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowMaxWidth = (int)(.9 * primaryScreenWidth2);
|
||||
windowMaxWidth = (int)(.8 * primaryScreenWidth2);
|
||||
windowMaxHeight = (int)(windowMaxWidth * imageAspectRatio);
|
||||
}
|
||||
}
|
||||
@@ -978,7 +978,7 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
public void ShowPicture(string originalImage, long groupId, Action<ImageSource, string> downloadCompletedCallback)
|
||||
{
|
||||
if(originalImage == null)
|
||||
if(originalImage is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,27 +74,53 @@ namespace ChatController.Utilities
|
||||
{
|
||||
ResponseWriter = stream =>
|
||||
{
|
||||
var bitmap = new BitmapImage();
|
||||
var rotation = Rotation.Rotate0;
|
||||
|
||||
var localStream = new MemoryStream();
|
||||
using(var image = Image.FromStream(stream))
|
||||
{
|
||||
if(image.PropertyIdList.Contains(0x112))
|
||||
{
|
||||
rotation = GetRotationFromExifTag(image.GetPropertyItem(0x112).Value[0]);
|
||||
}
|
||||
|
||||
stream.CopyTo(localStream);
|
||||
var bitmap = new BitmapImage();
|
||||
|
||||
localStream.Position = 0;
|
||||
var localStream = new MemoryStream();
|
||||
|
||||
bitmap.BeginInit();
|
||||
bitmap.StreamSource = localStream;
|
||||
bitmap.EndInit();
|
||||
bitmap.Freeze();
|
||||
image.Save(localStream, image.RawFormat);
|
||||
|
||||
callback?.Invoke(bitmap);
|
||||
localStream.Position = 0;
|
||||
|
||||
bitmap.BeginInit();
|
||||
bitmap.StreamSource = localStream;
|
||||
bitmap.Rotation = rotation;
|
||||
bitmap.EndInit();
|
||||
bitmap.Freeze();
|
||||
|
||||
callback?.Invoke(bitmap);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
request.AddHeader(Constants.Token, AuthToken);
|
||||
request.AddHeader(Constants.CustomerId, Tenant);
|
||||
|
||||
client.ExecuteAsync(request, response => { /*Das übernimmt der ResponseWriter von oben*/ });
|
||||
client.ExecuteAsync(request, null);
|
||||
}
|
||||
|
||||
private static Rotation GetRotationFromExifTag(int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 6:
|
||||
return Rotation.Rotate90;
|
||||
case 8:
|
||||
return Rotation.Rotate270;
|
||||
case 3:
|
||||
return Rotation.Rotate180;
|
||||
default:
|
||||
return Rotation.Rotate0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void DownloadImageAsync(string uri, string key, CacheCategory cacheCategory, Action<ImageSource> callback)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user