neue klassen

This commit is contained in:
Waldi
2017-09-12 14:32:34 +02:00
commit 09f67a41df
43 changed files with 5332 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChatController</RootNamespace>
<AssemblyName>ChatController</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\Desktop\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NHibernate">
<HintPath>..\..\BeWo\Lib\NHibernate.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ChatEmojiiControl.xaml.cs">
<DependentUpon>ChatEmojiiControl.xaml</DependentUpon>
</Compile>
<Compile Include="ChatKlassen\AktuellerKontakt.cs" />
<Compile Include="ChatKlassen\KontaktlistBuilder.cs" />
<Compile Include="ChatKlassen\KontaktMessageBuilder.cs" />
<Compile Include="ChatKlassen\MessageCounter.cs" />
<Compile Include="ChatMainControl.xaml.cs">
<DependentUpon>ChatMainControl.xaml</DependentUpon>
</Compile>
<Compile Include="HauptKlassen\Chat.cs" />
<Compile Include="HauptKlassen\ChatEmoji.cs" />
<Compile Include="LoginControl.xaml.cs">
<DependentUpon>LoginControl.xaml</DependentUpon>
</Compile>
<Compile Include="LoginKlassen\AuthentifizierungsDaten.cs" />
<Compile Include="LoginKlassen\ChatDatenUebergabe.cs" />
<Compile Include="LoginKlassen\ChatGruppenDaten.cs" />
<Compile Include="HauptKlassen\Login.cs" />
<Compile Include="LoginKlassen\UserDaten.cs" />
<Compile Include="LoginKlassen\UserMessages.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="ChatEmojiiControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ChatMainControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LoginControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,126 @@
<UserControl x:Class="ChatController.ChatEmojiiControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ChatController"
xmlns:hauptKlassen="clr-namespace:ChatController.HauptKlassen"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="300">
<Grid>
<TabControl>
<TabItem Header="1" x:Name="TabItem1" >
<ListBox x:Name="EmojisListBox1" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}" >
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" MinWidth="22" FontSize="18" Foreground="OrangeRed" Margin="1" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
<TabItem Header="2" x:Name="TabItem2">
<ListBox x:Name="EmojisListBox2" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" Width="22" FontSize="18" Foreground="OrangeRed"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
<TabItem Header="3" x:Name="TabItem3">
<ListBox x:Name="EmojisListBox3" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" Width="22" FontSize="18" Foreground="OrangeRed"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
<TabItem Header="4" x:Name="TabItem4">
<ListBox x:Name="EmojisListBox4" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" Width="22" FontSize="18" Foreground="OrangeRed"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
<TabItem Header="5" x:Name="TabItem5">
<ListBox x:Name="EmojisListBox5" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" Width="22" FontSize="18" Foreground="OrangeRed"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
<TabItem Header="6" x:Name="TabItem6">
<ListBox x:Name="EmojisListBox6" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" Width="22" FontSize="18" Foreground="OrangeRed"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
<TabItem Header="7" x:Name="TabItem7">
<ListBox x:Name="EmojisListBox7" HorizontalAlignment="Left" Height="114" VerticalAlignment="Top" Width="285" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="OnEmojiClick" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type hauptKlassen:DirectoryListing}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding EmojiCode}" Height="22" Width="22" FontSize="18" Foreground="OrangeRed"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</TabItem>
</TabControl>
</Grid>
</UserControl>

View File

