142 lines
4.3 KiB
C#
142 lines
4.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
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.Shapes;
|
|
using BeWo.ServiceProxy;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using ChatController.ChatKlassen;
|
|
using ChatController.Klassen;
|
|
|
|
namespace BeWo.View
|
|
{
|
|
/// <summary>
|
|
/// Interaktionslogik für ChatService.xaml
|
|
/// </summary>
|
|
public partial class ChatView : Window
|
|
{
|
|
|
|
public ChatEmojiView _emojiView;
|
|
|
|
public ChatView(ChatDatenUebergabe chatDaten)
|
|
{
|
|
InitializeComponent();
|
|
CloseWindow();
|
|
|
|
ChatMainControl.InitMitChatdaten(chatDaten);
|
|
ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem);
|
|
}
|
|
|
|
private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DragMove();
|
|
}
|
|
catch (Exception) { }
|
|
}
|
|
|
|
private void CloseWindow()
|
|
{
|
|
CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) =>
|
|
{
|
|
//Close();
|
|
Visibility = Visibility.Hidden;
|
|
|
|
if (_emojiView != null)
|
|
{
|
|
_emojiView.Close(); // hidden
|
|
}
|
|
|
|
}));
|
|
}
|
|
|
|
private void ChatMainControl_OnOnEmoji(Button emojiButton)
|
|
{
|
|
if (_emojiView == null)
|
|
{
|
|
_emojiView = new ChatEmojiView(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.Hidden; // hidden
|
|
//}
|
|
//else
|
|
//{
|
|
_emojiView.Close();
|
|
_emojiView = null;
|
|
|
|
_emojiView = new ChatEmojiView(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();
|
|
//}
|
|
}
|
|
}
|
|
|
|
private void ChatMainControl_OnClickContextMenuItem(String menuItem)
|
|
{
|
|
var aktuellerKontakt = ChatMainControl.GetAktuellenKontakt();
|
|
|
|
if (aktuellerKontakt != null)
|
|
{
|
|
var itemListe = ChatMainControl.GetSelectedMessages();
|
|
|
|
if (itemListe != null)
|
|
{
|
|
List<long> sdf = new List<long>();
|
|
|
|
//hier die Customer Oid hinzufügen
|
|
sdf.Add(1);
|
|
|
|
var compactCustomerlist = ServiceFacade.DoCustomerServiceSync(s => s.GetCompactCustomersById(sdf));
|
|
|
|
CompactCustomerDC compactCustomer = null;
|
|
|
|
foreach (var cc in compactCustomerlist)
|
|
{
|
|
compactCustomer = cc;
|
|
}
|
|
|
|
ChatDokumentationsView newView = new ChatDokumentationsView(itemListe,
|
|
BeWoApp.LoggedOnUser.Employee.PersonOid, compactCustomer);
|
|
|
|
newView.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Bitte Nachrichten auswählen");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Dokumentiert werden kann nur im Chat der Klienten");
|
|
}
|
|
}
|
|
}
|
|
}
|