Anzeige von neuen Nachrichten und die Ladegeschwindigkeit von Konversationen verbessert

Aufgrund der Benutzung von Threads anstelle von Timern hat das Aufrufen der einzelnen Konversationen ca. 2 Sekunden gedauert.
Die Synchronisationsdatei enthält, ob die letzte Nachrichte bereits gelesen wurde, sodass man,
wenn man den Chat beendet bevor man eine neue Nachricht gelesen hat, diese nach dem erneuten Öffnen immer noch als neu angezeigt wird.

- Dateinamen verbessert
- Diverse Verbesserungen des Codes
This commit is contained in:
Lyndon
2019-05-14 13:37:20 +02:00
parent b82821d0c4
commit 3fbf8afe0d
25 changed files with 962 additions and 1131 deletions

View File

@@ -6,7 +6,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.0' classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'io.realm:realm-gradle-plugin:5.3.0' classpath 'io.realm:realm-gradle-plugin:5.3.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@@ -1,6 +1,6 @@
#Tue Sep 25 13:06:52 CEST 2018 #Mon Apr 08 14:14:05 CEST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

View File

@@ -33,6 +33,9 @@
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>ownchat_favicon.ico</ApplicationIcon> <ApplicationIcon>ownchat_favicon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DevExpress.Mvvm.v17.1, Version=17.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL"> <Reference Include="DevExpress.Mvvm.v17.1, Version=17.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<Private>False</Private> <Private>False</Private>
@@ -60,10 +63,10 @@
<Compile Include="ChatEmojiiControl.xaml.cs"> <Compile Include="ChatEmojiiControl.xaml.cs">
<DependentUpon>ChatEmojiiControl.xaml</DependentUpon> <DependentUpon>ChatEmojiiControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ChatKlassen\AktuellerKontakt.cs" />
<Compile Include="ChatKlassen\ChatControlExtensions.cs" /> <Compile Include="ChatKlassen\ChatControlExtensions.cs" />
<Compile Include="ChatKlassen\Contact.cs" /> <Compile Include="ChatKlassen\Contact.cs" />
<Compile Include="ChatKlassen\ChatMessage.cs" /> <Compile Include="ChatKlassen\ChatMessage.cs" />
<Compile Include="ChatKlassen\CurrentContact.cs" />
<Compile Include="ChatKlassen\MessageCounter.cs" /> <Compile Include="ChatKlassen\MessageCounter.cs" />
<Compile Include="ChatMainControl.xaml.cs"> <Compile Include="ChatMainControl.xaml.cs">
<DependentUpon>ChatMainControl.xaml</DependentUpon> <DependentUpon>ChatMainControl.xaml</DependentUpon>
@@ -74,12 +77,13 @@
<Compile Include="LoginControl.xaml.cs"> <Compile Include="LoginControl.xaml.cs">
<DependentUpon>LoginControl.xaml</DependentUpon> <DependentUpon>LoginControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="LoginKlassen\AuthentifizierungsDaten.cs" /> <Compile Include="LoginKlassen\AuthenticationData.cs" />
<Compile Include="LoginKlassen\ChatDatenUebergabe.cs" /> <Compile Include="LoginKlassen\ChatDatenUebergabe.cs" />
<Compile Include="LoginKlassen\ChatGruppenDaten.cs" /> <Compile Include="LoginKlassen\ChatGruppenDaten.cs" />
<Compile Include="HauptKlassen\Login.cs" /> <Compile Include="HauptKlassen\Login.cs" />
<Compile Include="LoginKlassen\UserDaten.cs" /> <Compile Include="LoginKlassen\UserDaten.cs" />
<Compile Include="LoginKlassen\UserMessages.cs" /> <Compile Include="LoginKlassen\UserMessages.cs" />
<Compile Include="Properties\Annotations1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ChatControlWaitLayer.xaml.cs"> <Compile Include="ChatControlWaitLayer.xaml.cs">
<DependentUpon>ChatControlWaitLayer.xaml</DependentUpon> <DependentUpon>ChatControlWaitLayer.xaml</DependentUpon>
@@ -90,6 +94,8 @@
<DependentUpon>Resource.resx</DependentUpon> <DependentUpon>Resource.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Utilities\Constants.cs" /> <Compile Include="Utilities\Constants.cs" />
<Compile Include="Utilities\Extensions\DateTimeExtensions.cs" />
<Compile Include="Utilities\SyncFileInfoStruct.cs" />
<Compile Include="Utilities\Utils.cs" /> <Compile Include="Utilities\Utils.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -132,6 +138,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="ownchat_favicon.ico" /> <Content Include="ownchat_favicon.ico" />
<None Include="Resources\IconNewMessages.ico" />
<None Include="Resources\oC-favico_NewMessage.ico" />
<Content Include="Resources\ownchat_favicon.ico" /> <Content Include="Resources\ownchat_favicon.ico" />
<Resource Include="Ressourcen\ownchat_favicon.ico" /> <Resource Include="Ressourcen\ownchat_favicon.ico" />
<Resource Include="Ressourcen\client_default.png" /> <Resource Include="Ressourcen\client_default.png" />

View File

@@ -9,7 +9,7 @@ namespace ChatController.ChatKlassen
public class ChatMessage public class ChatMessage
{ {
//Chat-Ansicht //Chat-Ansicht
public ChatMessage(string username, string message, DateTime sendtime, bool isme) public ChatMessage(string username, string message, DateTime sendtime, bool isme, long pGroupId)
{ {
Username = username; Username = username;
UserMessage = message; UserMessage = message;
@@ -19,10 +19,12 @@ namespace ChatController.ChatKlassen
Farbgebung(isme); Farbgebung(isme);
VisibilityRegelung(IsHyperlink(message) ? "HyperlinkMessage" : "Message"); VisibilityRegelung(IsHyperlink(message) ? "HyperlinkMessage" : "Message");
GroupId = pGroupId;
} }
// Image-Ansicht // Image-Ansicht
public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName) public ChatMessage(string username, string message, DateTime sendtime, bool isme, ImageSource image, string originalImage, string imageName, long pGroupId)
{ {
Username = username; Username = username;
UserMessage = message; UserMessage = message;
@@ -35,64 +37,49 @@ namespace ChatController.ChatKlassen
Farbgebung(isme); Farbgebung(isme);
VisibilityRegelung("Image"); VisibilityRegelung("Image");
}
//Image-PlaceHolder | wird nicht benutzt und wird nicht gebraucht ?
public ChatMessage(string username, string message, DateTime sendtime, bool isme, string originalImage, string imageName)
{
Username = username;
UserMessage = message;
SendTime = sendtime;
IsMyMessage = isme;
OriginalImage = originalImage;
OriginalImageName = imageName;
Farbgebung(isme); GroupId = pGroupId;
VisibilityRegelung("Default_Image");
} }
//Dokumenten-Ansicht //Dokumenten-Ansicht
public ChatMessage(string username, string message, DateTime sendtime, string pSmallerImagePath, bool isme, string url) public ChatMessage(string pUsername, string pMessageText, DateTime pSendTime, string pSmallerImagePath, bool pIsLoggedInUsersMessage, string pUrl, long pGroupId)
{ {
Username = username; Username = pUsername;
UserMessage = message; UserMessage = pMessageText;
SendTime = sendtime; SendTime = pSendTime;
IsMyMessage = isme; IsMyMessage = pIsLoggedInUsersMessage;
Dokpfad = url; FilePath = pUrl;
Farbgebung(isme); Farbgebung(pIsLoggedInUsersMessage);
Thumbnail = Utilities.Utils.CreateImageSourceFromPath(pSmallerImagePath); Thumbnail = Utilities.Utils.CreateImageSourceFromPath(pSmallerImagePath);
VisibilityRegelung("Dokumente"); VisibilityRegelung("Dokumente");
GroupId = pGroupId;
} }
public ImageSource Thumbnail { get; } public ImageSource Thumbnail { get; }
#region Farbgebung
private void Farbgebung(bool isme) private void Farbgebung(bool isme)
{ {
if (isme) if (isme)
{ {
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush; ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
Posi = "Right"; Posi = "Right";
_farbeRechtsColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
_farbeLinksColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
} }
else else
{ {
ChatColor = new BrushConverter().ConvertFromString("#FFFFFF") as SolidColorBrush; //"#cccccc" ChatColor = new BrushConverter().ConvertFromString("#FFFFFF") as SolidColorBrush; //"#cccccc"
Posi = "Left"; Posi = "Left";
_farbeRechtsColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
_farbeLinksColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
} }
}
#endregion
#region Visibility Regelung _farbeRechtsColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
_farbeLinksColor = new BrushConverter().ConvertFromString("#505050") as SolidColorBrush;
}
private void VisibilityRegelung(string Ansicht) private void VisibilityRegelung(string Ansicht)
{ {
switch (Ansicht) switch (Ansicht)
@@ -141,9 +128,6 @@ namespace ChatController.ChatKlassen
break; break;
} }
} }
#endregion
#region Hyperlink Detection
private static readonly Regex UrlRegex = new Regex(@"(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&amp;(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?"); private static readonly Regex UrlRegex = new Regex(@"(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&amp;(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?");
@@ -186,10 +170,6 @@ namespace ChatController.ChatKlassen
return false; return false;
} }
#endregion
#region Variablen
public bool IsMyMessage { get; set; } public bool IsMyMessage { get; set; }
public string Username { get; } public string Username { get; }
public string UserMessage { get; } public string UserMessage { get; }
@@ -210,7 +190,6 @@ namespace ChatController.ChatKlassen
public Visibility ChatVisibility { get; set; } public Visibility ChatVisibility { get; set; }
public Visibility HyperlinkVisibility { get; set; } public Visibility HyperlinkVisibility { get; set; }
private Visibility _pictureVisibility; private Visibility _pictureVisibility;
public Visibility PictureVisibility public Visibility PictureVisibility
@@ -247,11 +226,10 @@ namespace ChatController.ChatKlassen
public Visibility DokumentVisibility { get; set; } public Visibility DokumentVisibility { get; set; }
public ImageSource ImageSources { get; } public ImageSource ImageSources { get; }
public object Dokpfad { get; } public object FilePath { get; }
public long? ChatMessageOid { get; private set; } public long? ChatMessageOid { get; private set; }
//Farbe Links MEssageHeader
private Brush _farbeLinksColor; private Brush _farbeLinksColor;
public Brush FarbeLinksColor public Brush FarbeLinksColor
{ {
@@ -264,7 +242,6 @@ namespace ChatController.ChatKlassen
} }
} }
//Farbe Rechts MessageHeader
private Brush _farbeRechtsColor; private Brush _farbeRechtsColor;
public Brush FarbeRechtsColor public Brush FarbeRechtsColor
{ {
@@ -277,6 +254,8 @@ namespace ChatController.ChatKlassen
} }
} }
public long GroupId { get; }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName) protected virtual void OnPropertyChanged(string propertyName)
@@ -284,6 +263,5 @@ namespace ChatController.ChatKlassen
var handler = PropertyChanged; var handler = PropertyChanged;
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName)); handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
#endregion
} }
} }

View File