@@ -0,0 +1,170 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using ChatController.HauptKlassen;
namespace ChatController
{
/// <summary>
/// Interaktionslogik für ChatEmojiiControl.xaml
/// </summary>
public partial class ChatEmojiiControl : UserControl
{
ChatMainControl chatView;
private ChatEmoji _emojii;
public ChatEmojiiControl()
{
InitializeComponent();
_emojii = new ChatEmoji();
SetEmojis();
}
public void InitChatView(ChatMainControl c)
{
chatView = c;
}
public void SetEmojis()
{
EmojisListBox1.ItemsSource = _emojii.EmojisListBox1;
EmojisListBox2.ItemsSource = _emojii.EmojisListBox2;
EmojisListBox3.ItemsSource = _emojii.EmojisListBox3;
EmojisListBox4.ItemsSource = _emojii.EmojisListBox4;
EmojisListBox5.ItemsSource = _emojii.EmojisListBox5;
EmojisListBox6.ItemsSource = _emojii.EmojisListBox6;
EmojisListBox7.ItemsSource = _emojii.EmojisListBox7;
TabItem1.Header = _emojii.TabItem1;
TabItem2.Header = _emojii.TabItem2;
TabItem3.Header = _emojii.TabItem3;
TabItem4.Header = _emojii.TabItem4;
TabItem5.Header = _emojii.TabItem5;
TabItem6.Header = _emojii.TabItem6;
TabItem7.Header = _emojii.TabItem7;
}
private void OnEmojiClick(object sender, RoutedEventArgs e)
{
foreach (Object selecteditem in EmojisListBox1.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
foreach (Object selecteditem in EmojisListBox2.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
foreach (Object selecteditem in EmojisListBox3.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
foreach (Object selecteditem in EmojisListBox4.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
foreach (Object selecteditem in EmojisListBox5.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
foreach (Object selecteditem in EmojisListBox6.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
foreach (Object selecteditem in EmojisListBox7.SelectedItems)
{
DirectoryListing Item = selecteditem as DirectoryListing;
if (Item.EmojiCode != "")
{
ÜbergebeEmojiAnChatView(Item.EmojiCode, Item.Pfad);
}
}
EmojisListBox1.SelectedIndex = -1;
EmojisListBox2.SelectedIndex = -1;
EmojisListBox3.SelectedIndex = -1;
EmojisListBox4.SelectedIndex = -1;
EmojisListBox5.SelectedIndex = -1;
EmojisListBox6.SelectedIndex = -1;
EmojisListBox7.SelectedIndex = -1;
// ChatEmojiView.Activate();
}
public void ÜbergebeEmojiAnChatView(string emojiicode, string muell)
{
try
{
Dispatcher.Invoke(
DispatcherPriority.Normal,
(ThreadStart)delegate
{
chatView.Chatbox.Focus();
chatView.Chatbox.Text += " " + emojiicode;
chatView.Chatbox.SelectionStart = chatView.Chatbox.Text.Length;
});
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace ChatController.ChatKlassen
{
public class AktuellerKontakt
{
public KontaktlistBuilder Kontakt { get; set; }
public string Name { get; private set; }
public ImageSource Image { get; private set; }
public DateTime TimeStamp { get; set; }
public long GroupId { get; set; }
public long? CustomerPersonOid { get; set; }
public AktuellerKontakt(KontaktlistBuilder kontakt)
{
if(kontakt != null) {
Kontakt = kontakt;
Image = kontakt.Image;
TimeStamp = kontakt.TimeStamp;
Name = kontakt.Name;
CustomerPersonOid = kontakt.CustomerPersonOid;
GroupId = kontakt.GroupId;
}
}
}
}

View File

@@ -0,0 +1,293 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
namespace ChatController.ChatKlassen
{
public class KontaktMessageBuilder
{
//kram für Die Dokumentation erstellen zb. MessagePersonOid
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, DateTime convertedSendTimeString)
{
Username = username;
UserMessage = message;
SendTime = sendtime;
ConvertetSendtimeString = convertedSendTimeString;
if (isme)
{
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
Posi = "Right";
}
else
{
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
Posi = "Left";
}
ChatVisibility = Visibility.Visible;
SoundVisibility = Visibility.Collapsed;
_pictureVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Collapsed;
_herunterladen = Visibility.Collapsed;
_gifPictureVisibility = Visibility.Collapsed;
}
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, ImageSource image, DateTime convertedSendTimeString)
{
Username = username;
UserMessage = message;
SendTime = sendtime;
ImageSources = image;
ConvertetSendtimeString = convertedSendTimeString;
if (isme)
{
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
Posi = "Right";
}
else
{
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
Posi = "Left";
}
//if (!isGif)
//{
_pictureVisibility = Visibility.Visible;
//_gifPictureVisibility = Visibility.Collapsed;
//}
//else
//{
// _pictureVisibility = Visibility.Collapsed;
// _gifPictureVisibility = Visibility.Visible;
//}
ChatVisibility = Visibility.Collapsed;
SoundVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Collapsed;
_herunterladen = Visibility.Collapsed;
}
#region kram der sortiert werden muss
//Alter Kram
public KontaktMessageBuilder(string username, string message, string sendtime, long messagePersonOid, bool isme, bool loadnext, object loadObject)
{
Username = username;
UserMessage = message;
SendTime = sendtime;
MessagePersonOid = messagePersonOid;
if (messagePersonOid == 0 && !loadnext)
{
ChatColor = new SolidColorBrush(Colors.AliceBlue); //CornflowerBlue
Posi = "Center";
}
else
if (isme)
{
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
Posi = "Right";
}
else
{
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
Posi = "Left";
}
if (loadnext)
{
Posi = "Right";
LoadNextVisibility = Visibility.Visible;
ChatVisibility = Visibility.Collapsed;
LoadObject = loadObject;
MainVisibility = Visibility.Collapsed;
}
else
{
LoadNextVisibility = Visibility.Collapsed;
ChatVisibility = Visibility.Visible;
LoadObject = null;
MainVisibility = Visibility.Visible;
}
SoundVisibility = Visibility.Collapsed;
_pictureVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Collapsed;
_herunterladen = Visibility.Collapsed;
}
public KontaktMessageBuilder(string username, string message, string sendtime, long messagePersonOid, bool isme,
bool isSoundDatei, bool isPicDatei, bool isDokument, ImageSource source, string fulldokpfad, byte[] dokarray, bool isHerunterladen, object[] herunterladbares, long? chatMessageOid)
{
Username = username;
UserMessage = message;
SendTime = sendtime;
MessagePersonOid = messagePersonOid;
ChatMessageOid = chatMessageOid;
if (isme && messagePersonOid == 0)
{
ChatColor = new SolidColorBrush(Colors.CornflowerBlue);
Posi = "Center";
}
else if (isme)
{
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
Posi = "Right";
}
else
{
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
Posi = "Left";
}
if (isSoundDatei)
{
ChatVisibility = Visibility.Collapsed;
SoundVisibility = Visibility.Visible;
_pictureVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Collapsed;
_herunterladen = Visibility.Collapsed;
}
else if (isDokument)
{
ChatVisibility = Visibility.Collapsed;
SoundVisibility = Visibility.Collapsed;
_pictureVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Visible;
_herunterladen = Visibility.Collapsed;
}
else if (isPicDatei && source != null)
{
ChatVisibility = Visibility.Collapsed;
SoundVisibility = Visibility.Collapsed;
_pictureVisibility = Visibility.Visible;
DokumentVisibility = Visibility.Collapsed;
_herunterladen = Visibility.Collapsed;
}
else if (isHerunterladen)
{
_herunterladen = Visibility.Visible;
ChatVisibility = Visibility.Collapsed;
SoundVisibility = Visibility.Collapsed;
_pictureVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Collapsed;
}
else
{
ChatVisibility = Visibility.Visible;
SoundVisibility = Visibility.Collapsed;
_pictureVisibility = Visibility.Collapsed;
DokumentVisibility = Visibility.Collapsed;
_herunterladen = Visibility.Collapsed;
}
if (source != null)
{
ImageSources = source;
}
//Dokument
object[] array1 = new object[3];
if (fulldokpfad != null && chatMessageOid == 0)
{
Dokpfad = fulldokpfad;
}
else if (chatMessageOid > 0 && fulldokpfad != null)
{
array1[0] = fulldokpfad;
array1[1] = dokarray;
array1[2] = chatMessageOid;
Dokpfad = array1;
}
if (herunterladbares != null)
{
Herunterladbares = herunterladbares;
}
//array übergabe für Sound ermöglichen
SoundArray = null;
LoadNextVisibility = Visibility.Collapsed;
MainVisibility = Visibility.Visible;
}
public string Username { get; private set; }
public string UserMessage { get; private set; }
public string SendTime { get; private set; }
public long MessagePersonOid { get; private set; }
public Brush ChatColor { get; private set; }
public int ChatPosition { get; private set; }
public string Posi { get; private set; }
public DateTime ConvertetSendtimeString { get; set; }
public Visibility MainVisibility { get; set; }
public Visibility ChatVisibility { get; set; }
public Visibility LoadNextVisibility { get; set; }
public object LoadObject { get; set; }
public Visibility SoundVisibility { get; set; }
private Visibility _pictureVisibility;
public Visibility PictureVisibility { get { return _pictureVisibility; } set { _pictureVisibility = value; OnPropertyChanged("PictureVisibility"); } }
private Visibility _gifPictureVisibility;
public Visibility GifPictureVisibility { get { return _gifPictureVisibility; } set { _gifPictureVisibility = value; OnPropertyChanged("GifPictureVisibility"); } }
public Visibility DokumentVisibility { get; set; }
public ImageSource ImageSources { get; private set; }
public object Dokpfad { get; private set; }
public byte[] SoundArray { get; private set; }
public long? ChatMessageOid { get; private set; }
private Visibility _herunterladen;
public Visibility Herunterladen
{
get { return _herunterladen; }
set { _herunterladen = value; OnPropertyChanged("Herunterladen"); }
}
public object[] Herunterladbares { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}

View File

@@ -0,0 +1,236 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
namespace ChatController.ChatKlassen
{
public class KontaktlistBuilder
{
public string Name { get; private set; }
private string _receiveMs;
public string ReceiveMs
{
get
{
var WordsArray = _receiveMs.Split();
//var verkuerzterText = _receiveMs.Substring(0,10);
if (WordsArray.Length > 4)
{
string Items = WordsArray[0] + " " + WordsArray[1] + " " + WordsArray[2] + " " + WordsArray[3] + "...";
return Items;
}
else
{
//if(_receiveMs.Length > 15)
return _receiveMs;
}
}
set
{
_receiveMs = value;
OnPropertyChanged("ReceiveMs");
}
}
private Brush _color;
public Brush Color
{
get
{
return _color;
}
set
{
_color = value;
OnPropertyChanged("Color");
}
}
private int _setzeGelesen;
public int SetzeGelesen
{
get { return _setzeGelesen; }
set
{
_setzeGelesen = value;
if (_setzeGelesen == 1)
{
_color = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
}
else
{
_color = new SolidColorBrush(Colors.Gray);
}
OnPropertyChanged("SetzeGelesen");
OnPropertyChanged("Color");
}
}
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)
{
Name = name;
ReceiveMs = lastMs;
Image = image;
TimeStamp = timestamp;
GroupId = groupid;
CustomerPersonOid = customerPersonOid;
SetzeGelesen = 1;
}
//public KontaktlistBuilder(string name, StatusType statustyp, ImageSource image, long empfaengerid, ChatType typeChat, CompactCustomerDC customer)
//{
// this.Customer = customer;
// this.Name = name;
// this.StatusTyp = statustyp;
// this.Image = image;
// this.EmpfaengerOid = empfaengerid;
// Receivems = "";
// TypeChat = typeChat;
// if (statustyp == StatusType.Online)
// {
// this.Color = new BrushConverter().ConvertFromString("#00ae00") as SolidColorBrush;
// }
// else if (statustyp == StatusType.Offline)
// {
// this.Color = new SolidColorBrush(Colors.Red);
// }
// else
// {
// this.Color = new SolidColorBrush(Colors.Orange);
// }
// if (typeChat == ChatType.Team)
// {
// _colorType = new SolidColorBrush(Colors.DarkViolet);
// }
// else if (typeChat == ChatType.Klienten)
// {
// _colorType = new SolidColorBrush(Colors.Blue);
// }
// else
// {
// _colorType = new SolidColorBrush(Colors.Green);
// }
//}
//public string Name { get; private set; }
//private StatusType _statustyp;
//public StatusType StatusTyp
//{
// get { return _statustyp; }
// set
// {
// _statustyp = value;
// if (_statustyp == StatusType.Online)
// {
// _color = new BrushConverter().ConvertFromString("#00ae00") as SolidColorBrush;
// }
// else if (_statustyp == StatusType.Offline)
// {
// _color = new SolidColorBrush(Colors.Red);
// }
// else
// {
// _color = new SolidColorBrush(Colors.Orange);
// }
// OnPropertyChanged("Lastms");
// }
//}
//public ImageSource Image { get; private set; }
//public long EmpfaengerOid { get; private set; }
//private string _receivems;
//public string Receivems { get { return _receivems; } set { _receivems = value; OnPropertyChanged("Receivems"); } }
//public ChatType TypeChat { get; set; }
//private Brush _color;
//public Brush Color
//{
// get
// {
// return _color;
// }
// set
// {
// if (StatusTyp == StatusType.Online)
// {
// _color = new BrushConverter().ConvertFromString("#00ae00") as SolidColorBrush;
// }
// else if (StatusTyp == StatusType.Offline)
// {
// _color = new SolidColorBrush(Colors.Red);
// }
// else
// {
// _color = new SolidColorBrush(Colors.Orange);
// }
// OnPropertyChanged("Color");
// }
//}
//private Brush _colorType;
//public Brush ColorType
//{
// get
// {
// return _colorType;
// }
// set
// {
// if (TypeChat == ChatType.Team)
// {
// _colorType = new SolidColorBrush(Colors.DarkViolet);
// }
// else if (TypeChat == ChatType.Klienten)
// {
// _colorType = new SolidColorBrush(Colors.Blue);
// }
// else
// {
// _colorType = new SolidColorBrush(Colors.Green);
// }
// OnPropertyChanged("ColorType");
// }
//}
//public CompactCustomerDC Customer { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.ChatKlassen
{
public class MessageCounter
{
public double MessageCount { get; set; }
}
}

View File

@@ -0,0 +1,440 @@
<UserControl x:Class="ChatController.ChatMainControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ChatController"
mc:Ignorable="d" x:Name="ChatControlling"
d:DesignHeight="300" d:DesignWidth="300" >
<Grid>
<GroupBox Header="Chat" x:Name="rootGroupBox" >
<!--MouseLeftButtonDown="RootGroupBox_OnMouseLeftButtonDown"Style="{DynamicResource MainContentGroupBoxWithoutMaximizeBtnStyle}"-->
<Grid >
<!--Background="{StaticResource ObjectEditBackgroundBrush}"-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2.7*" />
<ColumnDefinition Width="7.2*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<!-- ########################## Linkes panel ########################### -->
<Grid Grid.Column="0" Grid.Row="0" >
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="9.20*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Grid.Row="0" >
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left" Visibility="Collapsed">
<Label Content="Mein Status: " MaxWidth="80"/>
<RadioButton GroupName="status" x:Name="RadioButtonOnline" BorderBrush="Green" MaxWidth="15" ToolTip="Online" VerticalAlignment="Center" Foreground="Green"/>
<!--Checked="ComboBox_SelectionChanged"-->
<RadioButton GroupName="status" x:Name="RadioButtonOffline" BorderBrush="Red" MaxWidth="15" ToolTip="Offline" VerticalAlignment="Center" Foreground="Red"/>
<!--Checked="ComboBox_SelectionChanged"-->
<RadioButton GroupName="status" x:Name="RadioButtonBeschaeftigt" BorderBrush="DarkOrange" MaxWidth="15" ToolTip="Beschäftigt" VerticalAlignment="Center" Foreground="DarkOrange"/>
<!--Checked="ComboBox_SelectionChanged"-->
</StackPanel>
<StackPanel Grid.Row="0" MaxWidth="20" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Collapsed">
<Button Style="{DynamicResource IconButtonStyle}" x:Name="ButtonSortLabel" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" VerticalAlignment="Center" Width="20" Height="20" >
<!--Click="ButtonSortLabel_OnClick"-->
<Image x:Name="SortLabel" ToolTip="Sortierung ändern" Source="pack://application:,,,/Ressources/icons/unsortiert.png" />
</Button>
</StackPanel>
<!-- KeyDown="Suche_OnKeyDown" TextChanged="Suche_OnTextChanged" -->
<Label Grid.Row="0" Grid.Column="0" MinHeight="25">Suche:</Label>
<!-- <GroupBox Grid.Column="0" Grid.Row="1" Header="Suche:" Style="{x:Null}"> -->
<TextBox x:Name="Suche" Grid.Column="0" Grid.Row="1" Margin="3,3,3,3" MinHeight="25" Height="25" VerticalContentAlignment="Center" TextChanged="Suche_OnTextChanged" VerticalAlignment="Top" ToolTip="Suchen Sie hier nach einem User in der Liste" >
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Padding" Value="5,5,5,5" />
</Style>
</TextBox.Resources>
</TextBox>
<!-- </GroupBox> -->
<!-- <TextBlock IsHitTestVisible="False" Text="Suche..." VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="DarkGray">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsFocused, ElementName=Suche}" Value="true">
<Setter Property="Text" Value="" />
</DataTrigger>
<DataTrigger Binding="{Binding Text, ElementName=Suche}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>-->
</Grid>
<Grid Grid.Column="0" Grid.Row="1" >
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<!--###################################### Liste aller User mit Chat Berechtigung mit prozentsatz groeße setzenb###################################################### -->
<ListView x:Name="Clientlist" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" Margin="3" Style="{DynamicResource ResourceKey=styleListBox}" ItemTemplate="{DynamicResource DataTemplate1}" SelectionChanged="Clientlist_OnSelectionChanged" >
<!--SelectionChanged="ListBoxSelectedIndexChanged"-->
<ListView.Resources>
<DataTemplate x:Key="DataTemplate1">
<Grid Margin="7,0,0,0" x:Name="GridMargin">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35"/>
<ColumnDefinition Width="7"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="12"/>
</Grid.ColumnDefinitions>
<Border BorderThickness="0.25" CornerRadius="3" Grid.RowSpan="2" Grid.ColumnSpan="5" Background="White" >
<Border.BorderBrush>
<SolidColorBrush Color="Black" />
</Border.BorderBrush>
</Border>
<Ellipse Width='30' Height='30' RenderOptions.BitmapScalingMode="HighQuality">
<Ellipse.Fill>
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill' RenderOptions.BitmapScalingMode="HighQuality" />
</Ellipse.Fill>
</Ellipse>
<!-- <StackPanel Grid.Column="1" Height="30" > Online status anzeige
<Ellipse Width='7' Height='7' Fill="{Binding Path=Color}" Margin="-23,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Fill" />
</StackPanel>-->
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="1" >
<StackPanel Orientation="Horizontal" TextBlock.FontWeight="Bold" >
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" />
</StackPanel>
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
</StackPanel>
<!--Für die anzeige der anzahl ungelesener Nachrichten Height="30"-->
<StackPanel Margin="1" Grid.Row="1">
<TextBlock Text="{Binding Path=ReceiveMs}" FontWeight="Bold" FontSize="8" Foreground="{Binding Path=Color}" />
</StackPanel>
</Grid>
<StackPanel Grid.Column="4" Margin="7,0,0,0">
<Rectangle Fill="{Binding Path=ColorType}" Stretch="Fill" Height="30" Width="2" />
</StackPanel>
</Grid>
</DataTemplate>
</ListView.Resources>
<!--Uberschríft Mitarbeiter, ItemCount-->
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander IsExpanded="True">
<Expander.Header>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="Black" FontSize="18" VerticalAlignment="Bottom" Width="148" />
<TextBlock Text="{Binding ItemCount}" FontSize="12" Foreground="Black" FontWeight="Bold" Margin="10,0,0,1" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
<!-- <ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle> -->
</ListView>
</Grid>
</Grid>
<!-- ####################### Rechtes Panel ################################-->
<Grid Grid.Column="1" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.80*"/>
<RowDefinition Height="8.45*" />
<RowDefinition Height="0.75*"/>
</Grid.RowDefinitions>
<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>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<!-- <Border Margin="5" BorderBrush="DarkGray" BorderThickness="1"> -->
<Ellipse Width='30' Height='30' VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
<Ellipse.Fill >
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill'/>
</Ellipse.Fill>
</Ellipse>
<!-- <Image Source="{Binding Path=Image}" Stretch="Fill" Width="30" Height="30" />-->
<!-- </Border> -->
<StackPanel Grid.Column="1" Margin="5" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" TextBlock.FontWeight="Bold" >
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" />
</StackPanel>
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.Resources>
</ListBox>
<Button Style="{DynamicResource IconButtonStyle}" x:Name="ButtonAlarmLabel" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" Height="20" Margin="0,-31,40,0" VerticalAlignment="Top" Width="20" Visibility="Collapsed" >
<Image x:Name="AlarmLabel" ToolTip="Zurzeit nicht Verbunden" Source="" />
</Button>
<!--####################### Media Gedöns ###############################################################-->
<Grid Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35"/>
<ColumnDefinition Width="125"/>
<ColumnDefinition Width="55"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" HorizontalAlignment="Center" Margin="1" Width="30" Visibility="Collapsed">
<!--PreviewMouseDown="Sound_OnPreviewMouseDown" PreviewMouseUp="Sound_OnPreviewMouseUp" raus damit -->
<Image x:Name="SmileySound" ToolTip="Sound Aufnehmen und verschicken" Source="/BeWoPlaner;component/Ressources/Icons/glucklicher.png" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality" />
</Button>
<!--<Button Grid.Column="2" HorizontalAlignment="Center" Width="50" Height="25" Margin="1" Click="MediaButton_OnClick" Visibility="Collapsed">
<Image Source="/Ressources/paperclip.png" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality" />
</Button>Click="MediaBase_OnClick"
<ListBox.ItemsSource>
<PriorityBinding FallbackValue="defaultvalue">
<Binding IsAsync="True"/>
</PriorityBinding>
</ListBox.ItemsSource>
-->
<Button Content="Video Chatten" Grid.Column="1" HorizontalAlignment="Center" Width="120" Margin="1" Visibility="Collapsed"/>
<!--Click="ButtonVideoChat_OnClick" raus damit-->
</Grid>
<ListBox x:Name="Chat" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Margin="3" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseRightButtonDown="Chat_OnMouseRightButtonDown" ScrollViewer.ScrollChanged="Chat_OnScrollChanged">
<!--MouseRightButtonDown="OnRightClickEvent"-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalAlignment" Value="{Binding Posi}" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="3" />
<Setter Property="Padding" Value="10,0,0,0" />
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<!--Lade Weitere Nachrichten anzeige {Binding LoadNextVisibility} -->
<StackPanel Visibility="Collapsed" >
<Image ToolTip="Weitere Nachrichten Laden" Source="/BeWoPlaner;component/Ressources/Icons/WeitereNachrichtLaden.png" Width="25" Height="25" Stretch="Uniform" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Tag="{Binding LoadObject}" HorizontalAlignment="Center" />
<!--MouseDown="WeitereNachrichten_OnMouse"-->
</StackPanel>
<Border BorderBrush="{Binding ChatColor}" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8" Background="{Binding ChatColor}" Visibility="{Binding MainVisibility}" >
<DockPanel MinHeight="15" Margin="5" LastChildFill="True" Background="{Binding ChatColor}" Visibility="{Binding MainVisibility}" >
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ChatVisibility}" >
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" />
</StackPanel>
<!--Herunterlade bereich wird nicht genutzt weg damit ?-->
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding Herunterladen}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<!-- Name Der Datei -->
<TextBlock Text="{Binding UserMessage}" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<!-- Herunterlade Button -->
<Button Content="Herunterladen" Grid.Row="1" ToolTip="Datei Herunterladen" HorizontalAlignment="Center" VerticalAlignment="Center" Width="125" Height="25" Tag="{Binding Herunterladbares}" />
<!--Click="DatenRunterladen_OnClick"-->
</Grid>
</DockPanel>
<!-- #++++++++++++++++++++++++++++++++++++++++++++++# -->
<!-- Bild bereich-->
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" >
<StackPanel Orientation="Vertical">
<Image Stretch="Uniform" MaxHeight="200" MaxWidth="300" Source="{Binding ImageSources}" RenderOptions.BitmapScalingMode="HighQuality" />
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</DockPanel>
<!-- Gif BEreich ??
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding GifPictureVisibility}" >
<StackPanel Orientation="Vertical">
<MediaElement LoadedBehavior="Play" UnloadedBehavior="Manual" MediaFailed="MediaElement_OnMediaFailed" MediaEnded="MediaElement_OnMediaEnded" Source="{Binding UserMessage}" Stretch="Uniform" MaxHeight="200" MaxWidth="300" >
<MediaElement.OpacityMask>
<ImageBrush ImageSource="{Binding UserMessage}"/>
</MediaElement.OpacityMask>
</MediaElement>
<TextBlock Text="{Binding UserMessage}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
</DockPanel>-->
<!--Dokument bereich -->
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
<Button HorizontalAlignment="Center" VerticalAlignment="Center" Height="25" Width="25" Tag="{Binding Dokpfad}" >
<!--Click="OpenDokument_OnClick"-->
<Image ToolTip="Dokument öffnen" Source="/BeWoPlaner;component/Ressources/Icons/ClipboardDisabled.png" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}"/>
</DockPanel>
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
<TextBlock Text="{Binding Username}" FontWeight="Bold" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel DockPanel.Dock="Right" Margin="5,0,0,5" >
<TextBlock Text="{Binding SendTime}" MaxWidth="350" HorizontalAlignment="Right" TextAlignment="Right" VerticalAlignment="Center"/>
</StackPanel>
</DockPanel>
</Border>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid Grid.Row="2" Margin="3,0,3,3" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8.5*"/>
<ColumnDefinition Width=".5*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.ColumnSpan="2" MinHeight="25">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="9.5*"/>
<ColumnDefinition Width=".5*"/>
<ColumnDefinition Width=".5*"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="Chatbox" HorizontalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="Nachricht schreiben" VerticalScrollBarVisibility="Hidden" MaxLines="5" MaxHeight="70" Visibility="Visible"
VerticalContentAlignment="Center" MinHeight="25" ToolTip="Schreiben Sie hier eine Nachricht hinein" Foreground="DarkGray" VerticalAlignment="Bottom" GotFocus="Chatbox_OnGotFocus" KeyDown="Chatbox_OnKeyDownHandler">
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="10,0,55,0" />
</Style>
</TextBox.Resources>
</TextBox>
<Button Grid.Column="1" Style="{x:Null}" Height="25" Width="25" Background="Transparent" BorderThickness="0" Margin="1,0,0,0" VerticalAlignment="Bottom" ToolTip="Bild einfügen" Click="MediaButton_OnClick">
<Image Height="15" Width="15" Source='Ressourcen/paperclip.png' Margin="3" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Right"/>
</Button>
<Button Grid.Column="2" Style="{x:Null}" Height="25" Width="25" Background="Transparent" BorderThickness="0" x:Name="EmojiButton" Margin="1,0,0,0" VerticalAlignment="Bottom" ToolTip="Emoji einfügen" Click="EmojiButton_OnClick">
<Image Height="15" Width="15" Source='Ressourcen/glucklicher.png' Margin="3" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Right"/>
</Button>
</Grid>
<Button x:Name="SendButton" Content="Senden" HorizontalAlignment="Stretch" Margin="2,0,0,0" Grid.Column="2" VerticalAlignment="Bottom" Click="SendButton_OnClick" Background="#ff5e00" Height="25" >
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="1,1,1,1" />
</Style>
</Button.Resources>
</Button>
</Grid>
</Grid>
</Grid>
</GroupBox>
</Grid>
</UserControl>

View File

@@ -0,0 +1,643 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using ChatController.ChatKlassen;
using ChatController.HauptKlassen;
using ChatController.Klassen;
namespace ChatController
{
/// <summary>
/// Interaktionslogik für ChatMainWindow.xaml
/// </summary>
public partial class ChatMainControl : UserControl
{
private Chat _chat;
private AktuellerKontakt _aktuellerKontakt;
private bool isChatBoxOnFocus = false;
private ChatEmojiiControl _emojiView;
private IOrderedEnumerable<KontaktMessageBuilder> _Orderedmessagelist;
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
private readonly List<KontaktMessageBuilder> _messagelist = new List<KontaktMessageBuilder>();
private ChatDatenUebergabe _chatDaten;
private bool scrollPrueferAktivieren = false;
public Thread newThread;
public bool threadBool = true;
public Thread AlleKontakteThread;
public bool AlleNachrichtenThreadBool = true;
private double? AlleNachrichtenCount = null;
private Dictionary<String, Action<string>> menuItemName2Callback = new Dictionary<string, Action<string>>();
public ChatMainControl()
{
InitializeComponent();
}
public void InitMitChatdaten(ChatDatenUebergabe cdu)
{
_chatDaten = cdu;
_chat = new Chat(cdu);
_kontaktlist = _chat.GroupklassenInChatKontakteUmwandler();
Clientlist.ItemsSource = _kontaktlist;
//Neu
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
view.Filter = UserFilter;
//NEu
HorcheAlleGruppenNachrichten();
}
public AktuellerKontakt GetAktuellenKontakt()
{
if (AktChatUser != null)
{
var kontakt = (AktuellerKontakt) AktChatUser.Items[0];
if (kontakt.CustomerPersonOid == null)
{
return null;
}
return kontakt;
}
else
{
return null;
}
}
public List<KontaktMessageBuilder> GetSelectedMessages()
{
List<KontaktMessageBuilder> itemListe = new List<KontaktMessageBuilder>();
foreach (Object selecteditem in Chat.SelectedItems)
{
KontaktMessageBuilder Item = selecteditem as KontaktMessageBuilder;
//if (Item.MessagePersonOid == 0)
//{
itemListe.Add(Item);
//}
}
if(itemListe.Count > 0) {
return itemListe;
}
else
{
return null;
}
}
#region Lade KontaktDaten und Lade sie in den Chat
private void AktChatUser_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
_chat.ShowKontaktPicture(_aktuellerKontakt);
}
private void Clientlist_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(Clientlist.SelectedItem != null) {
Cursor = Cursors.Wait;
scrollPrueferAktivieren = false;
Chat.ItemsSource = null;
AktChatUser.Items.Clear();
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
if(kontakt.SetzeGelesen == 1) {
kontakt.SetzeGelesen = 0;
Clientlist.Items.Refresh();
}
var aktuellerKontakt = new AktuellerKontakt(kontakt);
AktChatUser.Items.Add(aktuellerKontakt);
_aktuellerKontakt = aktuellerKontakt;
var x = _chat.LadeChatNachrichtenVomKontakt(aktuellerKontakt);
Chat.ItemsSource = x;
Chat.Items.MoveCurrentToLast();
Chat.ScrollIntoView(Chat.Items.CurrentItem);
Chat.ContextMenu = _chat.ErstelleKontextMenue();
SetContextHandler();
scrollPrueferAktivieren = true;
HorcheAktivNachNachrichten();
Cursor = Cursors.Arrow;
}
}
private void SetContextHandler()
{
var contextItems = Chat.ContextMenu.Items;
foreach (var menuItemText in menuItemName2Callback.Keys)
{
var cb = menuItemName2Callback[menuItemText];
MenuItem item = new MenuItem();
item.Click += (s, e2) =>
{
cb(menuItemText);
};
item.Header = menuItemText;
contextItems.Add(item);
}
var item2 = (MenuItem)contextItems[0];
item2.Click += Item2OnClick;
var item3 = (MenuItem)contextItems[1];
item3.Click += Item3OnClick;
}
public delegate void ContextDelegate();
public event ContextDelegate CreateNewContextItems;
private void Chat_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
var contextItems = Chat.ContextMenu.Items;
//abfragen für on right click vom Bewoplaner Chat hinzufügen
}
private void Item2OnClick(object sender, RoutedEventArgs routedEventArgs)
{
foreach (var items in Chat.SelectedItems)
{
var item = (KontaktMessageBuilder)items;
_chat.SpeichernUnterFunkion(item);
}
}
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
{
// _chat.Einfuegen();
}
#endregion
#region Sende Media Nachrichten
private void MediaButton_OnClick(object sender, RoutedEventArgs e)
{
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
_chat.HoleUndSendeMediumAnKontakt(kontakt);
Chat.ItemsSource = null;
Chat.ItemsSource = _chat.LadeChatNachrichtenVomKontakt(kontakt);
Chat.Items.MoveCurrentToLast();
Chat.ScrollIntoView(Chat.Items.CurrentItem);
}
#endregion
#region Sende Normale Nachrichten
private void SendButton_OnClick(object sender, RoutedEventArgs e)
{
if (!AktChatUser.Items.IsEmpty && !Chatbox.Text.Equals("") && isChatBoxOnFocus)
{
if (!Chatbox.Text.Equals(""))
{
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
var text = Chatbox.Text;
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
Chatbox.Text = "";
//Lade Nachrichten nach
Chat.Items.MoveCurrentToLast();
Chat.ScrollIntoView(Chat.Items.CurrentItem);
if (Chatbox.Text.Equals(""))
{
Chatbox.Text = "Nachricht schreiben";
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
isChatBoxOnFocus = false;
}
}
}
else
{
if (AktChatUser.Items.IsEmpty)
{
MessageBox.Show("Bitte wählen Sie einen Chatpartner aus.", "Fehler", MessageBoxButton.OK);
if (Chatbox.Text.Equals(""))
{
Chatbox.Text = "Nachricht schreiben";
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
isChatBoxOnFocus = false;
}
}
else if (Chatbox.Text.Equals(""))
{
MessageBox.Show("Sie können keine lehre Nachricht verschicken.", "Fehler", MessageBoxButton.OK);
if (Chatbox.Text.Equals(""))
{
Chatbox.Text = "Nachricht schreiben";
Chatbox.Foreground = new SolidColorBrush(Colors.DarkGray);
isChatBoxOnFocus = false;
}
}
}
}
private void Chatbox_OnGotFocus(object sender, RoutedEventArgs e)
{
if (Chatbox.Text.Equals("Nachricht schreiben"))
{
Chatbox.Text = "";
Chatbox.Foreground = new SolidColorBrush(Colors.Black);
isChatBoxOnFocus = true;
}
//hier bereich wie Dokumentieren
}
private void Chatbox_OnKeyDownHandler(object sender, KeyEventArgs e)
{
try
{
if (e.Key == Key.Return)
{
if (!AktChatUser.Items.IsEmpty && !Chatbox.Text.Equals(""))
{
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
var text = Chatbox.Text;
_chat.SendMessage(Chatbox.Text, kontakt.GroupId);
Chatbox.Text = "";
//lade Nachrichten nach
}
else
{
if (AktChatUser.Items.IsEmpty)
{
MessageBox.Show("Bitte wählen Sie einen Chatpartner aus.", "Fehler", MessageBoxButton.OK);
}
else if (Chatbox.Text.Equals(""))
{
MessageBox.Show("Sie können keine lehre Nachricht verschicken.", "Fehler", MessageBoxButton.OK);
}
}
}
}
catch (Exception ed)
{
MessageBox.Show("Beim Senden einer Nachricht ist ein Fehler aufgetreten. " + ed.Message + "\n" + ed.StackTrace, "Fehler", MessageBoxButton.OK);
}
}
#endregion
#region Add Emoji To ChatBox
public delegate void EmojiiDelegate(Button x);
public event EmojiiDelegate OnEmojii;
private void EmojiButton_OnClick(object sender, RoutedEventArgs e)
{
//hier wie bei login
if (OnEmojii != null)
{
OnEmojii(EmojiButton);
}
}
#endregion
public void AddContextMenu(string menuItemText, Action<string> callBackAction)
{
if (!menuItemName2Callback.ContainsKey(menuItemText))
{
menuItemName2Callback.Add(menuItemText, callBackAction);
}
}
#region Nachladen weiterer Chat Nachrichten
private void Chat_OnScrollChanged(object sender, ScrollChangedEventArgs e)
{
List<ScrollBar> scrollBarList = GetVisualChildCollection<ScrollBar>(Chat);
foreach (ScrollBar scrollBar in scrollBarList)
{
if (scrollBar.Orientation == Orientation.Horizontal)
{
scrollBar.ValueChanged += HorizontalScrollbarChanged;
scrollPrueferAktivieren = true;
}
else
{
scrollBar.ValueChanged += VerticalScrollbarChanged;
}
}
}
private void VerticalScrollbarChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
{
if (scrollPrueferAktivieren == true)
{
var x = (ScrollBar) sender;
if (x.Value > 0)
{
//nix
}
else
{
scrollPrueferAktivieren = false;
Chat.Items.MoveCurrentToFirst();
KontaktMessageBuilder item = Chat.Items.CurrentItem as KontaktMessageBuilder;
Chat.ItemsSource = null;
var kontakt = (KontaktlistBuilder)Clientlist.SelectedItem;
var xy = _chat.LadeWeiterNachrichten(kontakt);
Chat.ItemsSource = xy;
Chat.ScrollIntoView(item);
}
}
}
private void HorizontalScrollbarChanged(object sender, RoutedPropertyChangedEventArgs<double> routedPropertyChangedEventArgs)
{
//nix
}
#region Get Scollbar von listbox
private static List<T> GetVisualChildCollection<T>(object parent) where T : Visual
{
List<T> visualCollection = new List<T>();
GetVisualChildCollection(parent as DependencyObject, visualCollection);
return visualCollection;
}
private static void GetVisualChildCollection<T>(DependencyObject parent, List<T> visualCollection) where T : Visual
{
int count = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < count; i++)
{
DependencyObject child = VisualTreeHelper.GetChild(parent, i);
if (child is T)
{
visualCollection.Add(child as T);
}
else if (child != null)
{
GetVisualChildCollection(child, visualCollection);
}
}
}
#endregion
#endregion
#region Funktion Nachrichten Listener
private void HorcheAktivNachNachrichten()
{
threadBool = false;
if (newThread != null)
{
newThread.Join();
newThread = null;
}
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
//thred besser verwalten
newThread = new Thread(DoWork);
newThread.IsBackground = true;
newThread.Start(kontakt);
}
private void DoWork(object o)
{
threadBool = true;
bool _schaueNachMs = false;
var kontakt = (AktuellerKontakt) o;
while (true)
{
_schaueNachMs = _chat.SchaueNachNeuenNachrichten(kontakt);
if (_schaueNachMs == true)
{
this.Dispatcher.BeginInvoke(
DispatcherPriority.Background,
(Action)delegate
{
if(kontakt != null) {
//neuer Aufruf villeicht nur von
//Cursor = Cursors.Wait;
Chat.ItemsSource = null;
//Wichtig Verbessern
var x = _chat.LadeChatNachrichtenVomKontakt(kontakt);
//foreach (var liste in _Orderedmessagelist)
//{
// foreach (var neu in alist)
// {
// if (liste.ChatMessageOid == neu.ChatMessageOid)
// {
// //_Orderedmessagelist.CreateOrderedEnumerable(neu,,true);
// //if (!liste.ReceiveMs.Equals(neu.ReceiveMs))
// //{
// // liste.ReceiveMs = neu.ReceiveMs;
// // liste.SetzeGelesen = 1;
// // //Vorher noch abfragen ob die id gleich den chat ist und dann nur wenn nicht zutrifft dann auf 1 setzen
// //}
// }
// }
//}
Chat.ItemsSource = x;
//Cursor = Cursors.Arrow;
Chat.Items.MoveCurrentToLast();
Chat.ScrollIntoView(Chat.Items.CurrentItem);
}
});
_schaueNachMs = false;
}
if (threadBool == false)
{
break;
}
Task.Delay(2000);
//Thread.Sleep(2000);
}
}
#endregion
#region Für alle Nachrichten Count Listener
private void HorcheAlleGruppenNachrichten()
{
AlleKontakteThread = new Thread(DoWorkAlleNachrichten);
AlleKontakteThread.IsBackground = true;
AlleKontakteThread.Start();
}
private void DoWorkAlleNachrichten()
{
while (true)
{
var x = _chat.SchaueNachAllenMessageCounts();
if (AlleNachrichtenCount == null)
{
AlleNachrichtenCount = x;
}
if (x > AlleNachrichtenCount)
{
this.Dispatcher.BeginInvoke(
DispatcherPriority.Background,
(Action)delegate
{
var alist = _chat.NeueGroupklassenKontakte();
var aktuellerKontakt =(AktuellerKontakt)AktChatUser.Items[0];
foreach (var liste in _kontaktlist)
{
foreach (var neu in alist)
{
if (liste.GroupId == neu.GroupId)
{
if (!liste.ReceiveMs.Equals(neu.ReceiveMs)) {
liste.ReceiveMs = neu.ReceiveMs;
if (neu.GroupId == aktuellerKontakt.GroupId)
{
liste.SetzeGelesen = 0;
}
else
{
liste.SetzeGelesen = 1;
}
}
}
}
}
Clientlist.Items.Refresh();
});
AlleNachrichtenCount = x;
}
if (AlleNachrichtenThreadBool == false)
{
break;
}
Task.Delay(5000);
//Thread.Sleep(5000);
}
}
#endregion
#region Suche Nach Person
private void Suche_OnTextChanged(object sender, TextChangedEventArgs e)
{
CollectionViewSource.GetDefaultView(Clientlist.ItemsSource).Refresh();
}
private bool UserFilter(object item)
{
if (String.IsNullOrEmpty(Suche.Text))
return true;
else
return ((item as KontaktlistBuilder).Name.IndexOf(Suche.Text, StringComparison.OrdinalIgnoreCase) >= 0);
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,477 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
namespace ChatController.HauptKlassen
{
public class ChatEmoji
{
public List<DirectoryListing> EmojisListBox1 = new List<DirectoryListing>();
public List<DirectoryListing> EmojisListBox2 = new List<DirectoryListing>();
public List<DirectoryListing> EmojisListBox3 = new List<DirectoryListing>();
public List<DirectoryListing> EmojisListBox4 = new List<DirectoryListing>();
public List<DirectoryListing> EmojisListBox5 = new List<DirectoryListing>();
public List<DirectoryListing> EmojisListBox6 = new List<DirectoryListing>();
public List<DirectoryListing> EmojisListBox7 = new List<DirectoryListing>();
public string TabItem1;
public string TabItem2;
public string TabItem3;
public string TabItem4;
public string TabItem5;
public string TabItem6;
public string TabItem7;
public ChatEmoji()
{
LoadEmojipicsInView();
}
private void LoadEmojipicsInView()
{
#region Normale
List<String> normal = new List<string>
{
"D83DDE00", "D83DDE01", "D83DDE02", "D83DDE03", "D83DDE04", "D83DDE05", "D83DDE06", "D83DDE09", "D83DDE0A", "D83DDE0B", "D83DDE0E",
"D83DDE0D","D83DDE18","D83DDE17","D83DDE19","D83DDE1A","263A","D83DDE42","D83DDE10","D83DDE11","D83DDE36","D83DDE0F","D83DDE23","D83DDE25","D83DDE2E","D83DDE2F",
"D83DDE2A","D83DDE2B","D83DDE34","D83DDE0C","D83DDE1B","D83DDE1C","D83DDE1D","D83DDE12","D83DDE13","D83DDE14","D83DDE15","D83DDE32","2639","D83DDE41","D83DDE16",
"D83DDE1E","D83DDE1F","D83DDE24","D83DDE22","D83DDE2D","D83DDE26","D83DDE27","D83DDE28","D83DDE29","D83DDE2C","D83DDE30","D83DDE31","D83DDE33","D83DDE35","D83DDE21",
"D83DDE20","D83DDE07","D83DDE37"
};
foreach (var x in normal)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader1 = string.Join("", (from Match m in Regex.Matches("D83DDE0A", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem1 = tabheader1;
#endregion
#region Variable
List<String> variable = new List<string> { "D83DDE08", "D83DDC7F", "D83DDC79", "D83DDC7A", "D83DDC80", "2620", "D83DDC7B", "D83DDC7D", "D83DDC7E", "D83DDCA9" };
foreach (var x in variable)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Tier
List<String> tier = new List<string>
{
"D83DDE3A","D83DDE38","D83DDE39","D83DDE3B","D83DDE3C","D83DDE3D","D83DDE40","D83DDE3F","D83DDE3E","D83DDE48","D83DDE49","D83DDE4A","D83D DC35","D83D DC12",
"D83D DC36", "D83D DC15","D83D DC29","D83D DC3A","D83D DC31","D83D DC08","D83D DC2F","D83D DC05","D83D DC06","D83D DC34","D83D DC0E 0009","D83D DC2E","D83D DC02",
"D83D DC03","D83D DC04","D83D DC37","D83D DC16","D83D DC17","D83D DC3D","D83D DC0F","D83D DC11","D83D DC10","D83D DC2A","D83D DC2B","D83D DC18","D83D DC2D","D83D DC01",
"D83D DC00","D83D DC39","D83D DC30","D83D DC07","D83D DC3F","D83D DC3B","D83D DC28","D83D DC3C","D83D DC3E","D83D DC14","D83D DC13","D83D DC23","D83D DC24","D83D DC25",
"D83D DC26","D83D DC27","D83D DD4A","D83D DC38","D83D DC0A","D83D DC22","D83D DC0D","D83D DC32","D83D DC09","D83D DC33","D83D DC0B","D83D DC2C","D83D DC1F","D83D DC20",
"D83D DC21","D83D DC19","D83D DC1A","D83D DC0C","D83D DC1B","D83D DC1C","D83D DC1D","D83D DC1E","D83D DD77","D83D DD78"
};
foreach (var x in tier)
{
EmojisListBox2.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Mensch
List<String> mensch = new List<string>
{
"D83DDC66","D83DDC67","D83DDC68","D83DDC69","D83DDC74","D83DDC75","D83DDC76","D83DDC7C","D83DDC6E","D83DDD75","D83DDC82","D83DDC77","D83DDC73",
"D83DDC71","D83CDF85","D83DDC78","D83DDC70","D83DDC72","D83DDE4D","D83DDE4E","D83DDE45","D83DDE46","D83DDC81","D83DDE4B","D83DDE47","D83DDC86",
"D83DDC87","D83DDEB6","D83CDFC3","D83DDC83","D83DDC6F","D83DDD74","D83DDDE3","D83DDC64","D83DDC65","D83DDC6B","D83DDC6C","D83DDC6D","D83DDC8F",
"D83DDC69 200D2764FE0F200DD83DDC8B200DD83DDC68","D83DDC68200D2764FE0F200DD83DDC8B200DD83DDC68","D83DDC69200D2764FE0F200DD83DDC8B200DD83DDC69",
"D83DDC91","D83DDC69200D2764FE0F200DD83DDC68","D83DDC68200D2764FE0F200DD83DDC68","D83DDC69200D2764FE0F200DD83DDC69",
"D83DDC6A","D83DDC68200DD83DDC69200DD83DDC66","D83DDC68200DD83DDC69200DD83DDC67","D83DDC68200DD83DDC69200DD83DDC67200DD83DDC66",
"D83DDC68200DD83DDC69200DD83DDC66200DD83DDC66","D83DDC68200DD83DDC69200DD83DDC67200DD83DDC67","D83DDC68200DD83DDC68200DD83DDC66",
"D83DDC68200DD83DDC68200DD83DDC67","D83DDC68200DD83DDC68200DD83DDC67200DD83DDC66","D83DDC68200DD83DDC68200DD83DDC66200DD83DDC66",
"D83DDC68200DD83DDC68200DD83DDC67200DD83DDC67","D83DDC69200DD83DDC69200DD83DDC66","D83DDC69200DD83DDC69200DD83DDC67",
"D83DDC69200DD83DDC69200DD83DDC67200DD83DDC66","D83DDC69200DD83DDC69200DD83DDC66200DD83DDC66","D83DDC69200DD83DDC69200DD83DDC67200DD83DDC67"
};
foreach (var x in mensch)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Zeichen
List<String> zeichen = new List<string>
{
"D83DDCAA","D83DDC48","D83DDC49","261D","D83DDC46","D83DDD95","D83DDC47","270C","D83DDD96","D83DDD90","270B","D83DDC4C","D83DDC4D","D83DDC4E","270A",
"D83DDC4A","D83DDC4B","D83DDC4F","270D","D83DDC50","D83DDE4C","D83DDE4F","D83DDC85","D83DDC42","D83DDC43","D83DDC63","D83DDC40","D83DDC41","D83DDC41200DD83DDDE8"
};
foreach (var x in zeichen)
{
EmojisListBox7.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader7 = string.Join("", (from Match m in Regex.Matches("270C", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem7 = tabheader7;
#endregion
#region Nur die Liebe Zählt
List<String> liebe = new List<string>
{
"D83DDC45","D83DDC44","D83DDC8B","D83DDC98","2764","D83DDC93","D83DDC94","D83DDC95","D83DDC96","D83DDC97","D83DDC99","D83DDC9A","D83DDC9B","D83DDC9C",
"D83DDC9D","D83DDC9E","D83DDC9F","2763","D83DDC8C"
};
foreach (var x in liebe)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Sonstiges
List<String> sonstiges = new List<string>
{
"D83DDCA4","D83DDCA2","D83DDCA3","D83DDCA5","D83DDCA6", "D83DDCA8","D83DDCAB","D83DDCAC","D83DDDE8","D83DDDEF","D83DDCAD","D83DDD73"
};
foreach (var x in sonstiges)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Kleidung
List<String> kleidung = new List<string>
{
"D83D DC53","D83D DD76","D83D DC54","D83DDC55","D83D DC56","D83D DC57","D83D DC58","D83D DC59","D83D DC5A","D83D DC5B","D83D DC5C","D83D DC5D","D83D DECD","D83C DF92",
"D83D DC5E","D83D DC5F","D83D DC60","D83D DC61","D83D DC62","D83D DC51","D83D DC52","D83C DFA9","D83C DF93","26D1","D83D DC84","D83D DC8D","D83D DC8E"
};
foreach (var x in kleidung)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Pflanzen
List<String> pflanzen = new List<string>
{
"D83DDC90","D83CDF38","D83DDCAE","D83CDFF5","D83CDF39","D83CDF3A","D83CDF3B","D83CDF3C","D83CDF37","D83CDF31","D83CDF32","D83CDF33","D83CDF34",
"D83CDF35","D83CDF3E","D83CDF3F","2618","D83CDF40","D83CDF41","D83CDF42","D83CDF43"
};
foreach (var x in pflanzen)
{
EmojisListBox2.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader2 = string.Join("", (from Match m in Regex.Matches("D83CDF3C", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem2 = tabheader2;
#endregion
#region Nahrung
List<String> nahrung = new List<string>
{
"D83CDF47","D83CDF48","D83CDF49","D83CDF4A","D83CDF4B","D83CDF4C","D83CDF4D","D83CDF4E","D83CDF4F","D83CDF50","D83CDF51","D83CDF52","D83CDF53",
"D83CDF45","D83CDF46","D83CDF3D","D83CDF36","D83CDF44","D83CDF30","D83CDF5E","D83CDF56","D83CDF57","D83CDF54","D83CDF5F","D83CDF55","D83CDF73",
"D83CDF72","D83CDF71","D83CDF58","D83CDF59","D83CDF5A","D83CDF5B","D83CDF5C","D83CDF5D","D83CDF60","D83CDF62","D83CDF63","D83CDF64","D83CDF65",
"D83CDF61","D83CDF66","D83CDF67","D83CDF68","D83CDF69","D83CDF6A","D83CDF82","D83CDF70","D83CDF6B","D83CDF6C","D83CDF6D","D83CDF6E","D83CDF6F",
"D83CDF7C","2615","D83CDF75","D83CDF76","D83CDF77","D83CDF78","D83CDF79","D83CDF7A","D83CDF7B","D83CDF7D","D83CDF74","D83DDD2A"
};
foreach (var x in nahrung)
{
EmojisListBox3.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader3 = string.Join("", (from Match m in Regex.Matches("D83CDF74", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem3 = tabheader3;
#endregion
#region planet
List<String> planet = new List<string>
{
"D83CDF0D","D83CDF0E","D83CDF0F","D83CDF10","D83DDDFA","D83DDDFE","D83CDFD4","26F0","D83CDF0B","D83CDFD5","D83CDFD6","D83CDFDC","D83CDFDD","D83CDFDE"
};
foreach (var x in planet)
{
EmojisListBox2.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Tuck Tuck
List<String> tucktuck = new List<string>
{
"D83DDE82","D83DDE83","D83DDE84","D83DDE85","D83DDE86","D83DDE87","D83DDE88","D83DDE89","D83DDE8A","D83DDE9D","D83DDE9E","D83DDE8B","D83DDE8C",
"D83DDE8D","D83DDE8E","D83DDE90","D83DDE91","D83DDE92","D83DDE93","D83DDE94","D83DDE95","D83DDE96","D83DDE97","D83DDE98","D83DDE99","D83DDE9A",
"D83DDE9B","D83DDE9C","D83DDEB2","D83CDFCE","D83CDFCD","D83DDE8F","D83DDEE3","D83DDEE4","26FD","D83DDEA8","D83DDEA5","D83DDEA6","D83DDEA7","2693",
"26F5","D83DDEA4","D83DDEF3","26F4","D83DDEE5","D83DDEA2","2708","D83DDEE9","D83DDEEB","D83DDEEC","D83DDCBA","D83DDE81","D83DDE9F","D83DDEA0","D83DDEA1",
"D83DDE80","D83DDEF0"
};
foreach (var x in tucktuck)
{
EmojisListBox5.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader5 = string.Join("", (from Match m in Regex.Matches("D83DDE97", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem5 = tabheader5;
#endregion
#region Bauten kunst
List<String> bauten = new List<string>
{
"D83CDFDF","D83CDFDB","D83CDFD7","D83CDFD8","D83CDFD9","D83CDFDA","D83CDFE0","D83CDFE1","D83CDFE2","D83CDFE3","D83CDFE4","D83CDFE5","D83CDFE6",
"D83CDFE8","D83CDFE9","D83CDFEA","D83CDFEB","D83CDFEC","D83CDFED","D83CDFEF","D83CDFF0","D83DDC92","D83DDDFC","D83DDDFD","26EA","26E9","26F2","26FA",
"D83CDF01","D83CDF03","D83CDF04","D83CDF05","D83CDF06","D83CDF07","D83CDF09","2668","D83CDF0C","D83CDFA0","D83CDFA1","D83CDFA2","D83DDC88","D83CDFAA",
"D83CDFAD","D83DDDBC","D83CDFA8","D83CDFB0",
};
foreach (var x in bauten)
{
EmojisListBox5.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Klingel Bett UhrZeit wetter
List<String> klingbett = new List<string>
{
"D83DDECE","D83DDEAA","D83DDECC","D83DDECF","D83DDECB","D83DDEBD","D83DDEBF","D83DDEC0","D83DDEC1","231B","23F3","231A","23F0","23F1","23F2","D83DDD70","D83DDD5B",
"D83DDD67","D83DDD50","D83DDD5C","D83DDD51","D83DDD5D","D83DDD52","D83DDD5E","D83DDD53","D83DDD5F","D83DDD54","D83DDD60","D83DDD55","D83DDD61","D83DDD56",
"D83DDD62","D83DDD57","D83DDD63","D83DDD58","D83DDD64","D83DDD59","D83DDD65","D83DDD5A","D83DDD66","D83CDF11","D83CDF12","D83CDF13","D83CDF14","D83CDF15",
"D83CDF16","D83CDF17","D83CDF18","D83CDF19","D83CDF1A","D83CDF1B","D83CDF1C","D83CDF21","2600","D83CDF1D","D83CDF1E","2B50","D83CDF1F","D83CDF20","2601",
"26C5","26C8","D83CDF24","D83CDF25","D83CDF26","D83CDF27","D83CDF28","D83CDF29","D83CDF2A","D83CDF2B","D83CDF2C","D83CDF00","D83CDF08","D83CDF02",
"2602","2614","26F1","26A1","2744","2603","26C4","2604","D83DDD25","D83DDCA7","D83CDF0A"
};
foreach (var x in klingbett)
{
EmojisListBox2.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Party
List<String> party = new List<string>
{
"D83CDF83","D83CDF84","D83CDF86","D83CDF87","2728","D83CDF88","D83CDF89","D83CDF8A","D83CDF8B","D83CDF8D","D83CDF8E","D83CDF8F","D83CDF90",
"D83CDF91","D83CDF80","D83CDF81","D83CDF97","D83CDF9F","D83CDFAB"
};
foreach (var x in party)
{
EmojisListBox1.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Sport
List<String> sport = new List<string>
{
"D83CDF96","D83CDFC6","D83CDFC5","26BD","26BE","D83CDFC0","D83CDFC8","D83CDFC9","D83CDFBE","D83CDFB1","D83CDFB3","D83CDFAF",
"26F3","26F8","D83CDFA3","D83CDFBD","D83CDFBF","D83CDFC7","26F7","D83CDFC2","D83CDFCC","D83CDFC4","D83DDEA3000A","D83CDFCA",
"26F9","D83CDFCB","D83DDEB4","D83DDEB5"
};
foreach (var x in sport)
{
EmojisListBox4.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader4 = string.Join("", (from Match m in Regex.Matches("26BD", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem4 = tabheader4;
#endregion
#region Gaming Sound technik
List<String> gaming = new List<string>
{
"D83CDFAE","D83DDD79","D83CDFB2","2660","2665","2666","2663","D83CDCCF","D83CDC04","D83CDFB4","D83DDD07","D83DDD08","D83DDD09","D83DDD0A","D83DDCE2",
"D83DDCE3","D83DDCEF","D83DDD14","D83DDD15","D83CDFBC","D83CDFB5","D83CDFB6","D83CDF99","D83CDF9A","D83CDF9B","D83CDFA4","D83CDFA7","D83DDCFB","D83CDFB7",
"D83CDFB8","D83CDFB9","D83CDFBA","D83CDFBB","D83DDCF1","D83DDCF2","260E","D83DDCDE","D83DDCDF","D83DDCE0","D83DDD0B","D83DDD0C","D83DDCBB","D83DDDA5",
"D83DDDA8","2328","D83DDDB1","D83DDDB2","D83DDCBD","D83DDCBE","D83DDCBF","D83DDCC0","D83CDFA5","D83CDF9E","D83DDCFD","D83CDFAC","D83DDCFA","D83DDCF7",
"D83DDCF8","D83DDCF9","D83DDCFC","D83DDD0D","D83DDD0E","D83DDD2C","D83DDD2D","D83DDCE1","D83DDD6F","D83DDCA1","D83DDD26","D83CDFEE"
};
foreach (var x in gaming)
{
EmojisListBox6.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
string tabheader6 = string.Join("", (from Match m in Regex.Matches("D83DDD79", @"\S{4}") select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray());
TabItem6 = tabheader6;
#endregion
#region Schule und so
List<String> schule = new List<string>
{
"D83DDCD4","D83DDCD5","D83DDCD6","D83DDCD7","D83DDCD8","D83DDCD9","D83DDCDA","D83DDCD3","D83DDCD2","D83DDCC3","D83DDCDC","D83DDCC4","D83DDCF0","D83DDDDE",
"D83DDCD1","D83DDD16","D83CDFF7","D83DDCB0","D83DDCB4","D83DDCB5","D83DDCB6","D83DDCB7","D83DDCB8","D83DDCB3","D83DDCB9","D83DDCB1","D83DDCB2","2709",
"D83DDCE7","D83DDCE8","D83DDCE9","D83DDCE4","D83DDCE5","D83DDCE6","D83DDCEB","D83DDCEA","D83DDCEC","D83DDCED","D83DDCEE","D83DDDF3","270F","2712","D83DDD8B",
"D83DDD8A","D83DDD8C","D83DDD8D","D83DDCDD","D83DDCBC","D83DDCC1","D83DDCC2","D83DDDC2","D83DDCC5","D83DDCC6","D83DDDD2","D83DDDD3","D83DDCC7","D83DDCC8",
"D83DDCC9","D83DDCCA","D83DDCCB","D83DDCCC","D83DDCCD","D83DDCCE","D83DDD87","D83DDCCF","D83DDCD0","2702","D83DDDC3","D83DDDC4","D83DDDD1","D83DDD12",
"D83DDD13","D83DDD0F","D83DDD10","D83DDD11","D83DDDDD"
};
foreach (var x in schule)
{
EmojisListBox6.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region waffen
List<String> waffen = new List<string>
{
"D83DDD28","26CF","2692","D83DDEE0","D83DDDE1","2694","D83DDD2B","D83DDEE1","D83DDD27","D83DDD29","2699","D83DDDDC","2697","2696","D83DDD17",
"26D3","D83DDC89","D83DDC8A","D83DDEAC","26B0","26B1","D83DDDFF","D83DDEE2","D83DDD2E"
};
foreach (var x in waffen)
{
EmojisListBox6.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
#region Schilder
List<String> schilder = new List<string>
{
"D83CDFE7","D83DDEAE","D83DDEB0","267F","D83DDEB9","D83DDEBA","D83DDEBB","D83DDEBC","D83DDEBE","D83DDEC2","D83DDEC3","D83DDEC4","D83DDEC5","26A0","D83DDEB8",
"26D4","D83DDEAB","D83DDEB3","D83DDEAD","D83DDEAF","D83DDEB1","D83DDEB7","D83DDCF5","D83DDD1E","2622","2623","2B06","2197","27A1","2198","2B07","2199","2B05",
"2196","2195","2194","21A9","21AA","2934","2935","D83DDD03","D83DDD04","D83DDD19","D83DDD1A","D83DDD1B","D83DDD1C","D83DDD1D","269B","D83DDD49","2721","2638",
"262F","271D","2626","262A","262E","D83DDD2F","267B","D83DDCDB","269C","D83DDD30","D83DDD31","2B55","2705","2611","2714","2716","274C","274E","2795","2796",
"2797","27B0","27BF","303D","2733","2734","2747","203C","2049","2753","2754","2755","2757 0009","3030","00A9","00AE","2122","2648","2649","264A","264B","264C",
"264D","264E","264F","2650","2651","2652","2653","26CE","D83DDD00","D83DDD01","D83DDD02","25B6","23E9","23ED","23EF","25C0","23EA","23EE","D83D DD3C","23EB",
"D83DDD3D","23EC","23F8","23F9","23FA","23CF","D83CDFA6","D83DDD05","D83DDD06","D83DDCF6","D83DDCF3","D83DDCF4","D83DDCAF","D83DDD20","D83DDD21",
"D83DDD22","D83DDD23","D83DDD24","D83CDD70","D83CDD8E","D83CDD71","D83CDD91","D83CDD92","D83CDD93","D83CDD94","24C2","D83CDD95","D83CDD96","D83CDD7E",
"D83CDD97","D83CDD7F","D83CDD98","D83CDD99","D83CDD9A","D83CDE01","D83CDE02","D83CDE37","D83CDE36","D83CDE2F" ,"D83CDE50","D83CDE39","D83CDE1A","D83CDE32",
"D83CDE51","D83CDE38","D83CDE34","D83CDE33","3297","3299","D83CDE3A","D83CDE35","25AA","25AB","25FB","25FC","25FD","25FE","2B1B","2B1C","D83DDD36","D83DDD37",
"D83DDD38","D83DDD39","D83DDD3A","D83DDD3B","D83DDCA0","D83DDD18","D83DDD32","D83DDD33","26AA","26AB","D83DDD34","D83DDD35","D83CDFC1","D83DDEA9","D83CDF8C",
"D83CDFF4","D83CDFF3"
};
foreach (var x in schilder)
{
EmojisListBox7.Add(new DirectoryListing("", string.Join("", (from Match m in Regex.Matches(x, @"\S{4}")
select (char)int.Parse(m.Value, NumberStyles.HexNumber)).ToArray())));
}
#endregion
}
}
public class DirectoryListing
{
public DirectoryListing(String pfad, String emojiCode)
{
Pfad = pfad;
EmojiCode = emojiCode;
}
public string Pfad { get; set; }
public string EmojiCode { get; set; }
}
}

View File

@@ -0,0 +1,298 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using ChatController.Klassen;
using Newtonsoft.Json;
namespace ChatController.HauptKlassen
{
public class Login
{
private string _url = "https://bewoplaner.beyondsoft.de/voucher_check.php";
private string _serverUrl = "";
private string _authToken = "";
private readonly string _benutzername;
private readonly string _passwort;
private readonly string _kundennummer;
private readonly string _chatCode;
private long? _userid;
private bool _verbindungsaufbauOK = false;
private bool _ownchatVerbindungsaufbauOK = false;
private bool _gruppeholenverbindungsaufbauOK = false;
private AuthentifizierungsDaten _serverconect;
private UserDaten _userconect;
private ChatGruppenDaten _groupconect;
public Login(string kundennummer, string chatCode,string benutzername,string passwort)
{
_kundennummer = kundennummer;
_chatCode = chatCode;
_benutzername = benutzername;
_passwort = passwort;
}
public ChatDatenUebergabe AnmeldevorgangDurchFuehren()
{
BaueEineVerbindungAuf();
if (_verbindungsaufbauOK)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("username", _benutzername);
dic.Add("password", _passwort);
VerbindeMitChatServer(dic);
}
// Gruppen abfragen
if (_ownchatVerbindungsaufbauOK)
{
GruppenHolen();
}
if (_gruppeholenverbindungsaufbauOK)
{
ChatDatenUebergabe ubergabe = new ChatDatenUebergabe(_serverconect, _userconect, _groupconect, _serverUrl, _authToken, _userid, _kundennummer);
return ubergabe;
}
return null;
}
//throw fehler anpassungen überall
private void BaueEineVerbindungAuf()
{
try
{
string endurl = _url + "?k=" + _kundennummer + "&Voucher=" + _chatCode;
WebRequest request = WebRequest.Create(endurl);
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response;
try
{
response = request.GetResponse();
}
catch (Exception e)
{
//throw fehler
// MessageBox.Show("Die Kundennummer oder der Chatcode ist falsch.\nOder Beides!", "Fehler", MessageBoxButton.OK);
return;
}
// Display the status.
var statusResponse = ((HttpWebResponse)response).StatusDescription;
string responseFromServer = ReadStream(response);
if (!responseFromServer.Equals(""))
{
//_voucherCheckOk = true;
//################# Deserialisierung mit Json ###############################
var jsonDaten = JsonConvert.DeserializeObject<Dictionary<string, AuthentifizierungsDaten>>(responseFromServer);
var serv = jsonDaten[_chatCode].ServerName;
//#################################################################################
_serverUrl = serv;
_serverconect = jsonDaten[_chatCode];
_verbindungsaufbauOK = true;
}
else
{
//throw fehler
//MessageBox.Show("Die Kundennummer oder der Chatcode ist falsch.\nOder Beides!", "Fehler", MessageBoxButton.OK);
}
response.Close();
}
catch (Exception e)
{
//thorw fehler
//MessageBox.Show("Es konnte keine Verbindung aufgebaut werden.", "Fehler", MessageBoxButton.OK);
}
}
private void VerbindeMitChatServer(Dictionary<string, string> postparameter)
{
try
{
var endurl = _serverUrl + "/api/user/login";
string postdaten = "";
int i = 0;
foreach (var key in postparameter.Keys)
{
postdaten += HttpUtility.UrlEncode(key) + "=" + HttpUtility.UrlEncode(postparameter[key]) + "&";
}
WebRequest requesten = WebRequest.Create(endurl);
requesten.Method = "POST";
requesten.ContentType = "application/x-www-form-urlencoded";
requesten.Headers["CustomerID"] = _kundennummer;
byte[] daten = Encoding.ASCII.GetBytes(postdaten);
requesten.ContentLength = daten.Length;
Stream requestStream = requesten.GetRequestStream();
requestStream.Write(daten, 0, daten.Length);
requestStream.Close();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)requesten.GetResponse();
Stream responseStream = myHttpWebResponse.GetResponseStream();
StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);
string pageContent = myStreamReader.ReadToEnd();
//Baue pagekontent in Json um
if (!pageContent.Equals(""))
{
//_serverCheckOK = true;
//string[] array = responseFromServer.Split(':');
//Json Verarbeitungsgedöns Dictionary < string, TestKlasse>
var jsonDaten = JsonConvert.DeserializeObject<UserDaten>(pageContent);
//var serv = jsonDaten[_chatcode].ServerName;
foreach (var datev in jsonDaten.Response)
{
_authToken = datev.Value.Token;
_userid = datev.Value.Oid;
}
_userconect = jsonDaten;
_ownchatVerbindungsaufbauOK = true;
}
else
{
//throw fehler
// MessageBox.Show("Keine Daten Vorhanden.");
}
// MessageBox.Show(pageContent);
myStreamReader.Close();
responseStream.Close();
}
catch (WebException e)
{
//throw fehler
//MessageBox.Show(e.Message, "Fehler", MessageBoxButton.OK);
}
}
private void GruppenHolen()
{
try
{
var endurl = _serverUrl + "/api/chat/groups";
WebRequest request = WebRequest.Create(endurl);
request.Credentials = CredentialCache.DefaultCredentials;
request.Headers["Token"] = _authToken;
request.Headers["CustomerID"] = _kundennummer;
// Get the response.
WebResponse response = request.GetResponse();
// Display the status.
var statusResponse = ((HttpWebResponse)response).StatusDescription;
string responseFromServer = ReadStream(response);
//verarbeite hier zu json
if (!responseFromServer.Equals(""))
{
//################# Deserialisierung mit Json ###############################
var jsonDaten = JsonConvert.DeserializeObject<ChatGruppenDaten>(responseFromServer);
_groupconect = jsonDaten;
// var serv = jsonDaten[_chatcode].ServerName;
//MessageBox.Show(responseFromServer);
_gruppeholenverbindungsaufbauOK = true;
}
else
{
// MessageBox.Show("Keine Daten Vorhanden.");
}
response.Close();
}
catch (Exception e)
{
// MessageBox.Show(e.Message, "Fehler", MessageBoxButton.OK);
}
}
private string ReadStream(WebResponse response)
{
try
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
dataStream.Dispose();
reader.Dispose();
dataStream.Close();
reader.Close();
return responseFromServer;
}
catch (Exception e)
{
// MessageBox.Show(e.Message);
return null;
}
}
}
}

View File

@@ -0,0 +1,69 @@
<UserControl x:Class="ChatController.LoginControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ChatController"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.Background>
<ImageBrush>
<ImageBrush.ImageSource>
<BitmapImage UriSource="Ressourcen/BeyondsoftChat.jpg" />
</ImageBrush.ImageSource>
</ImageBrush>
</Grid.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="0" Header="Login" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="GroupBoxLogin">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="20"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Margin="3">Kundennummer:</Label>
<TextBox x:Name="TextBoxKundennummer" Grid.Column="1" Grid.Row="0" Margin="3" VerticalContentAlignment="Center"/>
<Label Grid.Column="0" Grid.Row="1" Margin="3">ChatCode:</Label>
<TextBox x:Name="TextBoxChatCode" Grid.Column="1" Grid.Row="1" Margin="3" VerticalContentAlignment="Center"/>
<Label Grid.Column="0" Grid.Row="2" Margin="3">Benutzername:</Label>
<TextBox x:Name="TextBoxBenutzerName" Grid.Column="1" Grid.Row="2" Margin="3" VerticalContentAlignment="Center" />
<Label Grid.Column="0" Grid.Row="3" Margin="3">Passwort:</Label>
<PasswordBox x:Name="TextBoxPasswort" Grid.Column="1" Grid.Row="3" Margin="3" VerticalContentAlignment="Center"/>
<CheckBox x:Name="Merken" Margin="3" Content="Passwort Speichern" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4"/>
<Button Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="5" Click="AnmeldenButton_OnClick" Content="Anmelden" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="3" Width="80" Background="#ff5e00" HorizontalContentAlignment="Center" >
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="1,1,1,1" />
</Style>
</Button.Resources>
</Button>
</Grid>
</GroupBox>
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,176 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ChatController.HauptKlassen;
using ChatController.Klassen;
namespace ChatController
{
/// <summary>
/// Interaktionslogik für Login.xaml
/// </summary>
public partial class LoginControl : UserControl
{
public delegate void LoginDelegate(ChatDatenUebergabe cdu);
public event LoginDelegate OnLogin;
private string _dateiPfad = "ChatAnmeldeDaten.txt";
public LoginControl()
{
InitializeComponent();
LeseDateiFallsVorhanden();
}
private void AnmeldenButton_OnClick(object sender, RoutedEventArgs e)
{
#if DEBUG
Cursor = Cursors.Wait;
Login _login = new Login("4368658435", "ZMCKb-BckTt", "RuppelW", "ABXT32wgtruppeldiedup");
var x = _login.AnmeldevorgangDurchFuehren();
if (OnLogin != null)
{
if (Merken.IsChecked == true)
{
SpeichereDatenInDatei();
}
else
{
LoescheGespeicherteDatei();
}
OnLogin(x);
}
Cursor = Cursors.Arrow;
#else
if (!TextBoxKundennummer.Text.Equals("") && !TextBoxChatCode.Text.Equals("") &&
!TextBoxBenutzerName.Text.Equals("") && !TextBoxPasswort.Password.Equals(""))
{
Cursor = Cursors.Wait;
Login _login = new Login(TextBoxKundennummer.Text, TextBoxChatCode.Text, TextBoxBenutzerName.Text, TextBoxPasswort.Password);
var x = _login.AnmeldevorgangDurchFuehren();
if (OnLogin != null && x != null)
{
if (Merken.IsChecked == true)
{
SpeichereDatenInDatei();
}
else
{
LoescheGespeicherteDatei();
}
OnLogin(x);
}
else
{
MessageBox.Show("Die AnmeldeDaten sind Falsch!", "Info", MessageBoxButton.OK);
}
Cursor = Cursors.Arrow;
}
else
{
MessageBox.Show("Bitte alle Felder ausfüllen!", "Info", MessageBoxButton.OK);
}
#endif
}
#region Speichern / Laden / Löschen der Datei
private void LeseDateiFallsVorhanden()
{
try
{
if (File.Exists(_dateiPfad)) {
List<string> daten = new List<string>();
using (StreamReader sr = new StreamReader(_dateiPfad))
{
string line = "";
while ((line = sr.ReadLine()) != null)
{
daten.Add(line);
}
}
if(daten.Count == 5) {
TextBoxKundennummer.Text = daten[0];
TextBoxChatCode.Text = daten[1];
TextBoxBenutzerName.Text = daten[2];
TextBoxPasswort.Password = daten[3];
Merken.IsChecked = Convert.ToBoolean(daten[4]);
}
}
}
catch (Exception e)
{
}
}
private void SpeichereDatenInDatei()
{
try
{
// Write each directory name to a file.
using (StreamWriter sw = new StreamWriter(_dateiPfad))
{
sw.WriteLine( TextBoxKundennummer.Text);
sw.WriteLine(TextBoxChatCode.Text);
sw.WriteLine(TextBoxBenutzerName.Text);
sw.WriteLine(TextBoxPasswort.Password);
sw.WriteLine(Merken.IsChecked.ToString());
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
private void LoescheGespeicherteDatei()
{
try
{
if (File.Exists(_dateiPfad))
{
File.Delete(_dateiPfad);
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
#endregion
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.Klassen
{
public class AuthentifizierungsDaten
{
public string CustomerId { get; set; }
public string ServerName { get; set; }
}
}

View File

@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.Klassen
{
public class ChatDatenUebergabe
{
private AuthentifizierungsDaten _serverconect { get; set; }
private UserDaten _userconect { get; set; }
private ChatGruppenDaten _groupconect { get; set; }
private string _serverUrl { get; set; }
private string _authToken { get; set; }
private long? _userid { get; set; }
private string _kundennummer { get; set; }
public ChatDatenUebergabe(AuthentifizierungsDaten serverConect, UserDaten userConect, ChatGruppenDaten groupConect, string serverUrl, string authToken, long? userid, string kundennummer)
{
_serverconect = serverConect;
_userconect = userConect;
_groupconect = groupConect;
_serverUrl = serverUrl;
_authToken = authToken;
_userid = userid;
_kundennummer = kundennummer;
}
public AuthentifizierungsDaten Serverconect
{
get
{
return _serverconect;
}
private set
{
_serverconect = value;
}
}
public UserDaten Userconect
{
get
{
return _userconect;
}
private set
{
_userconect = value;
}
}
public ChatGruppenDaten Groupconect
{
get
{
return _groupconect;
}
private set
{
_groupconect = value;
}
}
public string ServerUrl
{
get
{
return _serverUrl;
}
private set
{
_serverUrl = value;
}
}
public string AuthToken
{
get
{
return _authToken;
}
private set
{
_authToken = value;
}
}
public long? Userid
{
get
{
return _userid;
}
private set
{
_userid = value;
}
}
public string Kundennummer
{
get
{
return _kundennummer;
}
private set
{
_kundennummer = value;
}
}
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.Klassen
{
public class ChatGruppenDaten
{
public Dictionary<string, GroupInput[]> Response { get; set; }
public string Message { get; set; }
public string Errors { get; set; }
public bool Success { get; set; }
}
public class GroupInput
{
public long Oid { get; set; }
public string Name { get; set; }
public string Avatar { get; set; }
public string Mobile { get; set; }
public GroupLastMessage LastMessage { get; set; }
public GroupUsers[] Users { get; set; }
}
public class GroupLastMessage
{
public long Id { get; set; }
public string Text { get; set; }
public string File { get; set; }
public string OriginalFileName { get; set; }
public string SmallerImage { get; set; }
public LastMessageTimeStamp Timestamp { get; set; }
public long CreatedAt { get; set; }
public long UserId { get; set; }
public string UserName { get; set; }
public string UserPicture { get; set; }
public string GroupId { get; set; }
}
public class GroupUsers
{
public long Oid { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public string Mobile { get; set; }
public string Picture { get; set; }
public bool IsEmployee { get; set; }
}
public class LastMessageTimeStamp
{
public string Date { get; set; }
public int TimezoneType { get; set; }
public string Timezone { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.Klassen
{
public class UserDaten
{
public Dictionary<string, TestInput> Response { get; set; }
public string Message { get; set; }
public string Errors { get; set; }
public bool Success { get; set; }
}
public class InputTest
{
public TestInput User { get; set; }
}
public class TestInput
{
public long? Oid { get; set; }
public string UserId { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public string Mobile { get; set; }
public string Picture { get; set; }
public bool Is_Employee { get; set; }
public string Token { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChatController.Klassen
{
class UserMessages
{
public UserMessageInput Response { get; set; }
public string Message { get; set; }
public string Errors { get; set; }
public bool Success { get; set; }
}
public class UserMessageInput
{
public string currentPage { get; set; }
public bool HasMorePages { get; set; }
public string NextPage { get; set; }
public int PerPage { get; set; }
public string PreviousPage { get; set; }
public Messages[] Messages { get; set; }
}
public class Messages
{
public long Id { get; set; }
public string Text { get; set; }
public string File { get; set; }
public string Original_Filename { get; set; }
public string Smaller_Images { get; set; }
public LastMessageTimeStamp Timestamp { get; set; }
public long CreatetdAt { get; set; }
public long UserId { get; set; }
public string User_Name { get; set; }
public string UserPicture { get; set; }
public long GroupId { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("ChatController")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ChatController")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("8a83c4dc-a0b1-4a51-ae1d-366d7a05b298")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

6
PrototypChat/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
</configuration>

9
PrototypChat/App.xaml Normal file
View File

@@ -0,0 +1,9 @@
<Application x:Class="PrototypChat.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PrototypChat"
StartupUri="LoginMaske.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
PrototypChat/App.xaml.cs Normal file
View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace PrototypChat
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{
}
}

View File

@@ -0,0 +1,17 @@
<Window x:Class="PrototypChat.ChatEmojisView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PrototypChat"
xmlns:hauptKlassen="clr-namespace:ChatController.HauptKlassen;assembly=ChatController"
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
mc:Ignorable="d"
Title="ChatEmojisView" x:Name="ChatEmojiView"
Height="150" Width="300" WindowStartupLocation="Manual" WindowStyle="None" Deactivated="ChatEmojisView_OnFocusableChanged">
<Grid>
<cc:ChatEmojiiControl x:Name="cem" ></cc:ChatEmojiiControl>
</Grid>
</Window>

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using ChatController;
using ChatController.HauptKlassen;
namespace PrototypChat
{
/// <summary>
/// Interaktionslogik für ChatEmojisView.xaml
/// </summary>
public partial class ChatEmojisView
{
private ChatEmoji _emojii;
public ChatEmojisView(ChatMainControl chatMainControler)
{
InitializeComponent();
cem.InitChatView(chatMainControler);
}
private void ChatEmojisView_OnFocusableChanged(object sender, EventArgs e)
{
if (ChatEmojiView.Visibility == Visibility.Visible)
{
ChatEmojiView.Visibility = Visibility.Collapsed;
}
}
}
}

View File

@@ -0,0 +1,16 @@
<Window x:Class="PrototypChat.LoginMaske"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PrototypChat"
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
mc:Ignorable="d" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
Title="Bewoplaner Mobil Beta" Height="500" Width="700" >
<Grid>
<cc:LoginControl OnLogin="LoginControl_OnOnLogin"></cc:LoginControl>
</Grid>
</Window>

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ChatController.HauptKlassen;
using ChatController.Klassen;
using Newtonsoft.Json;
namespace PrototypChat
{
/// <summary>
/// Interaktionslogik für LoginMaske.xaml
/// </summary>
public partial class LoginMaske : Window
{
public LoginMaske()
{
InitializeComponent();
}
private void LoginControl_OnOnLogin(ChatDatenUebergabe cdu)
{
MainWindow window = new MainWindow(cdu);
window.Show();
Close();
}
}
}

View File

@@ -0,0 +1,16 @@
<Window x:Class="PrototypChat.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PrototypChat"
xmlns:cc="clr-namespace:ChatController;assembly=ChatController"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="Bewo Chat Applikation" Height="700" Width="900" x:Name="MainView">
<Grid>
<cc:ChatMainControl x:Name="ChatMainControl" OnEmojii="ChatMainControl_OnOnEmojii" ></cc:ChatMainControl>
</Grid>
</Window>

View File

@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using ChatController;
using ChatController.ChatKlassen;
using ChatController.HauptKlassen;
using ChatController.Klassen;
using Brush = System.Windows.Media.Brush;
using Button = System.Windows.Forms.Button;
using ContextMenu = System.Windows.Controls.ContextMenu;
using Image = System.Windows.Controls.Image;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using MenuItem = System.Windows.Controls.MenuItem;
using MessageBox = System.Windows.MessageBox;
using Path = System.IO.Path;
using Point = System.Windows.Point;
namespace PrototypChat
{
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private readonly Chat _chat;
private AktuellerKontakt _aktuellerKontakt;
private bool isChatBoxOnFocus = false;
private ChatEmojisView _emojiView;
private IOrderedEnumerable<KontaktMessageBuilder> _Orderedmessagelist;
private IOrderedEnumerable<KontaktlistBuilder> _kontaktlist;
private readonly List<KontaktMessageBuilder> _messagelist = new List<KontaktMessageBuilder>();
private Thread _sendt;
private Thread _erhaltent;
public MainWindow(ChatDatenUebergabe x)
{
InitializeComponent();
ChatMainControl.InitMitChatdaten(x);
//ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem);
}
private void ChatMainControl_OnOnEmojii(System.Windows.Controls.Button emojiButton)
{
if (_emojiView == null) {
_emojiView = new ChatEmojisView(ChatMainControl);
var x = emojiButton.PointToScreen(new Point(0, 0));
PresentationSource source = PresentationSource.FromVisual(emojiButton);
_emojiView.Top = (x.Y / source.CompositionTarget.TransformToDevice.M22) - _emojiView.Height - 5;
_emojiView.Left = x.X / source.CompositionTarget.TransformToDevice.M11;
_emojiView.Show();
}
else
{
if (_emojiView.Visibility == Visibility.Visible)
{
_emojiView.Visibility = Visibility.Collapsed;
}
else
{
_emojiView.Visibility = Visibility.Visible;
var x = emojiButton.PointToScreen(new Point(0, 0));
PresentationSource source = PresentationSource.FromVisual(emojiButton);
_emojiView.Top = (x.Y / source.CompositionTarget.TransformToDevice.M22) - _emojiView.Height - 5;
_emojiView.Left = x.X / source.CompositionTarget.TransformToDevice.M11;
}
}
}
//private void ChatMainControl_OnClickContextMenuItem(String menuItem)
//{
//}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("PrototypChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PrototypChat")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
//<UICulture>ImCodeVerwendeteKultur</UICulture> in der .csproj-Datei
//in einer <PropertyGroup> fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
//(Deutschland) verwenden, legen Sie <UICulture> auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
// oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
// designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
)]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion: 4.0.30319.42000
//
// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
// der Code neu generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PrototypChat.Properties
{
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
// über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrototypChat.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PrototypChat.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A9A69B34-2CEE-411F-8CD3-507DC6A5B77E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PrototypChat</RootNamespace>
<AssemblyName>PrototypChat</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\Desktop\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ChatEmojisView.xaml.cs">
<DependentUpon>ChatEmojisView.xaml</DependentUpon>
</Compile>
<Page Include="ChatEmojisView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LoginMaske.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="LoginMaske.xaml.cs">
<DependentUpon>LoginMaske.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ChatController\ChatController.csproj">
<Project>{8a83c4dc-a0b1-4a51-ae1d-366d7a05b298}</Project>
<Name>ChatController</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrototypChat", "PrototypChat.csproj", "{A9A69B34-2CEE-411F-8CD3-507DC6A5B77E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatController", "..\ChatController\ChatController.csproj", "{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A9A69B34-2CEE-411F-8CD3-507DC6A5B77E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9A69B34-2CEE-411F-8CD3-507DC6A5B77E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9A69B34-2CEE-411F-8CD3-507DC6A5B77E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9A69B34-2CEE-411F-8CD3-507DC6A5B77E}.Release|Any CPU.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal