2016-06-27 01:45:38 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.ComponentModel;
|
2020-08-17 15:50:00 +02:00
|
|
|
|
using System.Threading;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using BeWo.Core.Config;
|
2017-11-06 10:30:25 +01:00
|
|
|
|
using BeWo.MultiLanguage;
|
|
|
|
|
|
using BS.Shared.Translation;
|
2019-07-31 14:49:49 +02:00
|
|
|
|
using DevExpress.Xpf.Core;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
namespace BeWo
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
|
{
|
|
|
|
|
|
public MainWindow()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
2019-07-31 14:49:49 +02:00
|
|
|
|
|
|
|
|
|
|
ApplicationThemeHelper.ApplicationThemeName = "Office2010Black";
|
2016-06-27 01:45:38 +02:00
|
|
|
|
ShowLoginControl();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ShowLoginControl()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2017-11-06 10:30:25 +01:00
|
|
|
|
//WebRequest.DefaultWebProxy
|
|
|
|
|
|
|
|
|
|
|
|
//System.Net.WebRequest.GetSystemWebProxy()
|
2016-06-27 01:45:38 +02:00
|
|
|
|
var lc = new LoginControl();
|
|
|
|
|
|
rootGrid.Children.Add(lc);
|
|
|
|
|
|
lc.LoginSuccessful += lc_LoginSuccessful;
|
2017-12-07 11:14:50 +01:00
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lc_LoginSuccessful(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2017-11-06 10:30:25 +01:00
|
|
|
|
Translator t = new Translator(new ServiceTranslator());
|
2016-06-27 01:45:38 +02:00
|
|
|
|
#if DEBUG
|
2017-11-06 10:30:25 +01:00
|
|
|
|
//if (BeWoApp.Tenant == "demo")
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var dlg = new ConfirmDemoDialog();
|
|
|
|
|
|
// dlg.ShowDialog();
|
|
|
|
|
|
//}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
#else
|
|
|
|
|
|
if (BeWoApp.Tenant == "demo")
|
|
|
|
|
|
{
|
|
|
|
|
|
var dlg = new ConfirmDemoDialog();
|
|
|
|
|
|
dlg.ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
rootGrid.Children.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
MainControl mc = new MainControl();
|
|
|
|
|
|
mc.IsMaximized = BeWoApp.AppSettings.WindowState == AppSettings.WindowStateType.Maximised;
|
|
|
|
|
|
|
|
|
|
|
|
mc.LogoutClicked += new EventHandler(mc_LogoutClicked);
|
|
|
|
|
|
rootGrid.Children.Add(mc);
|
2017-11-06 10:30:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void mc_LogoutClicked(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
rootGrid.Children.Clear();
|
|
|
|
|
|
BeWoApp.MainControl = null;
|
|
|
|
|
|
ShowLoginControl();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void MainWindow_OnClosing(object sender, CancelEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (BeWoApp.MainControl != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
//BeWoApp.SaveAppSettings();
|
|
|
|
|
|
|
|
|
|
|
|
if (!BeWoApp.MainControl.DoSaveCheck())
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-08-05 12:48:13 +02:00
|
|
|
|
|
2017-09-08 15:09:48 +02:00
|
|
|
|
if(BeWoApp.MainControl != null && BeWoApp.MainControl.HomeView.ServiceChatView != null) {
|
|
|
|
|
|
|
|
|
|
|
|
if (BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl != null &&
|
2019-07-01 15:11:19 +02:00
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer != null)
|
2017-09-08 15:09:48 +02:00
|
|
|
|
{
|
2019-07-01 15:11:19 +02:00
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer.Stop();
|
|
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer = null;
|
2017-12-12 17:20:23 -04:00
|
|
|
|
//BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl.disableKontaktNachrichtenThread = true;
|
2017-09-08 15:09:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-14 11:49:16 +02:00
|
|
|
|
if (BeWoApp.MainControl.HomeView.ServiceChatView.ServiceChat.EmojiView != null) {
|
|
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView.ServiceChat.EmojiView.Close();
|
|
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView.ServiceChat.EmojiView = null;
|
2017-09-08 15:09:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView.Close();
|
|
|
|
|
|
BeWoApp.MainControl.HomeView.ServiceChatView = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
BeWoApp.CurrentBeWo.DocumentWatcher.LoescheTempDateien();
|
|
|
|
|
|
|
|
|
|
|
|
Application.Current.Shutdown();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|