@@ -29,6 +29,8 @@ namespace ChatController.ChatKlassen
} }
} }
public bool IsNewMessage { get; set; }
private Brush _color; private Brush _color;
public Brush Color public Brush Color
{ {
@@ -41,25 +43,25 @@ namespace ChatController.ChatKlassen
} }
} }
private int _NumberOfReadMessages; private bool _HasUnreadMessages;
public int NumberOfReadMessages public bool HasUnreadMessages
{ {
get => _NumberOfReadMessages; get => _HasUnreadMessages;
set set
{ {
_NumberOfReadMessages = value; _HasUnreadMessages = value;
if (_NumberOfReadMessages == 1) if (_HasUnreadMessages)
{ {
_color = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush; _color = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
} }
else else
{ {
_color = new SolidColorBrush(Colors.Gray); _color = new SolidColorBrush(Colors.Gray);
} }
OnPropertyChanged(nameof(NumberOfReadMessages)); OnPropertyChanged(nameof(HasUnreadMessages));
OnPropertyChanged(nameof(Color)); OnPropertyChanged(nameof(Color));
} }
} }
@@ -78,21 +80,21 @@ namespace ChatController.ChatKlassen
public ImageSource Image { get; } public ImageSource Image { get; }
public DateTime TimeStamp { get; set; } public DateTime TimeStamp { get; set; }
public long GroupId { get; set; } public int GroupId { get; set; }
public long UserId { get; set; } public int UserOid { get; set; }
public long? CustomerOid { get; set; } public string UserIdManage { get; set; }
public Contact(string pName, ImageSource pImage, string pLastMessageText, DateTime pTimeStamp, long pGroupId,long? pCustomerOid, bool pOnlyEmployees, int pUserCount) public Contact(string pName, ImageSource pImage, string pLastMessageText, DateTime pTimeStamp, int pGroupId, string pUserIdManage, bool pOnlyEmployees, int pUserCount)
{ {
Name = pName; Name = pName;
ReceivedMessage = pLastMessageText; ReceivedMessage = pLastMessageText;
Image = pImage; Image = pImage;
TimeStamp = pTimeStamp; TimeStamp = pTimeStamp;
GroupId = pGroupId; GroupId = pGroupId;
CustomerOid = pCustomerOid; UserIdManage = pUserIdManage;
NumberOfReadMessages = 1; HasUnreadMessages = false;
if (CustomerOid != null) if (UserIdManage != null)
{ {
_ContactChatColor = new BrushConverter().ConvertFromString("#3B7799") as SolidColorBrush; _ContactChatColor = new BrushConverter().ConvertFromString("#3B7799") as SolidColorBrush;
} }

View File

@@ -3,7 +3,7 @@ using System.Windows.Media;
namespace ChatController.ChatKlassen namespace ChatController.ChatKlassen
{ {
public class AktuellerKontakt public class CurrentContact
{ {
public Contact Contact { get; set; } public Contact Contact { get; set; }
@@ -11,17 +11,17 @@ namespace ChatController.ChatKlassen
public ImageSource Image { get; } public ImageSource Image { get; }
public DateTime TimeStamp { get; set; } public DateTime TimeStamp { get; set; }
public long GroupId { get; set; } public long GroupId { get; set; }
public long? CustomerOid { get; set; } public string UserIdManage { get; set; }
public AktuellerKontakt(Contact pContact) public CurrentContact(Contact pContact)
{ {
if(pContact != null) { if(pContact != null) {
Contact = pContact; Contact = pContact;
Image = pContact.Image; Image = pContact.Image;
TimeStamp = pContact.TimeStamp; TimeStamp = pContact.TimeStamp;
Name = pContact.Name; Name = pContact.Name;
CustomerOid = pContact.CustomerOid; UserIdManage = pContact.UserIdManage;
GroupId = pContact.GroupId; GroupId = pContact.GroupId;
} }
} }

View File

@@ -1,10 +1,4 @@
using System; namespace ChatController.ChatKlassen
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.ChatKlassen
{ {
public class MessageCounter public class MessageCounter
{ {

View File

@@ -35,7 +35,7 @@
Maximum="{TemplateBinding ScrollableHeight}" Maximum="{TemplateBinding ScrollableHeight}"
ViewportSize="{TemplateBinding ViewportHeight}" ViewportSize="{TemplateBinding ViewportHeight}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Grid.Column="1"/> Grid.Row="0" Grid.Column="1"/>
<ScrollBar Name="PART_HorizontalScrollBar" <ScrollBar Name="PART_HorizontalScrollBar"
Orientation="Horizontal" Orientation="Horizontal"
Grid.Row="1" Grid.Row="1"
@@ -70,7 +70,6 @@
<ControlTemplate> <ControlTemplate>
<Grid> <Grid>
<Border x:Name="ItemBorder" MinHeight="20" Background="White" BorderThickness="0,0,0,1" BorderBrush="{StaticResource LightBackColor}"> <Border x:Name="ItemBorder" MinHeight="20" Background="White" BorderThickness="0,0,0,1" BorderBrush="{StaticResource LightBackColor}">
</Border> </Border>
<Border x:Name="ItemContent" MinHeight="20"> <Border x:Name="ItemContent" MinHeight="20">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True">
@@ -82,39 +81,30 @@
<ColumnDefinition Width="7"/> <ColumnDefinition Width="7"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Ellipse Grid.Column="1" Width='32' Height='32' RenderOptions.BitmapScalingMode="HighQuality"> <Ellipse Grid.Column="1" Width='32' Height='32' RenderOptions.BitmapScalingMode="HighQuality">
<Ellipse.Fill> <Ellipse.Fill>
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill' RenderOptions.BitmapScalingMode="HighQuality" /> <ImageBrush ImageSource='{Binding Image}' Stretch='Fill' RenderOptions.BitmapScalingMode="HighQuality" />
</Ellipse.Fill> </Ellipse.Fill>
</Ellipse> </Ellipse>
<Grid Grid.Column="3" > <Grid Grid.Column="3" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" Foreground="{Binding Path=KontaktChatColor}" FontSize="16" Margin="1" /> <TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" Foreground="{Binding Path=ContactChatColor}" FontSize="16" Margin="1" />
<TextBlock Text="{Binding Path=ReceivedMessage}" Grid.Row="1" FontSize="14" Foreground="{Binding Path=Color}" Margin="1" />
<TextBlock Text="{Binding Path=ReceiveMs}" Grid.Row="1" FontSize="14" Foreground="{Binding Path=Color}" Margin="1" />
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" /> <Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" />
</Trigger> </Trigger>
<Trigger Property="ListBoxItem.IsSelected" Value="True"> <Trigger Property="ListBoxItem.IsSelected" Value="True">
<Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" /> <Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" />
</Trigger> </Trigger>
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
@@ -122,11 +112,9 @@
<Condition Property="Selector.IsSelectionActive" Value="False" /> <Condition Property="Selector.IsSelectionActive" Value="False" />
</MultiTrigger.Conditions> </MultiTrigger.Conditions>
<Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" /> <Setter Property="Background" TargetName="ItemBorder" Value="{StaticResource DarkBackColor}" />
</MultiTrigger> </MultiTrigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
@@ -141,12 +129,8 @@
<Canvas Grid.Column="0" Width="14" Margin="3,4,2,2"> <Canvas Grid.Column="0" Width="14" Margin="3,4,2,2">
<Ellipse Stroke="#FFA0A0A0" Height="10" Width="10" StrokeThickness="2" Fill="{x:Null}" /> <Ellipse Stroke="#FFA0A0A0" Height="10" Width="10" StrokeThickness="2" Fill="{x:Null}" />
<Line Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFA0A0A0" Canvas.Left="6" Canvas.Top="7.4" Y1="0" Y2="5" StrokeThickness="3" X2="4" /> <Line Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFA0A0A0" Canvas.Left="6" Canvas.Top="7.4" Y1="0" Y2="5" StrokeThickness="3" X2="4" />
</Canvas> </Canvas>
</Grid> </Grid>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
@@ -159,9 +143,7 @@
<Grid> <Grid>
<Border x:Name="rootBorder" Background="{StaticResource DarkBackColor}" Padding="0" Margin="0" BorderThickness="0"> <Border x:Name="rootBorder" Background="{StaticResource DarkBackColor}" Padding="0" Margin="0" BorderThickness="0">
<!--Style="{DynamicResource MainContentGroupBoxWithoutMaximizeBtnStyle}"-->
<Grid > <Grid >
<!--Background="{StaticResource ObjectEditBackgroundBrush}"-->
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="250" /> <ColumnDefinition Width="250" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@@ -170,8 +152,6 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- ########################## Linkes panel ########################### -->
<Grid Grid.Column="0" Grid.Row="0" > <Grid Grid.Column="0" Grid.Row="0" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="50"/> <RowDefinition Height="50"/>
@@ -190,19 +170,15 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel x:Name="ReloadGruppen" Grid.Row="0" Grid.Column="1" Height="25" Width="25" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Visibility="Visible" Margin="0,0,3,0"> <StackPanel x:Name="ReloadGruppen" Grid.Row="0" Grid.Column="1" Height="25" Width="25" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Visibility="Visible" Margin="0,0,3,0">
<Button Background="Transparent" HorizontalAlignment="Right" BorderThickness="0" VerticalAlignment="Center" VerticalContentAlignment="Center" Width="25" Height="25" Click="ButtonReloadGruppen_OnClick" > <Button Background="Transparent" HorizontalAlignment="Right" BorderThickness="0" VerticalAlignment="Center" VerticalContentAlignment="Center" Width="25" Height="25" Click="ButtonReloadGruppen_OnClick" >
<Image ToolTip="Gruppen Aktualisieren" Margin="0,0,0,0" Width="20" Height="20" Source="pack://application:,,,/ChatController;component/Ressourcen/SymbolRefresh32.png" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" /> <Image ToolTip="Gruppen Aktualisieren" Margin="0,0,0,0" Width="20" Height="20" Source="pack://application:,,,/ChatController;component/Ressourcen/SymbolRefresh32.png" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" />
</Button> </Button>
</StackPanel> </StackPanel>
<TextBox Grid.Column="0" x:Name="Suche" Height="22" HorizontalAlignment="Stretch" Margin="5" TabIndex="0" Template="{DynamicResource SearchTextBoxTemplate}" BorderThickness="0,0,0,0" TextChanged="Suche_OnTextChanged" />
<TextBox x:Name="Suche" Height="22" HorizontalAlignment="Stretch" Margin="5" TabIndex="0" Template="{DynamicResource SearchTextBoxTemplate}" BorderThickness="0,0,0,0" TextChanged="Suche_OnTextChanged" />
</Grid> </Grid>
<Grid Grid.Column="0" Grid.Row="1" > <Grid Grid.Column="0" Grid.Row="1" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@@ -210,18 +186,12 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!--###################################### Liste aller User ###################################################### -->
<ListView x:Name="Clientlist" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" BorderThickness="0" Background="White" <ListView x:Name="Clientlist" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" BorderThickness="0" Background="White"
ItemContainerStyle="{StaticResource ContactListBoxItemStyle}" SelectionChanged="Clientlist_OnSelectionChanged" Style="{StaticResource ContactListStyle}"> ItemContainerStyle="{StaticResource ContactListBoxItemStyle}" SelectionChanged="Clientlist_OnSelectionChanged" Style="{StaticResource ContactListStyle}">
</ListView> </ListView>
</Grid> </Grid>
</Grid> </Grid>
<!-- ####################### Rechtes Panel ################################-->
<Grid Grid.Column="1" Grid.Row="0" x:Name="GridRechts"> <Grid Grid.Column="1" Grid.Row="0" x:Name="GridRechts">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@@ -232,8 +202,7 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ListBox x:Name="AktChatUserList" HorizontalAlignment="Left" Margin="0" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
<ListBox x:Name="AktChatUserList" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
<ListBox.Resources> <ListBox.Resources>
<DataTemplate x:Key="DataTemplate2"> <DataTemplate x:Key="DataTemplate2">
<Grid> <Grid>
@@ -257,12 +226,9 @@
</ListBox.Resources> </ListBox.Resources>
</ListBox> </ListBox>
<!--##### Chat Bereich ####-->
<ListBox x:Name="ChatListBox" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" BorderThickness="0" <ListBox x:Name="ChatListBox" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" BorderThickness="0"
VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged" Background="{StaticResource LightBackColor}" VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged" Background="{StaticResource LightBackColor}"
ContextMenuOpening="Chat_OnContextMenuOpening" Padding="20"> ContextMenuOpening="Chat_OnContextMenuOpening" Padding="20">
<!--MouseRightButtonDown="OnRightClickEvent"-->
<ListBox.ItemContainerStyle> <ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem"> <Style TargetType="ListBoxItem">
<Setter Property="HorizontalAlignment" Value="{Binding Posi}" /> <Setter Property="HorizontalAlignment" Value="{Binding Posi}" />
@@ -271,100 +237,49 @@
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<StackPanel> <StackPanel>
<Border BorderBrush="{Binding ChatColor}" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="{Binding ChatColor}" > <Border BorderBrush="{Binding ChatColor}" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="{Binding ChatColor}" >
<DockPanel MinHeight="15" Margin="5" LastChildFill="True" Background="{Binding ChatColor}" > <DockPanel MinHeight="15" Margin="5" LastChildFill="True" Background="{Binding ChatColor}" >
<!-- Message Bereich -->
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ChatVisibility}" > <StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ChatVisibility}" >
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" FontSize="14"/> <TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" FontSize="14"/>
<!-- <RichTextBox VerticalAlignment="Center" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" local:RichTextBoxHelper.DocumentXaml="{Binding UserMessage}" MinWidth="0" MaxWidth="500" />-->
</StackPanel> </StackPanel>
<!-- MEssageBereich mit Url verwaltung -->
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding HyperlinkVisibility}" > <StackPanel DockPanel.Dock="Bottom" Visibility="{Binding HyperlinkVisibility}" >
<TextBlock> <TextBlock>
<Hyperlink NavigateUri="{Binding UserMessage}" RequestNavigate="Hyperlink_OnRequestNavigate" > <Hyperlink NavigateUri="{Binding UserMessage}" RequestNavigate="Hyperlink_OnRequestNavigate" >
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" FontSize="14"/> <TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" FontSize="14"/>
</Hyperlink> </Hyperlink>
</TextBlock> </TextBlock>
<!-- <RichTextBox VerticalAlignment="Center" IsReadOnly="True" BorderBrush="Transparent" Background="Transparent" local:RichTextBoxHelper.DocumentXaml="{Binding UserMessage}" MinWidth="0" MaxWidth="500" />-->
</StackPanel> </StackPanel>
<!-- Bild bereich MaxHeight="200" MaxWidth="300" Stretch uniform-->
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" > <DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" >
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Image MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" x:Name="imgChatMessage" Stretch="None"/> <Image MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" x:Name="imgChatMessage" Stretch="None"/>
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14"/> <TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14"/>
</StackPanel> </StackPanel>
</DockPanel> </DockPanel>
<!-- Image Placeholder -->
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PicturePlaceHolderVisibility}" > <DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PicturePlaceHolderVisibility}" >
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Image Source="pack://application:,,,/ChatController;component/Ressourcen/ClipboardDisabled.png" Stretch="None" /> <Image Source="pack://application:,,,/ChatController;component/Ressourcen/ClipboardDisabled.png" Stretch="None" />
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" /> <TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="14" />
</StackPanel> </StackPanel>
</DockPanel> </DockPanel>
<!-- Gif BEreich ?? <MediaElement Source="" ></MediaElement> villeicht gif erstmal runterladen und dann den pfad ausgeben ? 200
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding GifPictureVisibility}" >
<StackPanel Orientation="Vertical">
<MediaElement LoadedBehavior="Play" UnloadedBehavior="Manual" MediaFailed="MediaElement_OnMediaFailed" MediaEnded="MediaElement_OnMediaEnded" Source="{Binding ImageSources}" Stretch="Uniform" MaxHeight="200" MaxWidth="300" >
<MediaElement.OpacityMask>
<ImageBrush ImageSource="{Binding ImageSources}"/>
</MediaElement.OpacityMask>
</MediaElement>
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</DockPanel>-->
<!--Dokument bereich -->
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" > <DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Image ToolTip="Dokument öffnen" Height="100" Width="150" Source="{Binding Path=Thumbnail}" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" /> <Image ToolTip="Dokument öffnen" Height="100" Width="150" Source="{Binding Path=Thumbnail}" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}" FontSize="14"/> <TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}" FontSize="14"/>
<!-- <Button HorizontalAlignment="Center" VerticalAlignment="Center" Content="Dokument Anzeigen" Height="25" Tag="{Binding Dokpfad}" Click="OpenDokument_OnClick " >
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="1,1,1,1" />
</Style>
</Button.Resources>
</Button>-->
</StackPanel> </StackPanel>
</DockPanel> </DockPanel>
<!--<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
<TextBlock Text="{Binding Username}" FontSize="11" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeLinksColor}" />
</StackPanel>-->
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,0" > <StackPanel DockPanel.Dock="Left" Margin="0,0,0,0" >
<TextBlock Text="{Binding UserTimeStringLeft}" MaxWidth="350" FontSize="11" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" /> <TextBlock Text="{Binding UserTimeStringLeft}" MaxWidth="350" FontSize="11" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" />
</StackPanel> </StackPanel>
<StackPanel DockPanel.Dock="Right" Margin="5,0,0,5" > <StackPanel DockPanel.Dock="Right" Margin="5,0,0,5" >
<TextBlock Text="{Binding UserTimeStringRight}" MaxWidth="350" FontSize="11" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" /> <TextBlock Text="{Binding UserTimeStringRight}" MaxWidth="350" FontSize="11" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" />
</StackPanel> </StackPanel>
</DockPanel> </DockPanel>
</Border> </Border>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<Grid Grid.Row="2" Margin="10" > <Grid Grid.Row="2" Margin="10" >
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
@@ -386,27 +301,22 @@
<TextBox.Resources> <TextBox.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/> <Setter Property="CornerRadius" Value="2"/>
<!-- <Setter Property="Padding" Value="10,0,60,0" />-->
</Style> </Style>
</TextBox.Resources> </TextBox.Resources>
</TextBox> </TextBox>
<!-- StackPanel Zur test zwecken Style="{x:Null}"-->
<StackPanel Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Orientation="Horizontal"> <StackPanel Grid.Column="1" Grid.ColumnSpan="2" Margin="1" Orientation="Horizontal">
<Button Grid.Column="1" Margin="1,0,0,0" x:Name="MediaButton" Background="Transparent" Height="25" Width="28" BorderThickness="0" Padding="0" VerticalAlignment="Bottom" ToolTip="Datei einfügen" Click="MediaButton_OnClick" > <Button Margin="1,0,0,0" x:Name="MediaButton" Background="Transparent" Height="25" Width="28" BorderThickness="0" Padding="0" VerticalAlignment="Bottom" ToolTip="Datei einfügen" Click="MediaButton_OnClick" >
<Image Height="22" Width="22" Source='pack://application:,,,/ChatController;component/Ressourcen/paperclip2.png' RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center"/> <Image Height="22" Width="22" Source='pack://application:,,,/ChatController;component/Ressourcen/paperclip2.png' RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center"/>
</Button> </Button>
<Button Grid.Column="2" Width="28" Height="25" BorderThickness="0" Background="Transparent" x:Name="EmojiButton" Margin="2,0,0,0" Padding="0" VerticalAlignment="Bottom" ToolTip="Emoji einfügen" Click="EmojiButton_OnClick"> <Button Width="28" Height="25" BorderThickness="0" Background="Transparent" x:Name="EmojiButton" Margin="2,0,0,0" Padding="0" VerticalAlignment="Bottom" ToolTip="Emoji einfügen" Click="EmojiButton_OnClick">
<Image Height="24" Width="24" Source='pack://application:,,,/ChatController;component/Ressourcen/glucklicher.png' RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" /> <Image Height="24" Width="24" Source='pack://application:,,,/ChatController;component/Ressourcen/glucklicher.png' RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" />
</Button> </Button>
</StackPanel> </StackPanel>
<!-- Stackpanel zu 12 testZwecken -->
</Grid> </Grid>
<Button x:Name="SendButton" Content=" Senden " HorizontalAlignment="Stretch" Margin="2,0,0,0" Grid.Column="2" VerticalAlignment="Bottom" Click="SendButton_OnClick" Background="{StaticResource ButtonForeground}" Height="25" > <Button x:Name="SendButton" Content=" Senden " HorizontalAlignment="Stretch" Margin="2,0,0,0" Grid.Column="1" VerticalAlignment="Bottom" Click="SendButton_OnClick" Background="{StaticResource ButtonForeground}" Height="25" >
<Button.Resources> <Button.Resources>
<Style TargetType="{x:Type Border}"> <Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="3"/> <Setter Property="CornerRadius" Value="3"/>
@@ -414,7 +324,6 @@
</Style> </Style>
</Button.Resources> </Button.Resources>
</Button> </Button>
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>

File diff suppressed because it is too large Load Diff

View File

@@ -81,7 +81,7 @@ namespace ChatController.Data
{ {
try try
{ {
var serverResponse = Empty; var serverResponse = string.Empty;
using (var dataStream = response.GetResponseStream()) using (var dataStream = response.GetResponseStream())
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -5,8 +5,6 @@ using System.Net;
using System.Text; using System.Text;
using System.Web; using System.Web;
using System.Windows; using System.Windows;
using ChatController.Klassen;
using ChatController.LoginKlassen; using ChatController.LoginKlassen;
using ChatController.Utilities; using ChatController.Utilities;
@@ -34,7 +32,7 @@ namespace ChatController.HauptKlassen
private bool _ownchatVerbindungsaufbauOK; private bool _ownchatVerbindungsaufbauOK;
private bool _gruppeholenverbindungsaufbauOK; private bool _gruppeholenverbindungsaufbauOK;
private AuthentifizierungsDaten _serverconect; private AuthenticationData _serverconect;
private UserDaten _LoggedInUser; private UserDaten _LoggedInUser;
private ChatGruppenDaten _AllGroups; private ChatGruppenDaten _AllGroups;
@@ -46,10 +44,10 @@ namespace ChatController.HauptKlassen
_ChatCode = pChatCode; _ChatCode = pChatCode;
_UserName = pUserName; _UserName = pUserName;
_Password = pPassword; _Password = pPassword;
_ApiKey = "0000";//default damit nichts kaput geht _ApiKey = "0000";//default, damit nichts kaputt geht
} }
public Login(string pTenant, string pChatCode, string pUserName, string pPassword,string pApiKey) public Login(string pTenant, string pChatCode, string pUserName, string pPassword, string pApiKey)
{ {
_Tenant = pTenant; _Tenant = pTenant;
_ChatCode = pChatCode; _ChatCode = pChatCode;
@@ -69,31 +67,33 @@ namespace ChatController.HauptKlassen
public ChatDatenUebergabe AnmeldevorgangDurchFuehren() public ChatDatenUebergabe AnmeldevorgangDurchFuehren()
{ {
if(ServerErmittlung()){ if(ServerErmittlung()){
Dictionary<string, string> dic = new Dictionary<string, string>(); var dic = new Dictionary<string, string>
{
{"username", _UserName},
{ "password", _Password},
{ "chatcode", _ChatCode}
};
dic.Add("username", _UserName); VerbindeMitChatServer(dic);
dic.Add("password", _Password);
dic.Add("chatcode",_ChatCode);
VerbindeMitChatServer(dic);
if (_ownchatVerbindungsaufbauOK) if (_ownchatVerbindungsaufbauOK)
{ {
GetGroups(); GetGroups();
} }
if (_gruppeholenverbindungsaufbauOK) if (_gruppeholenverbindungsaufbauOK)
{ {
long maxUploadSize = GetMaiximumAllowedFileUploadSize(_AuthToken,_Tenant); var maxUploadSize = GetMaiximumAllowedFileUploadSize(_AuthToken,_Tenant);
ChatDatenUebergabe ubergabe = new ChatDatenUebergabe(_serverconect, _LoggedInUser, _AllGroups, ServerUrl, _AuthToken, _UserId, _Tenant,_ApiKey, maxUploadSize); var ubergabe = new ChatDatenUebergabe(_serverconect, _LoggedInUser, _AllGroups, ServerUrl, _AuthToken, _UserId, _Tenant,_ApiKey, maxUploadSize);
return ubergabe; return ubergabe;
} }
} }
return null;
return null;
} }
public bool ServerErmittlung() public bool ServerErmittlung()
@@ -128,7 +128,7 @@ namespace ChatController.HauptKlassen
try try
{ {
var jsonDatentyp = JsonConvert.DeserializeObject<NewAuthentifizierungsDatenTyp1>(responseFromServer); var jsonDatentyp = JsonConvert.DeserializeObject<AuthenticationDataType1>(responseFromServer);
switch(jsonDatentyp.Status) switch(jsonDatentyp.Status)
{ {
@@ -154,7 +154,7 @@ namespace ChatController.HauptKlassen
{ {
try try
{ {
var jsonDatentyp = JsonConvert.DeserializeObject<NewAuthentifizierungsDatenTyp2>(responseFromServer); var jsonDatentyp = JsonConvert.DeserializeObject<AuthenticationDataType2>(responseFromServer);
switch(jsonDatentyp.Status) switch(jsonDatentyp.Status)
{ {

View File

@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ChatController"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
<Grid> <Grid>
@@ -23,8 +22,6 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- <Image Source="Ressourcen/ownchat_logo.png" HorizontalAlignment="Right" VerticalAlignment="Top" Height="200" Width="200" RenderOptions.BitmapScalingMode="HighQuality"/>-->
<Border Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="GroupBoxLogin" > <Border Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="GroupBoxLogin" >
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>

View File

@@ -9,7 +9,6 @@ using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using ChatController.HauptKlassen; using ChatController.HauptKlassen;
using ChatController.Klassen;
using ChatController.LoginKlassen; using ChatController.LoginKlassen;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -448,8 +447,11 @@ namespace ChatController
} }
} }
#endregion #endregion
public void Login()
{
Anmelden();
}
} }
} }

View File

@@ -1,18 +1,18 @@
namespace ChatController.LoginKlassen namespace ChatController.LoginKlassen
{ {
public class AuthentifizierungsDaten public class AuthenticationData
{ {
public string CustomerId { get; set; } public string CustomerId { get; set; }
public string ServerName { get; set; } public string ServerName { get; set; }
} }
public class NewAuthentifizierungsDatenTyp1 public class AuthenticationDataType1
{ {
public int Status { get; set; } public int Status { get; set; }
public string Url { get; set; } public string Url { get; set; }
} }
public class NewAuthentifizierungsDatenTyp2 public class AuthenticationDataType2
{ {
public int Status { get; set; } public int Status { get; set; }
public string Url { get; set; } public string Url { get; set; }

View File

@@ -2,7 +2,7 @@
{ {
public class ChatDatenUebergabe public class ChatDatenUebergabe
{ {
private AuthentifizierungsDaten _serverconect { get; } private AuthenticationData _serverconect { get; }
private UserDaten _angemeldeterUser { get; } private UserDaten _angemeldeterUser { get; }
private ChatGruppenDaten _alleGruppen { get; } private ChatGruppenDaten _alleGruppen { get; }
@@ -13,7 +13,7 @@
private string _ApiKey { get; } private string _ApiKey { get; }
private long _MaxUploadSize { get; } private long _MaxUploadSize { get; }
public ChatDatenUebergabe(AuthentifizierungsDaten serverConect, UserDaten angemeldeterUser, ChatGruppenDaten alleGruppen, string serverUrl, string authToken, long? userid, string kundennummer, string apikey,long maxUploadSize) public ChatDatenUebergabe(AuthenticationData serverConect, UserDaten angemeldeterUser, ChatGruppenDaten alleGruppen, string serverUrl, string authToken, long? userid, string kundennummer, string apikey,long maxUploadSize)
{ {
_serverconect = serverConect; _serverconect = serverConect;
_angemeldeterUser = angemeldeterUser; _angemeldeterUser = angemeldeterUser;
@@ -27,7 +27,7 @@
_MaxUploadSize = maxUploadSize; _MaxUploadSize = maxUploadSize;
} }
public AuthentifizierungsDaten Serverconect => _serverconect; public AuthenticationData Serverconect => _serverconect;
public UserDaten AngemeldeterUser => _angemeldeterUser; public UserDaten AngemeldeterUser => _angemeldeterUser;

View File

@@ -12,7 +12,7 @@ namespace ChatController.LoginKlassen
public class GroupInput public class GroupInput
{ {
public long Oid { get; set; } public int Oid { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Avatar { get; set; } public string Avatar { get; set; }
public string Mobile { get; set; } public string Mobile { get; set; }

View File

@@ -10,7 +10,7 @@
public class UserMessageInput public class UserMessageInput
{ {
public string currentPage { get; set; } public string CurrentPage { get; set; }
public bool HasMorePages { get; set; } public bool HasMorePages { get; set; }
public string NextPage { get; set; } public string NextPage { get; set; }
public int PerPage { get; set; } public int PerPage { get; set; }

View File

@@ -23,10 +23,6 @@ namespace ChatController.Utilities
public static readonly string UrlPageParameter = "&page="; public static readonly string UrlPageParameter = "&page=";
public static readonly string ConfigFile = "ownChat.txt";
public static readonly string CompanyName = "beyondSoft";
public static readonly string ApplicationFolderName = "OwnChat";
public static readonly int NotificationTimeout = 1500; public static readonly int NotificationTimeout = 1500;
} }
} }

View File

@@ -2,20 +2,26 @@
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Windows.Forms; using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using MessageBox = System.Windows.MessageBox;
using PixelFormat = System.Drawing.Imaging.PixelFormat;
namespace ChatController.Utilities namespace ChatController.Utilities
{ {
public class Utils public class Utils
{ {
public static NotifyIcon NotifyIcon = new NotifyIcon {Icon = Resource.ownchat_favicon, Visible = true}; public static DateTime DefaultDate = new DateTime(1,1,1);
public static ImageSource AvatarToImageSourceConverter(string pAvatarPath, bool pIsEmployee) public static ImageSource AvatarToImageSourceConverter(string pAvatarPath, bool pIsEmployee, bool pIsGroup)
{ {
return CreateImageSourceFromPath(pAvatarPath, false, pIsEmployee); return CreateImageSourceFromPath(pAvatarPath, pIsGroup, pIsEmployee);
} }
public static ImageSource CreateChatGroupPictureImageSource(string pPicturePath, bool pIsGroup, bool pIsEmployee) public static ImageSource CreateChatGroupPictureImageSource(string pPicturePath, bool pIsGroup, bool pIsEmployee)
@@ -145,5 +151,172 @@ namespace ChatController.Utilities
return responseFromServer; return responseFromServer;
} }
public static string GetAndCreateUserAppDataPath()
{
try
{
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var companyFilePath = Path.Combine(localAppData, Resource.CompanyName);
if (!Directory.Exists(companyFilePath))
{
Directory.CreateDirectory(companyFilePath);
}
var bewoFilePath = Path.Combine(companyFilePath, Resource.ApplicationFolderName);
if (!Directory.Exists(bewoFilePath))
{
Directory.CreateDirectory(bewoFilePath);
}
return bewoFilePath;
}
catch (Exception exception)
{
MessageBox.Show("Fehler beim Anlegen des Anwendungsordners. Sie besitzen nicht die erforderlichen Rechte, bitte wenden Sie sich an Ihren Systemadministrator.\n" + exception.Message, "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
public static string GenerateTempName()
{
const int length = 6;
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var random = new Random();
var tempName = new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
return tempName;
}
public static byte[] ImageToByteArray(Image pImage)
{
try
{
using (var memoryStream = new MemoryStream())
{
pImage.Save(memoryStream, ImageFormat.Bmp);
return memoryStream.ToArray();
}
}
catch (Exception e)
{
MessageBox.Show("Fehler: " + e.Message, "Fehler", MessageBoxButton.OK);
return null;
}
}
public static ImageSource GetImageSourceFromIcon(Icon pIcon)
{
var bitmap = new Bitmap(pIcon.Width, pIcon.Height);
var graphics = Graphics.FromImage(bitmap);
graphics.DrawIcon(pIcon, 0, 0);
graphics.Dispose();
bitmap.Save("icon.ico", ImageFormat.Icon);
var imageSource = ImageSourceForBitmap(bitmap);
bitmap.Dispose();
return imageSource;
}
[DllImport("gdi32.dll", EntryPoint = "DeleteObject")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool DeleteObject([In] IntPtr hObject);
public static ImageSource ImageSourceForBitmap(Bitmap bmp)
{
var handle = bmp.GetHbitmap();
try
{
return Imaging.CreateBitmapSourceFromHBitmap(handle, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
}
finally
{
DeleteObject(handle);
}
}
public static Icon ImageSourceToIcon(ImageSource pImageSource)
{
var bitmapSource = (BitmapSource) pImageSource;
var width = bitmapSource.PixelWidth;
var height = bitmapSource.PixelHeight;
var newWidth = width;
var newHeight = height;
var x = 0;
var y = 0;
if(width < height)
{
newHeight = width;
y = (height - width) / 2;
}
else
{
newWidth = height;
x = (width - height) / 2;
}
var stride = width * ((bitmapSource.Format.BitsPerPixel + 7) / 8);
var memoryBlockPointer = Marshal.AllocHGlobal(height * stride);
bitmapSource.CopyPixels(new Int32Rect(x, y, newWidth, newHeight), memoryBlockPointer, newHeight * stride, stride);
var bitmap = new Bitmap(newWidth, newHeight, stride, PixelFormat.Format32bppPArgb, memoryBlockPointer);
return Icon.FromHandle(bitmap.GetHicon());
}
public static DateTime FromUnixTimeStamp(long pUnixTimeStamp)
{
return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(pUnixTimeStamp);
}
public static byte[] ReadFully(Stream pStream)
{
using (var memStream = new MemoryStream())
{
pStream.CopyTo(memStream);
return memStream.ToArray();
}
}
public static RotateFlipType OrientationToFlipType(string orientation)
{
switch (int.Parse(orientation))
{
case 1:
return RotateFlipType.RotateNoneFlipNone;
case 2:
return RotateFlipType.RotateNoneFlipX;
case 3:
return RotateFlipType.Rotate180FlipNone;
case 4:
return RotateFlipType.Rotate180FlipX;
case 5:
return RotateFlipType.Rotate90FlipX;
case 6:
return RotateFlipType.Rotate90FlipNone;
case 7:
return RotateFlipType.Rotate270FlipX;
case 8:
return RotateFlipType.Rotate270FlipNone;
default:
return RotateFlipType.RotateNoneFlipNone;
}
}
} }
} }

View File

@@ -6,8 +6,8 @@
Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png" Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png"
xmlns:cc="clr-namespace:ChatController;assembly=ChatController" xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
mc:Ignorable="d" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" mc:Ignorable="d" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
Title="ownChat Desktop" Height="500" Width="700" > Title="ownChat Desktop" Height="500" Width="700" KeyDown="LoginMaske_OnKeyDown">
<Grid> <Grid>
<cc:LoginControl OnLogin="LoginControl_OnOnLogin"></cc:LoginControl> <cc:LoginControl x:Name="LoginControl" OnLogin="LoginControl_OnOnLogin"></cc:LoginControl>
</Grid> </Grid>
</Window> </Window>

View File

@@ -1,4 +1,6 @@
using ChatController.LoginKlassen; using System.Windows.Input;
using ChatController;
using ChatController.LoginKlassen;
namespace ownChat namespace ownChat
{ {
@@ -17,5 +19,10 @@ namespace ownChat
mainWindow.Show(); mainWindow.Show();
Close(); Close();
} }
private void LoginMaske_OnKeyDown(object sender, KeyEventArgs e)
{
LoginControl.Login();
}
} }
} }

View File

@@ -7,6 +7,6 @@
mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png" mc:Ignorable="d" WindowStartupLocation="CenterScreen" Icon="pack://application:,,,/ChatController;component/Ressourcen/ownchat_icon.png"
Title="ownChat Desktop" Height="700" Width="900" x:Name="MainView" Closed="MainWindow_OnClosed"> Title="ownChat Desktop" Height="700" Width="900" x:Name="MainView" Closed="MainWindow_OnClosed">
<Grid> <Grid>
<cc:ChatMainControl x:Name="ChatMainControl" OnClose="ChatMainControl_OnOnClose" OnEmojii="ChatMainControl_OnOnEmojii" ></cc:ChatMainControl> <cc:ChatMainControl x:Name="ChatMainControl" OnEmojii="ChatMainControl_OnOnEmojii"></cc:ChatMainControl>
</Grid> </Grid>
</Window> </Window>

View File

@@ -15,7 +15,9 @@ namespace ownChat
public MainWindow(ChatDatenUebergabe x) public MainWindow(ChatDatenUebergabe x)
{ {
InitializeComponent(); InitializeComponent();
ChatMainControl.ContainingWindow = this;
ChatMainControl.InitMitChatdaten(x); ChatMainControl.InitMitChatdaten(x);
ChatMainControl.ResetStyle(); ChatMainControl.ResetStyle();
@@ -38,13 +40,8 @@ namespace ownChat
private void MainWindow_OnClosed(object sender, EventArgs e) private void MainWindow_OnClosed(object sender, EventArgs e)
{ {
ChatMainControl.SpeichereMessageInfoInDatei(); ChatMainControl.WriteToNewSyncFile();
Environment.Exit(0); ChatMainControl.ClearNotifications();
}
private void ChatMainControl_OnOnClose()
{
ChatMainControl.SpeichereMessageInfoInDatei();
Environment.Exit(0); Environment.Exit(0);
} }
} }

View File

@@ -126,6 +126,7 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>