2020-04-16 18:52:26 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
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.Shapes;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
|
|
|
|
|
namespace UWUVCI_AIO_WPF.UI.Windows
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaktionslogik für DownloadWait.xaml
|
|
|
|
|
/// </summary>
|
2020-04-17 01:28:14 +00:00
|
|
|
|
|
2020-04-16 18:52:26 +00:00
|
|
|
|
partial class DownloadWait : Window
|
|
|
|
|
{
|
|
|
|
|
MainViewModel mvm;
|
2020-04-20 00:35:31 +00:00
|
|
|
|
DispatcherTimer timer = new DispatcherTimer();
|
2020-04-17 01:28:14 +00:00
|
|
|
|
public DownloadWait(string doing, string msg, MainViewModel mvm)
|
2020-04-16 18:52:26 +00:00
|
|
|
|
{
|
2020-04-30 15:01:41 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.Owner.GetType() == typeof(MainWindow))
|
|
|
|
|
{
|
|
|
|
|
this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
}
|
2020-04-17 01:28:14 +00:00
|
|
|
|
this.mvm = mvm;
|
2020-04-16 18:52:26 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
Key.Text = doing;
|
2020-04-30 15:01:41 +00:00
|
|
|
|
|
2020-04-16 18:52:26 +00:00
|
|
|
|
timer.Interval = TimeSpan.FromSeconds(1);
|
|
|
|
|
timer.Tick += timer_Tick;
|
|
|
|
|
timer.Start();
|
|
|
|
|
}
|
2020-04-18 03:31:36 +00:00
|
|
|
|
public DownloadWait(string doing, string msg, MainViewModel mvm, bool t)
|
|
|
|
|
{
|
2020-04-30 15:01:41 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.Owner.GetType() != typeof(MainWindow))
|
|
|
|
|
{
|
|
|
|
|
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
}
|
2020-04-18 03:31:36 +00:00
|
|
|
|
this.mvm = mvm;
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
Key.Text = doing;
|
|
|
|
|
DispatcherTimer timer = new DispatcherTimer();
|
|
|
|
|
timer.Interval = TimeSpan.FromSeconds(1);
|
|
|
|
|
timer.Tick += timer_Tick;
|
|
|
|
|
|
|
|
|
|
}
|
2020-05-04 16:20:21 +00:00
|
|
|
|
private void Button_MouseEnter(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void min_MouseLeave(object sender, MouseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void Window_Minimize(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.WindowState = WindowState.Minimized;
|
|
|
|
|
}
|
2020-04-18 03:31:36 +00:00
|
|
|
|
private void timer_Tick(object sender, EventArgs e)
|
2020-04-16 18:52:26 +00:00
|
|
|
|
{
|
2020-04-17 01:28:14 +00:00
|
|
|
|
msgT.Text = mvm.msg;
|
|
|
|
|
pb.Value = mvm.Progress;
|
2020-04-18 03:31:36 +00:00
|
|
|
|
if(Key.Text.Contains("Downloading Base"))
|
|
|
|
|
{
|
|
|
|
|
if(mvm.Progress < 70)
|
|
|
|
|
{
|
2020-04-19 17:36:03 +00:00
|
|
|
|
mvm.Progress += 1;
|
2020-04-18 03:31:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-16 18:52:26 +00:00
|
|
|
|
if(mvm.Progress == 100)
|
|
|
|
|
{
|
2020-04-20 00:35:31 +00:00
|
|
|
|
timer.Stop();
|
2020-04-18 03:31:36 +00:00
|
|
|
|
Close();
|
2020-04-19 17:36:03 +00:00
|
|
|
|
|
2020-04-16 18:52:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-30 15:01:41 +00:00
|
|
|
|
public void changeOwner(MainWindow ow)
|
|
|
|
|
{
|
|
|
|
|
this.Owner = ow;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.Owner.GetType() == typeof(MainWindow))
|
|
|
|
|
{
|
|
|
|
|
this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
2020-05-04 16:20:21 +00:00
|
|
|
|
this.ShowInTaskbar = false;
|
2020-04-30 15:01:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-06 21:53:52 +00:00
|
|
|
|
private void wind_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
{
|
2020-05-07 20:00:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-06 21:53:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void wind_Closed(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-05-07 20:00:24 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if ((FindResource("mvm") as MainViewModel).mw != null)
|
|
|
|
|
{
|
|
|
|
|
(FindResource("mvm") as MainViewModel).mw.Topmost = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-11 08:12:03 +00:00
|
|
|
|
catch (Exception )
|
2020-05-07 20:00:24 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2020-05-06 21:53:52 +00:00
|
|
|
|
}
|
2020-04-16 18:52:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|