Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/Chat
This commit is contained in:
@@ -34,6 +34,9 @@
|
||||
<ApplicationIcon>ownchat_favicon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Mvvm.v17.1, Version=17.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\libs\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -121,6 +124,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ownchat_favicon.ico" />
|
||||
<Resource Include="Ressourcen\client_default.png" />
|
||||
<Resource Include="Ressourcen\employee_default.png" />
|
||||
<Resource Include="Ressourcen\team_default.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -21,18 +21,9 @@ namespace ChatController.ChatKlassen
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
ConvertetSendtimeString = convertedSendTimeString;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
|
||||
Posi = "Left";
|
||||
}
|
||||
Farbgebung(isme);
|
||||
|
||||
if (IsHyperlink(message))
|
||||
{
|
||||
@@ -50,29 +41,25 @@ namespace ChatController.ChatKlassen
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
_gifPictureVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// IMage Ansicht
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, ImageSource image, DateTime convertedSendTimeString,string originalImage)
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, ImageSource image, DateTime convertedSendTimeString,string originalImage, string imageName)
|
||||
{
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
ImageSources = image;
|
||||
ConvertetSendtimeString = convertedSendTimeString;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
OriginalImage = originalImage;
|
||||
// Dokpfad =
|
||||
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
|
||||
Posi = "Left";
|
||||
}
|
||||
OriginalImageName = imageName;
|
||||
// Dokpfad =
|
||||
Farbgebung(isme);
|
||||
|
||||
//if (!isGif)
|
||||
//{
|
||||
@@ -91,6 +78,33 @@ namespace ChatController.ChatKlassen
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
|
||||
//Konstruktor PlaceHolder
|
||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, DateTime convertedSendTimeString, string originalImage, string imageName)
|
||||
{
|
||||
|
||||
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
OriginalImage = originalImage;
|
||||
OriginalImageName = imageName;
|
||||
|
||||
Farbgebung(isme);
|
||||
|
||||
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
DokumentVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
|
||||
_picturePlaceHolderVisibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
//Dokument Ansicht
|
||||
@@ -99,31 +113,43 @@ namespace ChatController.ChatKlassen
|
||||
Username = username;
|
||||
UserMessage = message;
|
||||
SendTime = sendtime;
|
||||
ConvertetSendtimeString = convertedSendTimeString;
|
||||
InternalSendTime = convertedSendTimeString;
|
||||
|
||||
Dokpfad = (object) url;
|
||||
Dokpfad = (object) url;
|
||||
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
|
||||
Posi = "Left";
|
||||
}
|
||||
Farbgebung(isme);
|
||||
|
||||
|
||||
DokumentVisibility = Visibility.Visible;
|
||||
|
||||
DokumentVisibility = Visibility.Visible;
|
||||
|
||||
_pictureVisibility = Visibility.Collapsed;
|
||||
ChatVisibility = Visibility.Collapsed;
|
||||
SoundVisibility = Visibility.Collapsed;
|
||||
_herunterladen = Visibility.Collapsed;
|
||||
HyperlinkVisibility = Visibility.Collapsed;
|
||||
_picturePlaceHolderVisibility = Visibility.Collapsed;
|
||||
|
||||
}
|
||||
|
||||
private void Farbgebung(bool isme)
|
||||
{
|
||||
if (isme)
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||
Posi = "Right";
|
||||
_farbeRechtsColor = new BrushConverter().ConvertFromString("#636363") as SolidColorBrush;
|
||||
_farbeLinksColor = new BrushConverter().ConvertFromString("#636363") as SolidColorBrush;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatColor = new BrushConverter().ConvertFromString("#FFFFFF") as SolidColorBrush; //"#cccccc"
|
||||
Posi = "Left";
|
||||
_farbeRechtsColor = new BrushConverter().ConvertFromString("#A0A0A0") as SolidColorBrush;
|
||||
_farbeLinksColor = new BrushConverter().ConvertFromString("#A0A0A0") as SolidColorBrush;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#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})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?");
|
||||
@@ -347,8 +373,9 @@ namespace ChatController.ChatKlassen
|
||||
public Brush ChatColor { get; private set; }
|
||||
public int ChatPosition { get; private set; }
|
||||
public string Posi { get; private set; }
|
||||
public string OriginalImageName { get; private set; }
|
||||
|
||||
public DateTime ConvertetSendtimeString { get; set; }
|
||||
public DateTime InternalSendTime { get; set; }
|
||||
|
||||
public Visibility MainVisibility { get; set; }
|
||||
public Visibility ChatVisibility { get; set; }
|
||||
@@ -362,6 +389,9 @@ namespace ChatController.ChatKlassen
|
||||
private Visibility _pictureVisibility;
|
||||
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
|
||||
|
||||
private Visibility _picturePlaceHolderVisibility;
|
||||
public Visibility PicturePlaceHolderVisibility { get { return _picturePlaceHolderVisibility; } set { _picturePlaceHolderVisibility = value; OnPropertyChanged("PicturePlaceHolderVisibility"); } }
|
||||
|
||||
private Visibility _gifPictureVisibility;
|
||||
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
|
||||
|
||||
@@ -382,6 +412,44 @@ namespace ChatController.ChatKlassen
|
||||
|
||||
public object[] Herunterladbares { get; private set; }
|
||||
|
||||
|
||||
//Farbe Links MEssageHeader
|
||||
private Brush _farbeLinksColor;
|
||||
public Brush FarbeLinksColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeLinksColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_farbeLinksColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeLinksColor");
|
||||
}
|
||||
}
|
||||
|
||||
//Farbe Rechts MessageHeader
|
||||
private Brush _farbeRechtsColor;
|
||||
public Brush FarbeRechtsColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _farbeRechtsColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_farbeRechtsColor = value;
|
||||
|
||||
OnPropertyChanged("FarbeRechtsColor");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
|
||||
@@ -80,13 +80,29 @@ namespace ChatController.ChatKlassen
|
||||
}
|
||||
}
|
||||
|
||||
private Brush _kontaktChatColor;
|
||||
public Brush KontaktChatColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _kontaktChatColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
_kontaktChatColor = value;
|
||||
|
||||
OnPropertyChanged("KontaktChatColor");
|
||||
}
|
||||
}
|
||||
|
||||
public ImageSource Image { get; private set; }
|
||||
public DateTime TimeStamp { get; set; }
|
||||
public long GroupId { get; set; }
|
||||
public long UserId { get; set; }
|
||||
public long? CustomerPersonOid { get; set; }
|
||||
|
||||
public KontaktlistBuilder(string name, ImageSource image, string lastMs, DateTime timestamp, long groupid,long? customerPersonOid)
|
||||
public KontaktlistBuilder(string name, ImageSource image, string lastMs, DateTime timestamp, long groupid,long? customerPersonOid,bool onlyEmployee, int userCount)
|
||||
{
|
||||
Name = name;
|
||||
ReceiveMs = lastMs;
|
||||
@@ -96,6 +112,24 @@ namespace ChatController.ChatKlassen
|
||||
CustomerPersonOid = customerPersonOid;
|
||||
SetzeGelesen = 1;
|
||||
|
||||
if (CustomerPersonOid != null)
|
||||
{
|
||||
_kontaktChatColor = new BrushConverter().ConvertFromString("#3B7799") as SolidColorBrush;
|
||||
}else if (onlyEmployee && userCount > 2)
|
||||
{
|
||||
|
||||
//Alle gruppen werden grün
|
||||
_kontaktChatColor = new BrushConverter().ConvertFromString("#45993B") as SolidColorBrush;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Alles bleibt wie es war also schwarz
|
||||
_kontaktChatColor = new BrushConverter().ConvertFromString("#000000") as SolidColorBrush;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//public KontaktlistBuilder(string name, StatusType statustyp, ImageSource image, long empfaengerid, ChatType typeChat, CompactCustomerDC customer)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
d:DesignHeight="300" d:DesignWidth="300" >
|
||||
<Grid>
|
||||
|
||||
<GroupBox Header="Chat" x:Name="rootGroupBox">
|
||||
<GroupBox Header="Chat" x:Name="rootGroupBox" Background="#F3F3F3">
|
||||
<!--Style="{DynamicResource MainContentGroupBoxWithoutMaximizeBtnStyle}"-->
|
||||
<Grid >
|
||||
<!--Background="{StaticResource ObjectEditBackgroundBrush}"-->
|
||||
@@ -125,7 +125,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Margin="1" >
|
||||
<StackPanel Orientation="Horizontal" TextBlock.FontSize="14" >
|
||||
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" />
|
||||
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" Foreground="{Binding Path=KontaktChatColor}" />
|
||||
</StackPanel>
|
||||
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
|
||||
</StackPanel>
|
||||
@@ -198,7 +198,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<ListBox x:Name="AktChatUser" HorizontalAlignment="Left" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
|
||||
<ListBox x:Name="AktChatUser" HorizontalAlignment="Left" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
|
||||
<ListBox.Resources>
|
||||
<DataTemplate x:Key="DataTemplate2">
|
||||
<Grid>
|
||||
@@ -227,8 +227,10 @@
|
||||
</ListBox.Resources>
|
||||
</ListBox>
|
||||
|
||||
|
||||
<!--##### Chat Bereich ####-->
|
||||
<ListBox x:Name="Chat" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Margin="3" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged" Background="#F3F3F3"
|
||||
ContextMenuOpening="Chat_OnContextMenuOpening">
|
||||
<!--MouseRightButtonDown="OnRightClickEvent"-->
|
||||
<ListBox.ItemContainerStyle>
|
||||
@@ -266,15 +268,26 @@
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- Bild bereich-->
|
||||
<!-- Bild bereich MaxHeight="200" MaxWidth="300" Stretch uniform-->
|
||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Stretch="Uniform" MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<Image MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
|
||||
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
|
||||
<!-- Image Placeholder -->
|
||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PicturePlaceHolderVisibility}" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Image Source="pack://application:,,,/ChatController;component/Ressourcen/ClipboardDisabled.png" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
|
||||
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
</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">
|
||||
@@ -309,11 +322,11 @@
|
||||
|
||||
|
||||
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
|
||||
<TextBlock Text="{Binding Username}" FontWeight="Bold" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Username}" FontSize="8" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="{Binding FarbeLinksColor}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel DockPanel.Dock="Right" Margin="5,0,0,5" >
|
||||
<TextBlock Text="{Binding SendTime}" MaxWidth="350" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding SendTime}" MaxWidth="350" FontSize="8" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center" Foreground="{Binding FarbeRechtsColor}" />
|
||||
</StackPanel>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
@@ -140,55 +140,7 @@ namespace ChatController
|
||||
_isDesktopVersion = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Synconisation Veranlassen für Bewoplaner
|
||||
public void SynchronisationVeranlassen()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool doSync = true;
|
||||
|
||||
do
|
||||
{
|
||||
doSync = _chat.DoSynchronisation(_chatDaten.ApiKey, _chatDaten.Kundennummer);
|
||||
|
||||
if (doSync)
|
||||
{
|
||||
SpeichereMessageInfoInDatei();
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
|
||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
|
||||
_kontaktlist = x;
|
||||
|
||||
LeseMessageInfoAusDatei();
|
||||
|
||||
Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Normal,
|
||||
(Action) delegate
|
||||
{
|
||||
//CollectionViewSource.GetDefaultView(Clientlist.Items).Refresh();
|
||||
Clientlist.Items.Refresh();
|
||||
});
|
||||
|
||||
Thread.Sleep(TimeSpan.FromMinutes(5));
|
||||
}
|
||||
|
||||
} while (doSync);
|
||||
|
||||
//sobald nicht mehr in der Schleife dann Close weil dann Sync false
|
||||
if (OnClose != null)
|
||||
{
|
||||
OnClose();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Ein Fehler bei der Synchronisation ist aufgetreten.\nFehler:\n" + e.Message, "Fehler",MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Lade KontaktDaten und Lade sie in den Chat
|
||||
private void AktChatUser_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -423,14 +375,28 @@ namespace ChatController
|
||||
var medium = _chat.HoleMedium();
|
||||
|
||||
if(medium != null) {
|
||||
_chat.AddeMediumDerNachrichtView(medium);
|
||||
|
||||
CollectionViewSource.GetDefaultView(Chat.ItemsSource).Refresh();
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
|
||||
_chat.SendeMediumAnKontakt(kontakt,medium);
|
||||
|
||||
string convertetMedia = _chat.ScaleImage(medium, Path.GetExtension(medium.ToUpperInvariant()));
|
||||
|
||||
if (!convertetMedia.Equals(""))
|
||||
{
|
||||
_chat.AddeMediumDerNachrichtView(convertetMedia);
|
||||
|
||||
CollectionViewSource.GetDefaultView(Chat.ItemsSource).Refresh();
|
||||
Chat.Items.MoveCurrentToLast();
|
||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||
|
||||
_chat.SendeMediumAnKontakt(kontakt, convertetMedia);
|
||||
|
||||
if (!convertetMedia.Equals("") && File.Exists(convertetMedia))
|
||||
{
|
||||
File.Delete(convertetMedia);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Die gewählte Datei ist zu groß!", "Fehler", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -768,6 +734,18 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//abchecken ob neue Groupid in liste vorhanden , wenn nicht dann adde neuen kontakt der liste hinzu
|
||||
if (!_kontaktlist.Contains(neu))
|
||||
{
|
||||
_kontaktlist.ToList().Add(neu);
|
||||
}
|
||||
}
|
||||
|
||||
//umgekert ist eine kontakt aus der liste nicht mehr in neu muss diese raus
|
||||
if (!alist.Contains(liste))
|
||||
{
|
||||
_kontaktlist.ToList().Remove(liste);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,6 +946,36 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Neue Für Bewoplaner | Nicht integriert | Wird nicht mehr gebraucht ?? wegnehmen
|
||||
private void DoSynchroForBewoplaner()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true) {
|
||||
// UebergebeMessageInfoDatenFuerDb();
|
||||
|
||||
var aktuelleGruppen = _chat.GruppenAktuallisieren();
|
||||
|
||||
var x = _chat.GroupklassenAktuallisieren(aktuelleGruppen);
|
||||
|
||||
_kontaktlist = x;
|
||||
|
||||
//ErhalteMessageInfoVonDb();
|
||||
|
||||
Clientlist.Items.Refresh();
|
||||
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Es is ein Fehler bei der Kontakt Aktualisierung aufgetreten.\nFehler:\n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region speichern sowie lesen der MessageSyncDatei / stylezwecke (OwnChat only)
|
||||
@@ -1009,7 +1017,7 @@ namespace ChatController
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Speichern Und LEsen Der MesageSyncDatei (Bewoplaner only)
|
||||
|
||||
public List<KontaktlistBuilder> UebergebeMessageInfoDatenFuerDb()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
private string _newUrl = "https://dict.ownchat.de/api/server/resolve/1/"; //https://dict.ownchat.de/api/server/resolve/{type}/{customerid} //type = Diensttyp(1,2,oder 3), customerid = Kudennummer des Kunden
|
||||
|
||||
private string _serverUrl = "";
|
||||
public string _serverUrl = "";
|
||||
private string _authToken = "";
|
||||
|
||||
private readonly string _benutzername;
|
||||
@@ -54,6 +54,12 @@ namespace ChatController.HauptKlassen
|
||||
_apikey = apikey;
|
||||
}
|
||||
|
||||
//
|
||||
public Login()
|
||||
{
|
||||
ServerErmittlung();
|
||||
}
|
||||
|
||||
public ChatDatenUebergabe AnmeldevorgangDurchFuehren()
|
||||
{
|
||||
if(ServerErmittlung()){
|
||||
@@ -72,8 +78,11 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
|
||||
if (_gruppeholenverbindungsaufbauOK)
|
||||
{
|
||||
ChatDatenUebergabe ubergabe = new ChatDatenUebergabe(_serverconect, _userconect, _groupconect, _serverUrl, _authToken, _userid, _kundennummer,_apikey);
|
||||
{
|
||||
|
||||
long maxUploadSize = GetMaiximumAllowedFileUploadSize(_authToken,_kundennummer);
|
||||
|
||||
ChatDatenUebergabe ubergabe = new ChatDatenUebergabe(_serverconect, _userconect, _groupconect, _serverUrl, _authToken, _userid, _kundennummer,_apikey, maxUploadSize);
|
||||
|
||||
return ubergabe;
|
||||
}
|
||||
@@ -83,47 +92,55 @@ namespace ChatController.HauptKlassen
|
||||
|
||||
public bool ServerErmittlung()
|
||||
{
|
||||
try
|
||||
if (_serverUrl.Equals(""))
|
||||
{
|
||||
string serverURl = _newUrl + _kundennummer;
|
||||
|
||||
WebRequest request = WebRequest.Create(serverURl);
|
||||
|
||||
request.Credentials = CredentialCache.DefaultCredentials;
|
||||
|
||||
WebResponse response;
|
||||
|
||||
try
|
||||
{
|
||||
response = request.GetResponse();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Fehler: Es konnte keine Verbindung aufgebaut werden.", "Fehler", MessageBoxButton.OK,MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Display the status.
|
||||
var statusResponse = ((HttpWebResponse)response).StatusDescription;
|
||||
|
||||
string responseFromServer = ReadStream(response);
|
||||
string serverURl = _newUrl + _kundennummer;
|
||||
|
||||
try
|
||||
WebRequest request = WebRequest.Create(serverURl);
|
||||
|
||||
request.Credentials = CredentialCache.DefaultCredentials;
|
||||
|
||||
WebResponse response;
|
||||
|
||||
try
|
||||
{
|
||||
var jsonDatentyp = JsonConvert.DeserializeObject<NewAuthentifizierungsDatenTyp1>(responseFromServer);
|
||||
response = request.GetResponse();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Fehler: Es konnte keine Verbindung aufgebaut werden.", "ownChat Fehler",
|
||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Display the status.
|
||||
var statusResponse = ((HttpWebResponse) response).StatusDescription;
|
||||
|
||||
string responseFromServer = ReadStream(response);
|
||||
|
||||
try
|
||||
{
|
||||
var jsonDatentyp =
|
||||
JsonConvert.DeserializeObject<NewAuthentifizierungsDatenTyp1>(responseFromServer);
|
||||
|
||||
if (jsonDatentyp.Status == 1)
|
||||
{
|
||||
MessageBox.Show("Fehler: Kundennummer unbekannt.\nBitte überprüfen Sie die Anmeldeinformationen.","Info",MessageBoxButton.OK,MessageBoxImage.Asterisk);
|
||||
MessageBox.Show(
|
||||
"Fehler: Kundennummer unbekannt.\nBitte überprüfen Sie die Anmeldeinformationen.",
|
||||
"ownChat Info", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
return false;
|
||||
}
|
||||
else if (jsonDatentyp.Status == 2)
|
||||
{
|
||||
MessageBox.Show("Der Diensttyp ist für die angegebene Kundennummer nicht definiert.","Info",MessageBoxButton.OK,MessageBoxImage.Asterisk);
|
||||
MessageBox.Show("Der Diensttyp ist für die angegebene Kundennummer nicht definiert.", "ownChat Info",
|
||||
MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
_url = jsonDatentyp.URL;
|
||||
}
|
||||
}
|
||||
@@ -131,39 +148,48 @@ namespace ChatController.HauptKlassen
|
||||
{
|
||||
try
|
||||
{
|
||||
var jsonDatentyp = JsonConvert.DeserializeObject<NewAuthentifizierungsDatenTyp2>(responseFromServer);
|
||||
var jsonDatentyp =
|
||||
JsonConvert.DeserializeObject<NewAuthentifizierungsDatenTyp2>(responseFromServer);
|
||||
|
||||
if (jsonDatentyp.Status == 1)
|
||||
{
|
||||
MessageBox.Show("Fehler: Kundennummer unbekannt.\nBitte überprüfen Sie die Anmeldeinformationen.","Info",MessageBoxButton.OK,MessageBoxImage.Asterisk);
|
||||
MessageBox.Show(
|
||||
"Fehler: Kundennummer unbekannt.\nBitte überprüfen Sie die Anmeldeinformationen.",
|
||||
"ownChat Info", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
return false;
|
||||
}
|
||||
else if (jsonDatentyp.Status == 2)
|
||||
{
|
||||
MessageBox.Show("Der Diensttyp ist für die angegebene Kundennummer nicht definiert.","Info",MessageBoxButton.OK,MessageBoxImage.Asterisk);
|
||||
MessageBox.Show("Der Diensttyp ist für die angegebene Kundennummer nicht definiert.",
|
||||
"ownChat Info", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
_url = jsonDatentyp.URL;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Fehler: "+e.Message,"Fehler",MessageBoxButton.OK,MessageBoxImage.Error);
|
||||
|
||||
MessageBox.Show("Fehler: " + e.Message, "ownChat Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
response.Close();
|
||||
|
||||
_serverUrl = _url;
|
||||
return true;
|
||||
response.Close();
|
||||
|
||||
_serverUrl = _url;
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Fehler: " + e.Message, "ownChat Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Fehler: "+ e.Message,"Fehler",MessageBoxButton.OK,MessageBoxImage.Error);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,8 +268,7 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//throw fehler
|
||||
MessageBox.Show(e.Message, "Fehler", MessageBoxButton.OK,MessageBoxImage.Error);
|
||||
MessageBox.Show("Fehler:"+e.Message, "Fehler", MessageBoxButton.OK,MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,5 +335,42 @@ namespace ChatController.HauptKlassen
|
||||
}
|
||||
}
|
||||
|
||||
#region Maximal erlaubte File Größe
|
||||
|
||||
public long GetMaiximumAllowedFileUploadSize(string token, string customerid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var endurl = _serverUrl + "/api/ownchat/uploadmaxsize";// + apikey + "/" + customerid;
|
||||
|
||||
WebRequest request = WebRequest.Create(endurl);
|
||||
request.Headers["Token"] = token;
|
||||
request.Headers["CustomerID"] = customerid;
|
||||
|
||||
request.Credentials = CredentialCache.DefaultCredentials;
|
||||
request.Proxy = null;
|
||||
|
||||
WebResponse response = request.GetResponse();
|
||||
|
||||
// Display the status.
|
||||
var statusResponse = ((HttpWebResponse)response).StatusDescription;
|
||||
|
||||
string responseFromServer = ReadStream(response);
|
||||
|
||||
var definiti = new { file_upload_max_size = "" };
|
||||
|
||||
var jsonDatentyp = JsonConvert.DeserializeAnonymousType(responseFromServer, definiti);
|
||||
|
||||
|
||||
return Convert.ToInt64(jsonDatentyp.file_upload_max_size);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@ namespace ChatController.Klassen
|
||||
private long? _userid { get; set; }
|
||||
private string _kundennummer { get; set; }
|
||||
private string _apikey { get; set; }
|
||||
private long _maxUploadSize { get; set; }
|
||||
|
||||
public ChatDatenUebergabe(AuthentifizierungsDaten serverConect, UserDaten userConect, ChatGruppenDaten groupConect, string serverUrl, string authToken, long? userid, string kundennummer, string apikey)
|
||||
public ChatDatenUebergabe(AuthentifizierungsDaten serverConect, UserDaten userConect, ChatGruppenDaten groupConect, string serverUrl, string authToken, long? userid, string kundennummer, string apikey,long maxUploadSize)
|
||||
{
|
||||
_serverconect = serverConect;
|
||||
_userconect = userConect;
|
||||
@@ -29,6 +30,7 @@ namespace ChatController.Klassen
|
||||
_userid = userid;
|
||||
_kundennummer = kundennummer;
|
||||
_apikey = apikey;
|
||||
_maxUploadSize = maxUploadSize;
|
||||
}
|
||||
|
||||
public AuthentifizierungsDaten Serverconect
|
||||
@@ -126,5 +128,17 @@ namespace ChatController.Klassen
|
||||
_apikey = value;
|
||||
}
|
||||
}
|
||||
|
||||
public long MaxUploadSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _maxUploadSize;
|
||||
}
|
||||
private set
|
||||
{
|
||||
_maxUploadSize = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace ChatController.Klassen
|
||||
public string Mobile { get; set; }
|
||||
public GroupLastMessage LastMessage { get; set; }
|
||||
public GroupUsers[] Users { get; set; }
|
||||
public bool Onlyemployees { get; set; }
|
||||
}
|
||||
|
||||
public class GroupLastMessage
|
||||
@@ -47,7 +48,7 @@ namespace ChatController.Klassen
|
||||
public string Lastname { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string Picture { get; set; }
|
||||
public bool IsEmployee { get; set; }
|
||||
public bool Is_Employee { get; set; }
|
||||
}
|
||||
|
||||
public class LastMessageTimeStamp
|
||||
|
||||
BIN
ChatController/Ressourcen/client_default.png
Normal file
BIN
ChatController/Ressourcen/client_default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
ChatController/Ressourcen/employee_default.png
Normal file
BIN
ChatController/Ressourcen/employee_default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 159 KiB |
BIN
ChatController/Ressourcen/team_default.png
Normal file
BIN
ChatController/Ressourcen/team_default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
Reference in New Issue
Block a user