Files
BeWoPlaner/BeWo/MainWindow.xaml.cs

110 lines
3.5 KiB
C#
Raw Normal View History

2016-06-27 01:45:38 +02:00
using System;
using System.ComponentModel;
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;
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();
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;
}
}
if(BeWoApp.MainControl != null && BeWoApp.MainControl.HomeView.ServiceChatView != null) {
if (BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl != null &&
BeWoApp.MainControl.HomeView.ServiceChatView.ChatMainControl.GlobalListeningThreadtimer != null)
{
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;
}
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;
}
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();
}
}
}