.
@@ -24,7 +24,7 @@ namespace ChatController
|
||||
|
||||
DataContext = this;
|
||||
|
||||
DialogText = dialogText ?? "Daten werden übertragen. Bitte warten...";
|
||||
DialogText = string.IsNullOrWhiteSpace(dialogText) ? "Daten werden übertragen. Bitte warten..." : dialogText;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
<Compile Include="Core\OwnChatCache.cs" />
|
||||
<Compile Include="Core\OwnChatRichTextBox.cs" />
|
||||
<Compile Include="Data\LookupResult.cs" />
|
||||
<Compile Include="Data\OwnChatApi.cs" />
|
||||
<Compile Include="Extensions\IDictionaryTExtensions.cs" />
|
||||
<Compile Include="Extensions\IListTExtensions.cs" />
|
||||
<Compile Include="HauptKlassen\Chat.cs" />
|
||||
@@ -140,18 +139,8 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Ressourcen\BeyondsoftChat.jpg" />
|
||||
<Resource Include="Ressourcen\ClipboardDisabled.png" />
|
||||
<Resource Include="Ressourcen\glucklicher.png" />
|
||||
<Resource Include="Ressourcen\mitarbeiter-avatar.png" />
|
||||
<Resource Include="Ressourcen\mitarbeiter-team-avatar.png" />
|
||||
<Resource Include="Ressourcen\paperclip.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Ressourcen\paperclip2.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Ressourcen\SymbolRefresh32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Ressourcen\ownChat-Background.png" />
|
||||
@@ -168,7 +157,6 @@
|
||||
<Resource Include="Ressourcen\paperclip-solid.png" />
|
||||
<Resource Include="Ressourcen\smile-regular.png" />
|
||||
<Resource Include="Ressourcen\sync-alt.png" />
|
||||
<Resource Include="Ressourcen\TasksSolid.png" />
|
||||
<Resource Include="Ressourcen\ownchat_image_placeholder.png" />
|
||||
<Resource Include="Ressourcen\warning-exclamation-mark.png" />
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ChatController.ChatKlassen
|
||||
{
|
||||
public static class ChatControlExtensions
|
||||
{
|
||||
private static Action EmptyDelegatee = delegate() { };
|
||||
private static readonly Action EmptyDelegatee = delegate { };
|
||||
|
||||
public static void RefreshChatUI(this UIElement uiElement)
|
||||
{
|
||||
|
||||
@@ -126,12 +126,7 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if(obj is Contact y)
|
||||
{
|
||||
return GroupId == y.GroupId;
|
||||
}
|
||||
|
||||
return false;
|
||||
return obj is Contact y && GroupId == y.GroupId;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
<converter:StringEmptyToVisibilityConverter x:Key="StringEmptyToVisibilityConverter" />
|
||||
<converter:UserProfilePictureVisibilityConverter x:Key="UserProfilePictureVisibilityConverter" />
|
||||
<converter:BroadcastCheckBoxVisibilityMultiConverter x:Key="BroadcastCheckBoxVisibilityMultiConverter" />
|
||||
<converter:OwnChatNullVisibilityConverter x:Key="OwnChatNullVisibilityConverter" />
|
||||
|
||||
<SolidColorBrush x:Key="DarkBackColor" Color="#A9B8C2" />
|
||||
<SolidColorBrush x:Key="LightBackColor" Color="#F3F3F3" />
|
||||
@@ -111,7 +110,6 @@
|
||||
Maximum="{TemplateBinding ScrollableWidth}"
|
||||
ViewportSize="{TemplateBinding ViewportWidth}"
|
||||
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
|
||||
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
||||
@@ -11,17 +11,7 @@ namespace ChatController.Converter
|
||||
{
|
||||
if(value is bool boolValue)
|
||||
{
|
||||
if(parameter is string reverseString && Equals(reverseString, "reverse"))
|
||||
{
|
||||
return boolValue ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if(parameter is string reverseHiddenString && Equals(reverseHiddenString, "reverse_hidden"))
|
||||
{
|
||||
return boolValue ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
return boolValue ? Visibility.Collapsed : Visibility.Visible;
|
||||
return parameter is string reverseString && Equals(reverseString, "reverse") ? boolValue ? Visibility.Visible : Visibility.Collapsed : boolValue ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
return Visibility.Visible;
|
||||
|
||||
@@ -11,12 +11,7 @@ namespace ChatController.Converter
|
||||
{
|
||||
if(values.Length == 2 && values[0] is bool isInBroadcastMode && values[1] is bool isChatMessageInputGridVisible)
|
||||
{
|
||||
if(isInBroadcastMode)
|
||||
{
|
||||
return isChatMessageInputGridVisible ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
return Visibility.Collapsed;
|
||||
return isInBroadcastMode ? isChatMessageInputGridVisible ? Visibility.Visible : Visibility.Hidden : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
return Visibility.Collapsed;
|
||||
|
||||
@@ -56,19 +56,6 @@ namespace ChatController.Core
|
||||
return _Instance ?? (_Instance = new OwnChatCache());
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
ClearImageSources();
|
||||
}
|
||||
|
||||
public void ClearImageSources()
|
||||
{
|
||||
lock(_Lock)
|
||||
{
|
||||
_ImageSourceCache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public ImageSource GetImageSourceFromCache(string key, string name, CacheCategory cacheCategory)
|
||||
{
|
||||
lock(_Lock)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ChatController.Core
|
||||
var flowDocument = new FlowDocument();
|
||||
var paragraph = new Paragraph
|
||||
{
|
||||
Margin = new Thickness(0) // remove indent between paragraphs
|
||||
Margin = new Thickness(0)
|
||||
};
|
||||
|
||||
paragraph.Inlines.AddRange(inlines);
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using ChatController.LoginKlassen;
|
||||
using ChatController.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ChatController.Data
|
||||
{
|
||||
public class OwnChatApi
|
||||
{
|
||||
public static string ServerUrl { get; set; }
|
||||
public static string ApiKey { get; set; }
|
||||
public static string Tenant { get; set; }
|
||||
|
||||
public static long GetMaximumAllowedFileUploadSize(string pApiKey, string pCustomerId)
|
||||
{
|
||||
var url = ServerUrl + Constants.MaxUploadFileSizeUrl;
|
||||
|
||||
var webRequest = WebRequest.Create(url);
|
||||
webRequest.Headers[Constants.Token] = pApiKey;
|
||||
webRequest.Headers[Constants.CustomerId] = pCustomerId;
|
||||
|
||||
webRequest.Credentials = CredentialCache.DefaultCredentials;
|
||||
webRequest.Proxy = null;
|
||||
|
||||
using (var response = webRequest.GetResponse())
|
||||
{
|
||||
var responseFromServer = ReadStream(response);
|
||||
|
||||
var definiti = new {file_upload_max_size = ""};
|
||||
|
||||
var jsonDatentyp = JsonConvert.DeserializeAnonymousType(responseFromServer, definiti);
|
||||
|
||||
return Convert.ToInt64(jsonDatentyp.file_upload_max_size);
|
||||
}
|
||||
}
|
||||
|
||||
public static UserMessages GetMessages(long pGroupId)
|
||||
{
|
||||
|
||||
var url = ServerUrl + Constants.LoadMessagesForGroupUrl + pGroupId;
|
||||
|
||||
var webRequest = WebRequest.Create(url);
|
||||
|
||||
webRequest.Credentials = CredentialCache.DefaultCredentials;
|
||||
webRequest.Headers[Constants.Token] = ApiKey;
|
||||
webRequest.Headers[Constants.CustomerId] = Tenant;
|
||||
|
||||
using (var response = webRequest.GetResponse())
|
||||
{
|
||||
var serverResponse = ReadStream(response);
|
||||
|
||||
if (!string.IsNullOrEmpty(serverResponse))
|
||||
{
|
||||
return JsonConvert.DeserializeObject<UserMessages>(serverResponse);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ChatGruppenDaten GetAllChatGroups()
|
||||
{
|
||||
var endurl = ServerUrl + Constants.GetChatGroupsUrl;
|
||||
|
||||
var webRequest = WebRequest.Create(endurl);
|
||||
|
||||
webRequest.Credentials = CredentialCache.DefaultCredentials;
|
||||
webRequest.Headers[Constants.Token] = ApiKey;
|
||||
webRequest.Headers[Constants.CustomerId] = Tenant;
|
||||
|
||||
using (var response = webRequest.GetResponse())
|
||||
{
|
||||
var serverResponse = ReadStream(response);
|
||||
return JsonConvert.DeserializeObject<ChatGruppenDaten>(serverResponse);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ReadStream(WebResponse response)
|
||||
{
|
||||
try
|
||||
{
|
||||
var serverResponse = string.Empty;
|
||||
|
||||
using (var dataStream = response.GetResponseStream())
|
||||
{
|
||||
if(dataStream is null)
|
||||
{
|
||||
return serverResponse;
|
||||
}
|
||||
|
||||
using (var reader = new StreamReader(dataStream))
|
||||
{
|
||||
serverResponse = reader.ReadToEnd();
|
||||
|
||||
return serverResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
@@ -16,7 +15,6 @@ using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
@@ -595,12 +593,12 @@ namespace ChatController.HauptKlassen
|
||||
fileName = fileName.Replace(".bmp", ".jpg");
|
||||
}
|
||||
|
||||
await SendMediaMessage(fileName, currentContact.GroupId, mediaFile, message, pFile);
|
||||
await SendMediaMessage(fileName, currentContact.GroupId, mediaFile, message);
|
||||
}
|
||||
|
||||
private HttpRequestMessage _HttpRequest;
|
||||
|
||||
private async Task SendMediaMessage(string fileName, long groupId, byte[] mediaFile, string message, string pathToTempFile)
|
||||
private async Task SendMediaMessage(string fileName, long groupId, byte[] mediaFile, string message)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -761,7 +759,7 @@ namespace ChatController.HauptKlassen
|
||||
pChatMainControl.ChatListBox.Items.MoveCurrentToLast();
|
||||
pChatMainControl.ChatListBox.ScrollIntoView(pChatMainControl.ChatListBox.Items.CurrentItem);
|
||||
|
||||
await SendMediaMessage(fileName, pGroupOid, mediaFile, null, pathToFile);
|
||||
await SendMediaMessage(fileName, pGroupOid, mediaFile, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -800,7 +798,7 @@ namespace ChatController.HauptKlassen
|
||||
pChatMainControl.ChatListBox.Items.MoveCurrentToLast();
|
||||
pChatMainControl.ChatListBox.ScrollIntoView(pChatMainControl.ChatListBox.Items.CurrentItem);
|
||||
|
||||
await SendMediaMessage(imageName, pGroupOid, Utils.ImageToByteArray(image), null, null);
|
||||
await SendMediaMessage(imageName, pGroupOid, Utils.ImageToByteArray(image), null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1134,10 +1132,6 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
@@ -1151,12 +1145,7 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
if(x is ChatMessage message1 && y is ChatMessage message2)
|
||||
{
|
||||
return message1.SendTime.CompareTo(message2.SendTime);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return x is ChatMessage message1 && y is ChatMessage message2 ? message1.SendTime.CompareTo(message2.SendTime) : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}, errorMessage => { exceptionCallback?.Invoke(errorMessage); });
|
||||
}
|
||||
catch (Exception exception)
|
||||
catch(Exception)
|
||||
{
|
||||
callback?.Invoke(null);
|
||||
}
|
||||
@@ -187,7 +187,7 @@ namespace ChatController.HauptKlassen
|
||||
callback?.Invoke(result);
|
||||
});
|
||||
}
|
||||
catch (Exception exception)
|
||||
catch(Exception)
|
||||
{
|
||||
exceptionCallback?.Invoke("Fehler: Es konnte keine Verbindung aufgebaut werden.");
|
||||
}
|
||||
@@ -211,7 +211,7 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
response = request.GetResponse();
|
||||
}
|
||||
catch (Exception e)
|
||||
catch(Exception)
|
||||
{
|
||||
if (_ShouldShowMessageBox)
|
||||
{
|
||||
@@ -247,7 +247,7 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
_BaseUrl = jsonDatentyp.Url;
|
||||
}
|
||||
catch (Exception eds)
|
||||
catch(Exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using ChatController.Annotations;
|
||||
using ChatController.HauptKlassen;
|
||||
@@ -298,7 +297,7 @@ namespace ChatController
|
||||
try
|
||||
{
|
||||
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
var companyFilePath = Path.Combine(localAppData, "beyondSoft");
|
||||
var companyFilePath = Path.Combine(localAppData, "ownSoft");
|
||||
|
||||
if(!Directory.Exists(companyFilePath))
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 809 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -5,12 +5,7 @@ namespace ChatController.Utilities
|
||||
public static class Constants
|
||||
{
|
||||
public static readonly List<string> ImageFileExtensions = new List<string> { ".JPG", ".JPE", ".BMP", ".GIF", ".PNG", ".JPEG" };
|
||||
public static readonly List<string> DocumentFileExtension = new List<string> { ".TXT", ".PPT", ".XLS", ".DOC", ".PDF" };
|
||||
|
||||
public static readonly string TeamDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/team_default.png";
|
||||
public static readonly string EmployeeDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/employee_default.png";
|
||||
public static readonly string CustomerDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/client_default.png";
|
||||
public static readonly string NormalGroupDefaultImagePath = "pack://application:,,,/ChatController;component/Ressourcen/mitarbeiter-team-avatar.png";
|
||||
public static readonly string ImagePlaceholderPath = "pack://application:,,,/ChatController;component/Ressourcen/ownchat_image_placeholder.png";
|
||||
|
||||
public static readonly string Token = "Token";
|
||||
@@ -23,16 +18,11 @@ namespace ChatController.Utilities
|
||||
public static readonly string LoadOwnChatNewsUrl = "/api/ownchat/news/";
|
||||
public static readonly string SendMessageUrl = "/api/chat/messages/send";
|
||||
|
||||
public static readonly string UrlPageParameter = "&page=";
|
||||
|
||||
public static readonly int NotificationTimeout = 1500;
|
||||
|
||||
public static readonly string ContentTypeKey = "content-type";
|
||||
public static readonly string FormUrlEncodedContentTypeValue = "application/x-www-form-urlencoded";
|
||||
public static readonly string MultipartContentTypeValue = "multipart/form-data";
|
||||
|
||||
public static readonly string TenantAndChatCodeFileName = "ownChat.txt";
|
||||
|
||||
public static readonly string ProfilePictureCacheName = "profile-picture";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,29 +171,6 @@ namespace ChatController.Utilities
|
||||
});
|
||||
}
|
||||
|
||||
private static ImageSource GetDefaultImageSource(bool pIsGroup, bool pIsEmployee)
|
||||
{
|
||||
var defaultImage = Constants.EmployeeDefaultImagePath;
|
||||
|
||||
if(pIsGroup)
|
||||
{
|
||||
defaultImage = pIsEmployee ? Constants.TeamDefaultImagePath : Constants.NormalGroupDefaultImagePath;
|
||||
}
|
||||
else if(!pIsEmployee)
|
||||
{
|
||||
defaultImage = Constants.CustomerDefaultImagePath;
|
||||
}
|
||||
|
||||
var resultBitmapImage = new BitmapImage();
|
||||
|
||||
resultBitmapImage.BeginInit();
|
||||
resultBitmapImage.UriSource = new Uri(defaultImage);
|
||||
resultBitmapImage.EndInit();
|
||||
resultBitmapImage.Freeze();
|
||||
|
||||
return resultBitmapImage;
|
||||
}
|
||||
|
||||
public static ImageSource GetPicturePlaceholder()
|
||||
{
|
||||
var cache = OwnChatCache.GetInstance();
|
||||
@@ -422,56 +399,6 @@ namespace ChatController.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* try
|
||||
{
|
||||
using (var form = new Form())
|
||||
{
|
||||
using (var ms = new MemoryStream(e.Result))
|
||||
{
|
||||
var image = System.Drawing.Image.FromStream(ms);
|
||||
|
||||
using (var bitmap = new Bitmap(image))
|
||||
{
|
||||
short orient = 0;
|
||||
const int orientationId = 0x0112;
|
||||
|
||||
if (image.PropertyIdList.Contains(orientationId))
|
||||
{
|
||||
var item = image.GetPropertyItem(orientationId);
|
||||
|
||||
orient = BitConverter.ToInt16(item.Value, 0);
|
||||
|
||||
bitmap.SetPropertyItem(item);
|
||||
}
|
||||
|
||||
var flipType = Utils.OrientationToFlipType(orient.ToString());
|
||||
|
||||
bitmap.RotateFlip(flipType);
|
||||
|
||||
form.StartPosition = FormStartPosition.CenterScreen;
|
||||
form.ClientSize = bitmap.Size;
|
||||
form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||
form.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
using (var pictureBox = new PictureBox())
|
||||
{
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Image = bitmap;
|
||||
|
||||
pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
|
||||
form.Controls.Add(pictureBox);
|
||||
|
||||
downloadCompletedCallback?.Invoke();
|
||||
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public static int GetHeightFromThumbnailUri(string uri)
|
||||
{
|
||||
/*
|
||||
|
||||