Merge branch 'master' of ssh://float.beyondsoft.de/git/beyondSoft/Chat
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/ChatController/bin
|
||||||
|
/ChatController/obj
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json">
|
<Reference Include="Newtonsoft.Json">
|
||||||
<HintPath>..\..\..\..\..\Desktop\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\libs\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ namespace ChatController.ChatKlassen
|
|||||||
{
|
{
|
||||||
public class KontaktMessageBuilder
|
public class KontaktMessageBuilder
|
||||||
{
|
{
|
||||||
//kram für Die Dokumentation erstellen zb. MessagePersonOid
|
//Chat Ansicht
|
||||||
|
|
||||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, DateTime convertedSendTimeString)
|
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, DateTime convertedSendTimeString)
|
||||||
{
|
{
|
||||||
Username = username;
|
Username = username;
|
||||||
@@ -39,6 +38,7 @@ namespace ChatController.ChatKlassen
|
|||||||
_gifPictureVisibility = Visibility.Collapsed;
|
_gifPictureVisibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IMage Ansicht
|
||||||
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, ImageSource image, DateTime convertedSendTimeString)
|
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, ImageSource image, DateTime convertedSendTimeString)
|
||||||
{
|
{
|
||||||
Username = username;
|
Username = username;
|
||||||
@@ -47,6 +47,8 @@ namespace ChatController.ChatKlassen
|
|||||||
ImageSources = image;
|
ImageSources = image;
|
||||||
ConvertetSendtimeString = convertedSendTimeString;
|
ConvertetSendtimeString = convertedSendTimeString;
|
||||||
|
|
||||||
|
// Dokpfad =
|
||||||
|
|
||||||
if (isme)
|
if (isme)
|
||||||
{
|
{
|
||||||
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||||
@@ -77,6 +79,35 @@ namespace ChatController.ChatKlassen
|
|||||||
_herunterladen = Visibility.Collapsed;
|
_herunterladen = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Dokument Ansicht
|
||||||
|
public KontaktMessageBuilder(string username, string message, string sendtime, bool isme, string url, DateTime convertedSendTimeString)
|
||||||
|
{
|
||||||
|
Username = username;
|
||||||
|
UserMessage = message;
|
||||||
|
SendTime = sendtime;
|
||||||
|
ConvertetSendtimeString = convertedSendTimeString;
|
||||||
|
|
||||||
|
Dokpfad = (object) url;
|
||||||
|
|
||||||
|
if (isme)
|
||||||
|
{
|
||||||
|
ChatColor = new BrushConverter().ConvertFromString("#ff5e00") as SolidColorBrush;
|
||||||
|
Posi = "Right";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChatColor = new BrushConverter().ConvertFromString("#cccccc") as SolidColorBrush;
|
||||||
|
Posi = "Left";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DokumentVisibility = Visibility.Visible;
|
||||||
|
|
||||||
|
_pictureVisibility = Visibility.Collapsed;
|
||||||
|
ChatVisibility = Visibility.Collapsed;
|
||||||
|
SoundVisibility = Visibility.Collapsed;
|
||||||
|
_herunterladen = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region kram der sortiert werden muss
|
#region kram der sortiert werden muss
|
||||||
|
|||||||
@@ -40,15 +40,15 @@
|
|||||||
<ColumnDefinition Width="10*"/>
|
<ColumnDefinition Width="10*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left" Visibility="Collapsed">
|
<!--<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left" Visibility="Collapsed">
|
||||||
<Label Content="Mein Status: " MaxWidth="80"/>
|
<Label Content="Mein Status: " MaxWidth="80"/>
|
||||||
<RadioButton GroupName="status" x:Name="RadioButtonOnline" BorderBrush="Green" MaxWidth="15" ToolTip="Online" VerticalAlignment="Center" Foreground="Green"/>
|
<RadioButton GroupName="status" x:Name="RadioButtonOnline" BorderBrush="Green" MaxWidth="15" ToolTip="Online" VerticalAlignment="Center" Foreground="Green"/>
|
||||||
<!--Checked="ComboBox_SelectionChanged"-->
|
//Checked="ComboBox_SelectionChanged"
|
||||||
<RadioButton GroupName="status" x:Name="RadioButtonOffline" BorderBrush="Red" MaxWidth="15" ToolTip="Offline" VerticalAlignment="Center" Foreground="Red"/>
|
<RadioButton GroupName="status" x:Name="RadioButtonOffline" BorderBrush="Red" MaxWidth="15" ToolTip="Offline" VerticalAlignment="Center" Foreground="Red"/>
|
||||||
<!--Checked="ComboBox_SelectionChanged"-->
|
//Checked="ComboBox_SelectionChanged"
|
||||||
<RadioButton GroupName="status" x:Name="RadioButtonBeschaeftigt" BorderBrush="DarkOrange" MaxWidth="15" ToolTip="Beschäftigt" VerticalAlignment="Center" Foreground="DarkOrange"/>
|
<RadioButton GroupName="status" x:Name="RadioButtonBeschaeftigt" BorderBrush="DarkOrange" MaxWidth="15" ToolTip="Beschäftigt" VerticalAlignment="Center" Foreground="DarkOrange"/>
|
||||||
<!--Checked="ComboBox_SelectionChanged"-->
|
//Checked="ComboBox_SelectionChanged"
|
||||||
</StackPanel>
|
</StackPanel> -->
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="0" MaxWidth="20" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Collapsed">
|
<StackPanel Grid.Row="0" MaxWidth="20" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Bottom" Visibility="Collapsed">
|
||||||
@@ -70,23 +70,6 @@
|
|||||||
</TextBox.Resources>
|
</TextBox.Resources>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<!-- </GroupBox> -->
|
<!-- </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>
|
||||||
|
|
||||||
|
|
||||||
@@ -96,11 +79,10 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="10*"/>
|
<ColumnDefinition Width="10*"/>
|
||||||
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<!--###################################### Liste aller User mit Chat Berechtigung mit prozentsatz groeße setzenb###################################################### -->
|
|
||||||
|
<!--###################################### Liste aller User ###################################################### -->
|
||||||
<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" >
|
<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>
|
<ListView.Resources>
|
||||||
<DataTemplate x:Key="DataTemplate1">
|
<DataTemplate x:Key="DataTemplate1">
|
||||||
<Grid Margin="7,0,0,0" x:Name="GridMargin">
|
<Grid Margin="7,0,0,0" x:Name="GridMargin">
|
||||||
@@ -210,8 +192,7 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
|
||||||
<ListBox x:Name="AktChatUser" HorizontalAlignment="Left" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
|
<ListBox x:Name="AktChatUser" HorizontalAlignment="Left" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" VerticalAlignment="Bottom" ItemTemplate="{DynamicResource DataTemplate2}" MouseDoubleClick="AktChatUser_OnMouseDoubleClick" >
|
||||||
<!---->
|
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<DataTemplate x:Key="DataTemplate2">
|
<DataTemplate x:Key="DataTemplate2">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -222,17 +203,15 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="10*" />
|
<RowDefinition Height="10*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<!-- <Border Margin="5" BorderBrush="DarkGray" BorderThickness="1"> -->
|
|
||||||
<Ellipse Width='30' Height='30' VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
|
<Ellipse Width='30' Height='30' VerticalAlignment="Center" RenderOptions.BitmapScalingMode="HighQuality">
|
||||||
<Ellipse.Fill >
|
<Ellipse.Fill >
|
||||||
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill'/>
|
<ImageBrush ImageSource='{Binding Image}' Stretch='Fill'/>
|
||||||
</Ellipse.Fill>
|
</Ellipse.Fill>
|
||||||
</Ellipse>
|
</Ellipse>
|
||||||
<!-- <Image Source="{Binding Path=Image}" Stretch="Fill" Width="30" Height="30" />-->
|
|
||||||
<!-- </Border> -->
|
|
||||||
<StackPanel Grid.Column="1" Margin="5" VerticalAlignment="Center">
|
<StackPanel Grid.Column="1" Margin="5" VerticalAlignment="Center">
|
||||||
<StackPanel Orientation="Horizontal" TextBlock.FontWeight="Bold" >
|
<StackPanel Orientation="Horizontal" TextBlock.FontWeight="Bold" >
|
||||||
|
|
||||||
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" />
|
<TextBlock Text="{Binding Path=Name, FallbackValue=FirstName}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
|
<!-- <TextBlock Text="{Binding Path=StatusTyp, FallbackValue=Message}" />-->
|
||||||
@@ -242,45 +221,9 @@
|
|||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
</ListBox>
|
</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" >
|
<ListBox x:Name="Chat" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False" VerticalAlignment="Stretch" Margin="3" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True"
|
||||||
<Image x:Name="AlarmLabel" ToolTip="Zurzeit nicht Verbunden" Source="" />
|
VirtualizingStackPanel.VirtualizationMode="Recycling" SelectionMode="Extended" MouseDoubleClick="Chat_OnMouseDoubleClick" ScrollViewer.ScrollChanged="Chat_OnScrollChanged"
|
||||||
</Button>
|
ContextMenuOpening="Chat_OnContextMenuOpening">
|
||||||
|
|
||||||
<!--####################### 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"-->
|
<!--MouseRightButtonDown="OnRightClickEvent"-->
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
@@ -296,40 +239,16 @@
|
|||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel>
|
<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}" >
|
<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}" >
|
<DockPanel MinHeight="15" Margin="5" LastChildFill="True" Background="{Binding ChatColor}" Visibility="{Binding MainVisibility}" >
|
||||||
|
|
||||||
|
<!-- Message Bereich -->
|
||||||
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ChatVisibility}" >
|
<StackPanel DockPanel.Dock="Bottom" Visibility="{Binding ChatVisibility}" >
|
||||||
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" />
|
<TextBlock VerticalAlignment="Center" Text="{Binding UserMessage}" MinWidth="0" MaxWidth="500" TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</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-->
|
<!-- Bild bereich-->
|
||||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" >
|
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding PictureVisibility}" >
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
@@ -356,13 +275,16 @@
|
|||||||
|
|
||||||
<!--Dokument bereich -->
|
<!--Dokument bereich -->
|
||||||
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
|
<DockPanel DockPanel.Dock="Bottom" Visibility="{Binding DokumentVisibility}" >
|
||||||
<Button HorizontalAlignment="Center" VerticalAlignment="Center" Height="25" Width="25" Tag="{Binding Dokpfad}" >
|
<StackPanel Orientation="Vertical">
|
||||||
<!--Click="OpenDokument_OnClick"-->
|
<Image ToolTip="Dokument öffnen" Height="100" Width="150" Source="/BeWoPlaner;component/Ressources/Icons/ClipboardDisabled.png" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
<Image ToolTip="Dokument öffnen" Source="/BeWoPlaner;component/Ressources/Icons/ClipboardDisabled.png" Stretch="Uniform" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
<Button HorizontalAlignment="Center" VerticalAlignment="Center" Content="Dokument Anzeigen" Height="25" Tag="{Binding Dokpfad}" Click="OpenDokument_OnClick " />
|
||||||
</Button>
|
</StackPanel>
|
||||||
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}"/>
|
<!--
|
||||||
|
<TextBlock Margin="2,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding UserMessage}"/>-->
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
|
<StackPanel DockPanel.Dock="Left" Margin="0,0,0,5" >
|
||||||
<TextBlock Text="{Binding Username}" FontWeight="Bold" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center"/>
|
<TextBlock Text="{Binding Username}" FontWeight="Bold" MaxWidth="150" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -406,7 +328,7 @@
|
|||||||
</TextBox.Resources>
|
</TextBox.Resources>
|
||||||
</TextBox>
|
</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">
|
<Button Grid.Column="1" Style="{x:Null}" Height="25" Width="25" Background="Transparent" BorderThickness="0" Margin="1,0,0,0" VerticalAlignment="Bottom" ToolTip="Datei einfügen" Click="MediaButton_OnClick">
|
||||||
<Image Height="15" Width="15" Source='Ressourcen/paperclip.png' Margin="3" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Right"/>
|
<Image Height="15" Width="15" Source='Ressourcen/paperclip.png' Margin="3" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Right"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -429,12 +351,5 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -18,6 +21,7 @@ using System.Windows.Threading;
|
|||||||
using ChatController.ChatKlassen;
|
using ChatController.ChatKlassen;
|
||||||
using ChatController.HauptKlassen;
|
using ChatController.HauptKlassen;
|
||||||
using ChatController.Klassen;
|
using ChatController.Klassen;
|
||||||
|
using Path = System.IO.Path;
|
||||||
|
|
||||||
namespace ChatController
|
namespace ChatController
|
||||||
{
|
{
|
||||||
@@ -53,6 +57,7 @@ namespace ChatController
|
|||||||
|
|
||||||
|
|
||||||
private Dictionary<String, Action<string>> menuItemName2Callback = new Dictionary<string, Action<string>>();
|
private Dictionary<String, Action<string>> menuItemName2Callback = new Dictionary<string, Action<string>>();
|
||||||
|
|
||||||
public ChatMainControl()
|
public ChatMainControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -66,11 +71,9 @@ namespace ChatController
|
|||||||
_kontaktlist = _chat.GroupklassenInChatKontakteUmwandler();
|
_kontaktlist = _chat.GroupklassenInChatKontakteUmwandler();
|
||||||
|
|
||||||
Clientlist.ItemsSource = _kontaktlist;
|
Clientlist.ItemsSource = _kontaktlist;
|
||||||
|
|
||||||
//Neu
|
|
||||||
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
|
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(Clientlist.ItemsSource);
|
||||||
view.Filter = UserFilter;
|
view.Filter = UserFilter;
|
||||||
//NEu
|
|
||||||
|
|
||||||
HorcheAlleGruppenNachrichten();
|
HorcheAlleGruppenNachrichten();
|
||||||
}
|
}
|
||||||
@@ -163,6 +166,7 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ab Hier Kontext Menü
|
||||||
private void SetContextHandler()
|
private void SetContextHandler()
|
||||||
{
|
{
|
||||||
var contextItems = Chat.ContextMenu.Items;
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
@@ -188,25 +192,9 @@ namespace ChatController
|
|||||||
item3.Click += Item3OnClick;
|
item3.Click += Item3OnClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public delegate void ContextDelegate();
|
public delegate void ContextDelegate();
|
||||||
|
|
||||||
public event ContextDelegate CreateNewContextItems;
|
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)
|
private void Item2OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||||
{
|
{
|
||||||
@@ -220,22 +208,118 @@ namespace ChatController
|
|||||||
|
|
||||||
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
|
private void Item3OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||||
{
|
{
|
||||||
// _chat.Einfuegen();
|
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||||
|
_chat.Einfuegen(kontakt.GroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Bug Wegen Klient und so
|
||||||
|
private void Chat_OnContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||||
|
{
|
||||||
|
//prüfe ob ein Bild angeclickt wurde
|
||||||
|
var chatItems = Chat.SelectedItems;
|
||||||
|
|
||||||
|
if (chatItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var items in chatItems)
|
||||||
|
{
|
||||||
|
var item = items as KontaktMessageBuilder;
|
||||||
|
if (item != null && item.ImageSources != null)
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[0];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[0];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Schalte speichern unter Aus
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[0];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//prüfe ob was in dem Speicher vorhanden ist //Einfügen
|
||||||
|
var d = System.Windows.Forms.Clipboard.GetDataObject();
|
||||||
|
|
||||||
|
if (d.GetDataPresent(DataFormats.FileDrop) )
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else if (d.GetDataPresent(DataFormats.Text))
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else if (d.GetDataPresent(DataFormats.Bitmap))
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[1];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Bug prüfe ob der aktulle Chat partner ein Klient ist
|
||||||
|
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
||||||
|
if (true && Chat.ContextMenu.Items.Count > 2)
|
||||||
|
{
|
||||||
|
var contextItems = Chat.ContextMenu.Items;
|
||||||
|
var ContextItemSpeichernUnter = (MenuItem)contextItems[2];
|
||||||
|
ContextItemSpeichernUnter.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Chat.ContextMenu.Items.Count == 0)
|
||||||
|
{
|
||||||
|
Chat.ContextMenu.Visibility =Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddContextMenu(string menuItemText, Action<string> callBackAction)
|
||||||
|
{
|
||||||
|
if (!menuItemName2Callback.ContainsKey(menuItemText))
|
||||||
|
{
|
||||||
|
menuItemName2Callback.Add(menuItemText, callBackAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Sende Media Nachrichten
|
#region Sende Media Nachrichten
|
||||||
private void MediaButton_OnClick(object sender, RoutedEventArgs e)
|
private void MediaButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var kontakt = (AktuellerKontakt)AktChatUser.Items[0];
|
if (AktChatUser.Items.Count > 0)
|
||||||
|
{
|
||||||
|
var kontakt = (AktuellerKontakt) AktChatUser.Items[0];
|
||||||
|
|
||||||
_chat.HoleUndSendeMediumAnKontakt(kontakt);
|
_chat.HoleUndSendeMediumAnKontakt(kontakt);
|
||||||
|
|
||||||
Chat.ItemsSource = null;
|
Chat.ItemsSource = null;
|
||||||
Chat.ItemsSource = _chat.LadeChatNachrichtenVomKontakt(kontakt);
|
Chat.ItemsSource = _chat.LadeChatNachrichtenVomKontakt(kontakt);
|
||||||
|
|
||||||
Chat.Items.MoveCurrentToLast();
|
Chat.Items.MoveCurrentToLast();
|
||||||
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
Chat.ScrollIntoView(Chat.Items.CurrentItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Bitte einen Kontakt auswählen!","Fehler",MessageBoxButton.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -363,15 +447,6 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void AddContextMenu(string menuItemText, Action<string> callBackAction)
|
|
||||||
{
|
|
||||||
if (!menuItemName2Callback.ContainsKey(menuItemText))
|
|
||||||
{
|
|
||||||
menuItemName2Callback.Add(menuItemText, callBackAction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region Nachladen weiterer Chat Nachrichten
|
#region Nachladen weiterer Chat Nachrichten
|
||||||
private void Chat_OnScrollChanged(object sender, ScrollChangedEventArgs e)
|
private void Chat_OnScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -638,6 +713,66 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Zeige Erhaltene Daten An In Dem Fall Bilder Zurzeit
|
||||||
|
|
||||||
|
private void Chat_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var chatItems = Chat.SelectedItems;
|
||||||
|
|
||||||
|
if (chatItems.Count > 0) {
|
||||||
|
foreach (var items in chatItems)
|
||||||
|
{
|
||||||
|
var item = items as KontaktMessageBuilder;
|
||||||
|
|
||||||
|
if (item != null && item.ImageSources != null)
|
||||||
|
{
|
||||||
|
_chat.ShowPicture(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Lade Dokument Herunter und Zeige es an
|
||||||
|
private void OpenDokument_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var btn = sender as System.Windows.Controls.Button;
|
||||||
|
|
||||||
|
if (btn.Tag != null)
|
||||||
|
{
|
||||||
|
var link = btn.Tag;
|
||||||
|
|
||||||
|
var filename = Path.GetFileName(link.ToString());
|
||||||
|
|
||||||
|
LoadDokument(link.ToString(),filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadDokument(string link, String filename)
|
||||||
|
{
|
||||||
|
string path = @"c:\temp\" + filename;
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
using (WebClient webClient = new WebClient())
|
||||||
|
{
|
||||||
|
webClient.DownloadFile(link, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
Process.Start(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Process.Start(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ using ContextMenu = System.Windows.Controls.ContextMenu;
|
|||||||
using DataFormats = System.Windows.Forms.DataFormats;
|
using DataFormats = System.Windows.Forms.DataFormats;
|
||||||
using Image = System.Windows.Controls.Image;
|
using Image = System.Windows.Controls.Image;
|
||||||
using MenuItem = System.Windows.Forms.MenuItem;
|
using MenuItem = System.Windows.Forms.MenuItem;
|
||||||
|
using MessageBox = System.Windows.MessageBox;
|
||||||
using Size = System.Drawing.Size;
|
using Size = System.Drawing.Size;
|
||||||
|
|
||||||
namespace ChatController.HauptKlassen
|
namespace ChatController.HauptKlassen
|
||||||
@@ -42,6 +43,10 @@ namespace ChatController.HauptKlassen
|
|||||||
private string _nextPage = null;
|
private string _nextPage = null;
|
||||||
private bool _hasNextPage = false;
|
private bool _hasNextPage = false;
|
||||||
|
|
||||||
|
public static readonly List<string> ImageExtensions = new List<string> { ".JPG", ".JPE", ".BMP", ".GIF", ".PNG", ".JPEG" };
|
||||||
|
public static readonly List<string> DokumentExtension = new List<string> { ".TXT", ".PPT", ".XLS", ".DOC" };
|
||||||
|
|
||||||
|
|
||||||
public Chat(ChatDatenUebergabe chatDaten)
|
public Chat(ChatDatenUebergabe chatDaten)
|
||||||
{
|
{
|
||||||
ChatDaten = chatDaten;
|
ChatDaten = chatDaten;
|
||||||
@@ -132,7 +137,7 @@ namespace ChatController.HauptKlassen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Lade Nachrichten vom Kontakt in den Chat
|
#region Lade Nachrichten vom Kontakt in den Chat
|
||||||
public IOrderedEnumerable<KontaktMessageBuilder> LadeChatNachrichtenVomKontakt(AktuellerKontakt kontakt)
|
public IOrderedEnumerable<KontaktMessageBuilder> LadeChatNachrichtenVomKontakt(AktuellerKontakt kontakt)
|
||||||
{
|
{
|
||||||
@@ -154,17 +159,20 @@ namespace ChatController.HauptKlassen
|
|||||||
|
|
||||||
if (!ChatMessage.File.Equals("")) // Bilder werden Sichtbar
|
if (!ChatMessage.File.Equals("")) // Bilder werden Sichtbar
|
||||||
{
|
{
|
||||||
//bool isGif = false;
|
|
||||||
|
|
||||||
//if (ChatMessage.File.Contains(".gif"))
|
if (ImageExtensions.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
//{
|
{
|
||||||
// isGif = true;
|
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||||
//}
|
|
||||||
|
|
||||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
|
||||||
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), true, LadeBildNach(ChatMessage.File),
|
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), true, LadeBildNach(ChatMessage.File),
|
||||||
timeformated));
|
timeformated));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
|
{
|
||||||
|
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||||
|
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), true,ChatMessage.File,
|
||||||
|
timeformated));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -180,20 +188,27 @@ namespace ChatController.HauptKlassen
|
|||||||
var clientZone = TimeZoneInfo.Local;
|
var clientZone = TimeZoneInfo.Local;
|
||||||
var timeformated = TimeZoneInfo.ConvertTimeFromUtc(time, clientZone);
|
var timeformated = TimeZoneInfo.ConvertTimeFromUtc(time, clientZone);
|
||||||
|
|
||||||
if (!ChatMessage.File.Equals("")) // Bilder werden Sichtbar
|
if (!ChatMessage.File.Equals(""))
|
||||||
{
|
{
|
||||||
//bool isGif = false;
|
if (ImageExtensions.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
//if (ChatMessage.File.Contains(".gif"))
|
{
|
||||||
//{
|
//image
|
||||||
// isGif = true;
|
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||||
//}
|
|
||||||
|
|
||||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
|
||||||
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), false, LadeBildNach(ChatMessage.File),
|
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), false, LadeBildNach(ChatMessage.File),
|
||||||
timeformated));
|
timeformated));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DokumentExtension.Contains(Path.GetExtension(ChatMessage.File).ToUpperInvariant()))
|
||||||
|
{
|
||||||
|
//Dokument
|
||||||
|
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||||
|
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), false, ChatMessage.File,
|
||||||
|
timeformated));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Message
|
||||||
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
Messages.Add(new KontaktMessageBuilder(ChatMessage.User_Name, ChatMessage.Text,
|
||||||
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), false, timeformated));
|
timeformated.ToString("dd MMMM yyyy HH:mm:ss"), false, timeformated));
|
||||||
}
|
}
|
||||||
@@ -877,9 +892,9 @@ namespace ChatController.HauptKlassen
|
|||||||
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
OpenFileDialog openFileDialog1 = new OpenFileDialog();
|
||||||
|
|
||||||
//if (typ == 1)
|
//if (typ == 1)
|
||||||
openFileDialog1.Filter = "Bilder |*.jpg;*.png;*.jpeg;*.jpe;*.gif;*.bmp";
|
openFileDialog1.Filter = "Office Dokumente |*.doc;*.xls;*.ppt;*.txt|Bilder |*.jpg;*.png;*.jpeg;*.jpe;*.gif;*.bmp";
|
||||||
//else
|
//else
|
||||||
// openFileDialog1.Filter = "Office Dokumente |*.doc;*.xls;*.ppt;*.txt";
|
// openFileDialog1.Filter = "Office Dokumente |*.doc;*.xls;*.ppt;*.txt";
|
||||||
|
|
||||||
DialogResult result = openFileDialog1.ShowDialog();
|
DialogResult result = openFileDialog1.ShowDialog();
|
||||||
|
|
||||||
@@ -1075,73 +1090,46 @@ namespace ChatController.HauptKlassen
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fuege Daten Bilder usw via DragAndDrop in den Chat / muss noch bearbeitet werden
|
#region Fuege Daten Bilder usw via DragAndDrop in den Chat / muss noch bearbeitet werden
|
||||||
public void Einfuegen()
|
public void Einfuegen(long groupOid)
|
||||||
{
|
{
|
||||||
//var item = context.Items[2] as MenuItem;
|
|
||||||
|
|
||||||
//item.Visibility = Visibility.Collapsed;
|
|
||||||
//Chat.SelectionMode = SelectionMode.Single;
|
|
||||||
//Chat.Focusable = true;
|
|
||||||
|
|
||||||
var d = System.Windows.Forms.Clipboard.GetDataObject();
|
var d = System.Windows.Forms.Clipboard.GetDataObject();
|
||||||
|
|
||||||
if (d.GetDataPresent(DataFormats.FileDrop))
|
if (d.GetDataPresent(DataFormats.FileDrop))
|
||||||
{
|
{
|
||||||
string[] files = (String[])d.GetData(DataFormats.FileDrop);
|
try
|
||||||
|
|
||||||
string imgFileString = files[0];
|
|
||||||
|
|
||||||
|
|
||||||
//if (isAnImage(imgFileString))
|
|
||||||
//{
|
|
||||||
// ZeigeProgressWärendUpload(1, imgFileString);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// ZeigeProgressWärendUpload(2, imgFileString);
|
|
||||||
//}
|
|
||||||
|
|
||||||
System.Windows.Forms.Clipboard.Clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (d.GetDataPresent(DataFormats.Text))
|
|
||||||
{
|
{
|
||||||
string files = (String)d.GetData(DataFormats.Text);
|
string[] fileList = d.GetData(DataFormats.FileDrop) as string[];
|
||||||
|
|
||||||
string imgFileString = files;
|
string filename = "";
|
||||||
|
|
||||||
try
|
FileStream file = null;
|
||||||
|
|
||||||
|
if (fileList != null)
|
||||||
{
|
{
|
||||||
byte[] data;
|
if (File.Exists(fileList[0]))
|
||||||
using (WebClient client = new WebClient())
|
|
||||||
{
|
{
|
||||||
data = client.DownloadData(imgFileString);
|
filename = Path.GetFileName(fileList[0]);
|
||||||
|
|
||||||
|
//file = File.OpenRead(fileList[0]);
|
||||||
|
byte[] myBinary = File.ReadAllBytes(fileList[0]);
|
||||||
|
|
||||||
|
SendMediaMessage(filename, groupOid, myBinary);
|
||||||
}
|
}
|
||||||
|
|
||||||
string filename = Path.GetFileName(imgFileString);
|
|
||||||
|
|
||||||
//string isloaded = LoadDokumentFromInet(data, filename);
|
|
||||||
|
|
||||||
//if (!isloaded.IsNullOrEmpty() && isAnImage(isloaded))
|
|
||||||
//{
|
|
||||||
// //ZeigeProgressWärendUpload(1, isloaded);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// //ZeigeProgressWärendUpload(2, isloaded);
|
|
||||||
//}
|
|
||||||
|
|
||||||
System.Windows.Forms.Clipboard.Clear();
|
|
||||||
}
|
|
||||||
catch (Exception s)
|
|
||||||
{
|
|
||||||
//MessageBox.Show("Der Chat kann den Zwischen-Speicher nicht verarbeiten.", "Fehler",
|
|
||||||
// MessageBoxButton.OK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show("Fehler: " + e.Message, "Fehler", MessageBoxButton.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (d.GetDataPresent(DataFormats.Text))
|
||||||
|
{
|
||||||
|
string text = (String)d.GetData(DataFormats.Text);
|
||||||
|
|
||||||
|
SendMessage(text, groupOid);
|
||||||
|
}
|
||||||
|
else
|
||||||
if (d.GetDataPresent(DataFormats.Bitmap))
|
if (d.GetDataPresent(DataFormats.Bitmap))
|
||||||
{
|
{
|
||||||
Bitmap pic = (Bitmap)d.GetData(DataFormats.Bitmap);
|
Bitmap pic = (Bitmap)d.GetData(DataFormats.Bitmap);
|
||||||
@@ -1149,28 +1137,21 @@ namespace ChatController.HauptKlassen
|
|||||||
var bildname = GeneriereZuffalsNamen() + ".jpg";
|
var bildname = GeneriereZuffalsNamen() + ".jpg";
|
||||||
|
|
||||||
System.Drawing.Image img = pic;
|
System.Drawing.Image img = pic;
|
||||||
|
|
||||||
//var data = Utils.CreateByteArrayFromImage(img);
|
SendMediaMessage(bildname,groupOid, ImageToByteArray(img));
|
||||||
|
|
||||||
//string isloaded = LoadDokumentFromInet(data, bildname);
|
|
||||||
|
|
||||||
//if (!isloaded.IsNullOrEmpty() && isAnImage(isloaded))
|
|
||||||
//{
|
|
||||||
// //ZeigeProgressWärendUpload(1, isloaded);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// //ZeigeProgressWärendUpload(2, isloaded);
|
|
||||||
//}
|
|
||||||
|
|
||||||
System.Windows.Forms.Clipboard.Clear();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//MessageBox.Show("Der Chat kann den Zwischen-Speicher nicht verarbeiten.", "Fehler",
|
MessageBox.Show("Der Zwischen-Speicher kann nicht verarbeitet werden.", "Fehler", MessageBoxButton.OK);
|
||||||
// MessageBoxButton.OK);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static byte[] ImageToByteArray(System.Drawing.Image image)
|
||||||
|
{
|
||||||
|
using (var ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
image.Save(ms, ImageFormat.Bmp);
|
||||||
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1190,7 +1171,7 @@ namespace ChatController.HauptKlassen
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Zeige Kontakt Bild / hat noch probleme
|
#region Zeige Kontakt Bild / hat noch probleme -> Show Kontakt
|
||||||
|
|
||||||
public void ShowKontaktPicture(AktuellerKontakt curItem )
|
public void ShowKontaktPicture(AktuellerKontakt curItem )
|
||||||
{
|
{
|
||||||
@@ -1224,6 +1205,38 @@ namespace ChatController.HauptKlassen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowPicture(KontaktMessageBuilder curItem)
|
||||||
|
{
|
||||||
|
using (Form form = new Form())
|
||||||
|
{
|
||||||
|
Image imgg = new Image();
|
||||||
|
|
||||||
|
imgg.Source = curItem.ImageSources;
|
||||||
|
|
||||||
|
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)imgg.Source));
|
||||||
|
encoder.Save(ms);
|
||||||
|
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
|
||||||
|
|
||||||
|
Bitmap imgbit = new Bitmap(img);
|
||||||
|
|
||||||
|
form.StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
form.Size = imgbit.Size;
|
||||||
|
form.FormBorderStyle = FormBorderStyle.Sizable;
|
||||||
|
|
||||||
|
PictureBox pb = new PictureBox();
|
||||||
|
pb.Dock = DockStyle.Fill;
|
||||||
|
pb.Image = imgbit;
|
||||||
|
|
||||||
|
pb.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||||
|
|
||||||
|
|
||||||
|
form.Controls.Add(pb);
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,18 +106,23 @@ namespace ChatController
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(_dateiPfad)) {
|
if (File.Exists(_dateiPfad)) {
|
||||||
|
|
||||||
List<string> daten = new List<string>();
|
List<string> daten = new List<string>();
|
||||||
using (StreamReader sr = new StreamReader(_dateiPfad))
|
using (StreamReader sr = new StreamReader(_dateiPfad,true))
|
||||||
{
|
{
|
||||||
string line = "";
|
string line = "";
|
||||||
|
|
||||||
while ((line = sr.ReadLine()) != null)
|
while ((line = sr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
daten.Add(line);
|
var encodedTextBytes = Convert.FromBase64String(line);
|
||||||
|
|
||||||
|
string plainText = Encoding.UTF8.GetString(encodedTextBytes);
|
||||||
|
|
||||||
|
daten.Add(plainText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(daten.Count == 5) {
|
if(daten.Count == 5) {
|
||||||
TextBoxKundennummer.Text = daten[0];
|
TextBoxKundennummer.Text = daten[0];
|
||||||
TextBoxChatCode.Text = daten[1];
|
TextBoxChatCode.Text = daten[1];
|
||||||
@@ -125,31 +130,52 @@ namespace ChatController
|
|||||||
TextBoxPasswort.Password = daten[3];
|
TextBoxPasswort.Password = daten[3];
|
||||||
Merken.IsChecked = Convert.ToBoolean(daten[4]);
|
Merken.IsChecked = Convert.ToBoolean(daten[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpeichereDatenInDatei()
|
private void SpeichereDatenInDatei()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Write each directory name to a file.
|
|
||||||
using (StreamWriter sw = new StreamWriter(_dateiPfad))
|
using (StreamWriter sw = new StreamWriter(_dateiPfad))
|
||||||
{
|
{
|
||||||
sw.WriteLine( TextBoxKundennummer.Text);
|
|
||||||
sw.WriteLine(TextBoxChatCode.Text);
|
Encoding enc = new UTF8Encoding();
|
||||||
sw.WriteLine(TextBoxBenutzerName.Text);
|
var byt = enc.GetBytes(TextBoxKundennummer.Text);
|
||||||
sw.WriteLine(TextBoxPasswort.Password);
|
var bytes = Convert.ToBase64String(byt);
|
||||||
sw.WriteLine(Merken.IsChecked.ToString());
|
|
||||||
|
var byt2 = enc.GetBytes(TextBoxChatCode.Text);
|
||||||
|
var bytes2 = Convert.ToBase64String(byt2);
|
||||||
|
|
||||||
|
var byt3 = enc.GetBytes(TextBoxBenutzerName.Text);
|
||||||
|
var bytes3 = Convert.ToBase64String(byt3);
|
||||||
|
|
||||||
|
|
||||||
|
var byt4 = enc.GetBytes(TextBoxPasswort.Password);
|
||||||
|
var bytes4 = Convert.ToBase64String(byt4);
|
||||||
|
|
||||||
|
var byt5 = enc.GetBytes(Merken.IsChecked.ToString());
|
||||||
|
var bytes5 = Convert.ToBase64String(byt5);
|
||||||
|
|
||||||
|
|
||||||
|
sw.WriteLine(bytes);
|
||||||
|
sw.WriteLine(bytes2);
|
||||||
|
sw.WriteLine(bytes3);
|
||||||
|
sw.WriteLine(bytes4);
|
||||||
|
sw.WriteLine(bytes5);
|
||||||
|
|
||||||
|
File.SetAttributes(_dateiPfad, FileAttributes.ReadOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(e.Message);
|
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +190,7 @@ namespace ChatController
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show(e.Message);
|
MessageBox.Show("Ups, da ist was schief gelaufen: \n" + e.Message, "Fehler", MessageBoxButton.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -16,7 +16,6 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using ChatController.HauptKlassen;
|
using ChatController.HauptKlassen;
|
||||||
using ChatController.Klassen;
|
using ChatController.Klassen;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace PrototypChat
|
namespace PrototypChat
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,7 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json">
|
<Reference Include="Newtonsoft.Json">
|
||||||
<HintPath>..\..\..\..\..\Desktop\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\libs\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
|||||||
BIN
libs/Newtonsoft.Json.dll
Normal file
BIN
libs/Newtonsoft.Json.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user