111 lines
2.6 KiB
C#
111 lines
2.6 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using BeWo.Core.Config;
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.View;
|
|
|
|
|
|
namespace BeWo
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
ShowLoginControl();
|
|
}
|
|
|
|
private void ShowLoginControl()
|
|
{
|
|
|
|
//WebRequest.DefaultWebProxy
|
|
|
|
//System.Net.WebRequest.GetSystemWebProxy()
|
|
|
|
|
|
|
|
var lc = new LoginControl();
|
|
rootGrid.Children.Add(lc);
|
|
lc.LoginSuccessful += lc_LoginSuccessful;
|
|
}
|
|
|
|
void lc_LoginSuccessful(object sender, EventArgs e)
|
|
{
|
|
#if DEBUG
|
|
//if (BeWoApp.Tenant == "demo")
|
|
//{
|
|
// var dlg = new ConfirmDemoDialog();
|
|
// dlg.ShowDialog();
|
|
//}
|
|
#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);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
BeWoApp.MainControl.HomeView.CloseServerConnection();
|
|
|
|
foreach (var xyz in BeWoApp.MainControl.HomeView.chatView.Speicherpfad)
|
|
{
|
|
try
|
|
{
|
|
File.Delete(xyz.Value);
|
|
}
|
|
catch (Exception esx)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
catch (Exception edf)
|
|
{
|
|
}
|
|
|
|
|
|
|
|
BeWoApp.CurrentBeWo.DocumentWatcher.LoescheTempDateien();
|
|
|
|
Application.Current.Shutdown();
|
|
}
|
|
}
|
|
}
|