Projektdateien hinzufügen.
This commit is contained in:
113
Valheim Mod Sync Desktop/Benachrichtigung.xaml.cs
Normal file
113
Valheim Mod Sync Desktop/Benachrichtigung.xaml.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Valheim_Mod_Sync_Desktop
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für Benachrichtigung.xaml
|
||||
/// </summary>
|
||||
public partial class Benachrichtigung : Window
|
||||
{
|
||||
public Benachrichtigung(bool Name, bool Email, bool Message, bool Send, bool KeinInternet, bool Error, bool StartKeinInternet, bool StartValheim)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (Name)
|
||||
{
|
||||
name.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (Email)
|
||||
{
|
||||
email.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if(Message)
|
||||
{
|
||||
message.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (Send && !KeinInternet)
|
||||
{
|
||||
send.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (KeinInternet)
|
||||
{
|
||||
keininternet.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (Error)
|
||||
{
|
||||
error.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (StartKeinInternet)
|
||||
{
|
||||
startkeininternet.Visibility = Visibility.Visible;
|
||||
MainWindow.LizenzReturn = "false";
|
||||
}
|
||||
|
||||
if (StartValheim)
|
||||
{
|
||||
startvalheim.Visibility = Visibility.Visible;
|
||||
BenachrichtigungsFenster.KeyDown += OnKeyDownHandler;
|
||||
Keyboard.Focus(BenachrichtigungsFenster);
|
||||
ValheimStart();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private bool abort = false;
|
||||
|
||||
private async void ValheimStart()
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
if (abort == false)
|
||||
{
|
||||
var uri = "steam://rungameid/892970";
|
||||
var psi = new ProcessStartInfo();
|
||||
psi.UseShellExecute = true;
|
||||
psi.FileName = uri;
|
||||
Process.Start(psi);
|
||||
this.Close();
|
||||
Application.Current.MainWindow.Close();
|
||||
}else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnKeyDownHandler(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape)
|
||||
{
|
||||
abort = true;
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//Close Button
|
||||
private void exitBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
//Minimize Button
|
||||
private void miniBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
//Header Move
|
||||
private void header_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user