Files
BeWoPlaner/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs
2022-12-02 13:00:27 +01:00

82 lines
2.6 KiB
C#

using BeWoLauncher.Logic.Controller;
using BeWoLauncher.Logic.Utils;
using BS.SharedLauncher.Utils;
using System;
using System.Collections.Generic;
using System.IO;
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.Navigation;
using System.Windows.Shapes;
namespace BeWoLauncher.View.Frames
{
/// <summary>
/// Interaktionslogik für UpdateInfo2.xaml
/// </summary>
public partial class UpdateInfoFrame : FrameBase
{
public event EventHandler Accept;
public event EventHandler Abort;
public UpdateInfoFrame()
{
InitializeComponent();
LauncherPaths.ActualPlanerLocation = LauncherPaths.GetInstallLocationFromSetting();
var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.ResponseInfo.DownloadSize).Split(' ');
lblErforderlich.Content = size[0];
lblErforderlichSize.Content = size[1];
var size2 = DownloadController.UpdateDiskSpace(LauncherPaths.ActualPlanerLocation).Split(' ');
if(size2.Length > 1)
{
lblVerfuegbar.Content = size2[0];
lblVerfuegbarSize.Content = size2[1];
}
else
{
lblVerfuegbar.Content = size2[0] ?? "error#87";
lblVerfuegbarSize.Content = string.Empty;
}
var total = DownloadController.Manager.ResponseInfo.FileCount;
var download = DownloadController.Manager.ResponseInfo.NewFileCount;
var already = total - download;
lblcountnew.Content = $"{download}";
lblcountalready.Content = $"{already}";
lblversion.Content = DownloadController.Manager.ResponseInfo.Version;
lblcountalready.Visibility = Visibility.Hidden;
lblcountalreadytxt.Visibility = Visibility.Hidden;
lblcountnew.Visibility = Visibility.Hidden;
lblcountnewtxt.Visibility = Visibility.Hidden;
lblfound.Visibility = already == 0 ? Visibility.Hidden : Visibility.Visible;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Abort.Invoke(this, new EventArgs());
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Accept.Invoke(this, new EventArgs());
}
}
}