Files
Chat/PrototypChat/MainWindow.xaml.cs

128 lines
4.0 KiB
C#
Raw Normal View History

2017-09-12 14:32:34 +02:00
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;
2017-09-14 12:36:48 +02:00
2017-09-12 14:32:34 +02:00
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;
2017-09-15 16:39:07 +02:00
namespace ownChat
2017-09-12 14:32:34 +02:00
{
/// <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);
2017-10-06 12:08:05 +02:00
ChatMainControl.SetzteStyleAufNull();
2017-09-12 14:32:34 +02:00
//ChatMainControl.AddContextMenu("In Dokumentation übernehmen", ChatMainControl_OnClickContextMenuItem);
2017-10-06 12:08:05 +02:00
2017-09-12 14:32:34 +02:00
}
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; //- 5
_emojiView.Left = (x.X / source.CompositionTarget.TransformToDevice.M11) - 270; //x.X / source.CompositionTarget.TransformToDevice.M11
2017-09-12 14:32:34 +02:00
_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; //- 5
_emojiView.Left = (x.X / source.CompositionTarget.TransformToDevice.M11) - 270; //x.X / source.CompositionTarget.TransformToDevice.M11
2017-09-12 14:32:34 +02:00
}
}
}
private void MainWindow_OnClosed(object sender, EventArgs e)
{
_emojiView = null;
2017-10-06 12:08:05 +02:00
// Environment.Exit(0);
LoginMaske newLogin = new LoginMaske();
newLogin.Show();
}
private void ChatMainControl_OnOnClose()
{
this.Close();
}
2017-09-12 14:32:34 +02:00
}
}