ui(client): migrate to AvaloniaUI
This commit is contained in:
10
ModpackUpdater.Apps.Client.Gui/App.axaml
Normal file
10
ModpackUpdater.Apps.Client.Gui/App.axaml
Normal file
@@ -0,0 +1,10 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="ModpackUpdater.Apps.Client.Gui.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
20
ModpackUpdater.Apps.Client.Gui/App.axaml.cs
Normal file
20
ModpackUpdater.Apps.Client.Gui/App.axaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace ModpackUpdater.Apps.Client.Gui;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
desktop.MainWindow = new MainForm();
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="TelerikWinFormsThemeName" value="Windows11CompactDark" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -7,10 +7,10 @@ public class AppConfig : ISettingsNode, ISettingsIdentifier
|
||||
{
|
||||
public static string Identifier => "pilz.appconfig";
|
||||
|
||||
public string LastMinecraftProfilePath { get; set; }
|
||||
public string? LastMinecraftProfilePath { get; set; }
|
||||
|
||||
[JsonIgnore, Obsolete]
|
||||
public string ConfigFilePath { get; private set; }
|
||||
public string? ConfigFilePath { get; private set; }
|
||||
[JsonProperty("ConfigFilePath"), Obsolete]
|
||||
private string ConfigFilePathLegacy
|
||||
{
|
||||
|
||||
@@ -10,12 +10,12 @@ public class AppUpdater(string updateUrl)
|
||||
private class UpdateInfo
|
||||
{
|
||||
[JsonConverter(typeof(VersionConverter))]
|
||||
public Version Version { get; set; }
|
||||
public string DownloadUrl { get; set; }
|
||||
public Version? Version { get; set; }
|
||||
public string? DownloadUrl { get; set; }
|
||||
}
|
||||
|
||||
private readonly HttpClient httpClient = new();
|
||||
private UpdateInfo info;
|
||||
private UpdateInfo? info;
|
||||
|
||||
public async Task<bool> Check()
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
@@ -60,6 +60,15 @@ namespace ModpackUpdater.My.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Select the minecraft profile folder (usually named .minecraft) ähnelt.
|
||||
/// </summary>
|
||||
internal static string FileDialog_SelectMinecraftProfileFolder {
|
||||
get {
|
||||
return ResourceManager.GetString("FileDialog_SelectMinecraftProfileFolder", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue? ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="FileDialog_SelectMinecraftProfileFolder" xml:space="preserve">
|
||||
<value>Select the minecraft profile folder (usually named .minecraft)</value>
|
||||
</data>
|
||||
<data name="MsgBox_UpdateAvailable" xml:space="preserve">
|
||||
<value>A new version of this program is available. If you confirm, the update will be installed automatically. It takes just a few seconds. Continue?</value>
|
||||
</data>
|
||||
|
||||
288
ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
generated
288
ModpackUpdater.Apps.Client.Gui/MainForm.Designer.cs
generated
@@ -1,288 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ModpackUpdater.Apps.Client.Gui
|
||||
{
|
||||
[Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
|
||||
|
||||
public partial class MainForm : Telerik.WinControls.UI.RadForm
|
||||
{
|
||||
|
||||
// Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||
[DebuggerNonUserCode()]
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing && components is not null)
|
||||
components.Dispose();
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
// Wird vom Windows Form-Designer benötigt.
|
||||
private System.ComponentModel.IContainer components = new System.ComponentModel.Container();
|
||||
|
||||
// Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
||||
// Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
||||
// Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
[DebuggerStepThrough()]
|
||||
private void InitializeComponent()
|
||||
{
|
||||
var resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
RadLabel_MinecraftProfile = new Telerik.WinControls.UI.RadLabel();
|
||||
RadLabel_ModpackUrl = new Telerik.WinControls.UI.RadLabel();
|
||||
RadTextBox_MinecraftProfileFolder = new Telerik.WinControls.UI.RadTextBoxControl();
|
||||
RadTextBox_ModpackConfig = new Telerik.WinControls.UI.RadTextBoxControl();
|
||||
RadButton_Install = new Telerik.WinControls.UI.RadSplitButton();
|
||||
radMenuItem_Install = new Telerik.WinControls.UI.RadMenuItem();
|
||||
radMenuItem_Repair = new Telerik.WinControls.UI.RadMenuItem();
|
||||
RadButton_CheckForUpdates = new Telerik.WinControls.UI.RadButton();
|
||||
RadButton_SearchMinecraftProfileFolder = new Telerik.WinControls.UI.RadButton();
|
||||
tableLayoutPanel1 = new TableLayoutPanel();
|
||||
RadLabel_Status = new Telerik.WinControls.UI.RadLabel();
|
||||
RadLabel_StatusDesc = new Telerik.WinControls.UI.RadLabel();
|
||||
radLabel_InstallationKey = new Telerik.WinControls.UI.RadLabel();
|
||||
radTextBox_InstallKey = new Telerik.WinControls.UI.RadTextBoxControl();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_MinecraftProfile).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_ModpackUrl).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadButton_Install).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadButton_CheckForUpdates).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).BeginInit();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_Status).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_StatusDesc).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)radLabel_InstallationKey).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)this).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// RadLabel_MinecraftProfile
|
||||
//
|
||||
RadLabel_MinecraftProfile.Anchor = AnchorStyles.Left;
|
||||
RadLabel_MinecraftProfile.Location = new Point(3, 6);
|
||||
RadLabel_MinecraftProfile.Name = "RadLabel_MinecraftProfile";
|
||||
RadLabel_MinecraftProfile.Size = new Size(89, 18);
|
||||
RadLabel_MinecraftProfile.TabIndex = 0;
|
||||
RadLabel_MinecraftProfile.Text = "Minecraft profile";
|
||||
//
|
||||
// RadLabel_ModpackUrl
|
||||
//
|
||||
RadLabel_ModpackUrl.Anchor = AnchorStyles.Left;
|
||||
RadLabel_ModpackUrl.Location = new Point(3, 36);
|
||||
RadLabel_ModpackUrl.Name = "RadLabel_ModpackUrl";
|
||||
RadLabel_ModpackUrl.Size = new Size(76, 18);
|
||||
RadLabel_ModpackUrl.TabIndex = 1;
|
||||
RadLabel_ModpackUrl.Text = "Modpack URL";
|
||||
//
|
||||
// RadTextBox_MinecraftProfileFolder
|
||||
//
|
||||
RadTextBox_MinecraftProfileFolder.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableLayoutPanel1.SetColumnSpan(RadTextBox_MinecraftProfileFolder, 3);
|
||||
RadTextBox_MinecraftProfileFolder.Location = new Point(98, 3);
|
||||
RadTextBox_MinecraftProfileFolder.Name = "RadTextBox_MinecraftProfileFolder";
|
||||
RadTextBox_MinecraftProfileFolder.NullText = "C:\\Users\\...\\AppData\\...";
|
||||
RadTextBox_MinecraftProfileFolder.Size = new Size(221, 24);
|
||||
RadTextBox_MinecraftProfileFolder.TabIndex = 1;
|
||||
RadTextBox_MinecraftProfileFolder.TextChanged += RadTextBox_MinecraftFolder_TextInserted;
|
||||
//
|
||||
// RadTextBox_ModpackConfig
|
||||
//
|
||||
RadTextBox_ModpackConfig.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableLayoutPanel1.SetColumnSpan(RadTextBox_ModpackConfig, 5);
|
||||
RadTextBox_ModpackConfig.Location = new Point(98, 33);
|
||||
RadTextBox_ModpackConfig.Name = "RadTextBox_ModpackConfig";
|
||||
RadTextBox_ModpackConfig.NullText = "https://...";
|
||||
RadTextBox_ModpackConfig.Size = new Size(321, 24);
|
||||
RadTextBox_ModpackConfig.TabIndex = 3;
|
||||
RadTextBox_ModpackConfig.TextChanged += RadTextBox_ModpackUrl_TextInserted;
|
||||
//
|
||||
// RadButton_Install
|
||||
//
|
||||
RadButton_Install.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableLayoutPanel1.SetColumnSpan(RadButton_Install, 2);
|
||||
RadButton_Install.ImageAlignment = ContentAlignment.MiddleRight;
|
||||
RadButton_Install.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_Install, radMenuItem_Repair });
|
||||
RadButton_Install.Location = new Point(325, 121);
|
||||
RadButton_Install.Name = "RadButton_Install";
|
||||
RadButton_Install.Size = new Size(94, 24);
|
||||
RadButton_Install.TabIndex = 0;
|
||||
RadButton_Install.Text = "Install";
|
||||
RadButton_Install.TextAlignment = ContentAlignment.MiddleLeft;
|
||||
RadButton_Install.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
//
|
||||
// radMenuItem_Install
|
||||
//
|
||||
radMenuItem_Install.Name = "radMenuItem_Install";
|
||||
radMenuItem_Install.Text = "Install";
|
||||
radMenuItem_Install.Click += RadMenuItem_Install_Click;
|
||||
//
|
||||
// radMenuItem_Repair
|
||||
//
|
||||
radMenuItem_Repair.Name = "radMenuItem_Repair";
|
||||
radMenuItem_Repair.Text = "Repair";
|
||||
radMenuItem_Repair.Click += RadMenuItem_Repair_Click;
|
||||
//
|
||||
// RadButton_CheckForUpdates
|
||||
//
|
||||
RadButton_CheckForUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableLayoutPanel1.SetColumnSpan(RadButton_CheckForUpdates, 3);
|
||||
RadButton_CheckForUpdates.ImageAlignment = ContentAlignment.MiddleRight;
|
||||
RadButton_CheckForUpdates.Location = new Point(98, 121);
|
||||
RadButton_CheckForUpdates.Name = "RadButton_CheckForUpdates";
|
||||
RadButton_CheckForUpdates.Size = new Size(221, 24);
|
||||
RadButton_CheckForUpdates.TabIndex = 100;
|
||||
RadButton_CheckForUpdates.Text = "Check for Updates";
|
||||
RadButton_CheckForUpdates.TextAlignment = ContentAlignment.MiddleLeft;
|
||||
RadButton_CheckForUpdates.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
RadButton_CheckForUpdates.Click += ButtonX_CheckForUpdates_Click;
|
||||
//
|
||||
// RadButton_SearchMinecraftProfileFolder
|
||||
//
|
||||
RadButton_SearchMinecraftProfileFolder.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableLayoutPanel1.SetColumnSpan(RadButton_SearchMinecraftProfileFolder, 2);
|
||||
RadButton_SearchMinecraftProfileFolder.ImageAlignment = ContentAlignment.MiddleRight;
|
||||
RadButton_SearchMinecraftProfileFolder.Location = new Point(325, 3);
|
||||
RadButton_SearchMinecraftProfileFolder.Name = "RadButton_SearchMinecraftProfileFolder";
|
||||
RadButton_SearchMinecraftProfileFolder.Size = new Size(94, 24);
|
||||
RadButton_SearchMinecraftProfileFolder.TabIndex = 2;
|
||||
RadButton_SearchMinecraftProfileFolder.Text = "Search";
|
||||
RadButton_SearchMinecraftProfileFolder.TextAlignment = ContentAlignment.MiddleLeft;
|
||||
RadButton_SearchMinecraftProfileFolder.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
RadButton_SearchMinecraftProfileFolder.Click += ButtonX_SearchMinecraftProfile_Click;
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
tableLayoutPanel1.AutoSize = true;
|
||||
tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
tableLayoutPanel1.ColumnCount = 6;
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle());
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
||||
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50F));
|
||||
tableLayoutPanel1.Controls.Add(RadLabel_MinecraftProfile, 0, 0);
|
||||
tableLayoutPanel1.Controls.Add(RadLabel_ModpackUrl, 0, 1);
|
||||
tableLayoutPanel1.Controls.Add(RadTextBox_MinecraftProfileFolder, 1, 0);
|
||||
tableLayoutPanel1.Controls.Add(RadTextBox_ModpackConfig, 1, 1);
|
||||
tableLayoutPanel1.Controls.Add(RadLabel_Status, 1, 3);
|
||||
tableLayoutPanel1.Controls.Add(RadLabel_StatusDesc, 0, 3);
|
||||
tableLayoutPanel1.Controls.Add(RadButton_Install, 4, 4);
|
||||
tableLayoutPanel1.Controls.Add(radLabel_InstallationKey, 0, 2);
|
||||
tableLayoutPanel1.Controls.Add(radTextBox_InstallKey, 1, 2);
|
||||
tableLayoutPanel1.Controls.Add(RadButton_CheckForUpdates, 1, 4);
|
||||
tableLayoutPanel1.Controls.Add(RadButton_SearchMinecraftProfileFolder, 4, 0);
|
||||
tableLayoutPanel1.Dock = DockStyle.Fill;
|
||||
tableLayoutPanel1.Location = new Point(0, 0);
|
||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
tableLayoutPanel1.RowCount = 5;
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
||||
tableLayoutPanel1.RowStyles.Add(new RowStyle());
|
||||
tableLayoutPanel1.Size = new Size(422, 151);
|
||||
tableLayoutPanel1.TabIndex = 7;
|
||||
//
|
||||
// RadLabel_Status
|
||||
//
|
||||
RadLabel_Status.Anchor = AnchorStyles.Left;
|
||||
tableLayoutPanel1.SetColumnSpan(RadLabel_Status, 5);
|
||||
RadLabel_Status.Location = new Point(98, 95);
|
||||
RadLabel_Status.Name = "RadLabel_Status";
|
||||
RadLabel_Status.Size = new Size(11, 18);
|
||||
RadLabel_Status.TabIndex = 3;
|
||||
RadLabel_Status.Text = "-";
|
||||
RadLabel_Status.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
//
|
||||
// RadLabel_StatusDesc
|
||||
//
|
||||
RadLabel_StatusDesc.Anchor = AnchorStyles.Left;
|
||||
RadLabel_StatusDesc.Location = new Point(3, 93);
|
||||
RadLabel_StatusDesc.Name = "RadLabel_StatusDesc";
|
||||
RadLabel_StatusDesc.Size = new Size(46, 22);
|
||||
RadLabel_StatusDesc.TabIndex = 2;
|
||||
RadLabel_StatusDesc.Text = "Status";
|
||||
//
|
||||
// radLabel_InstallationKey
|
||||
//
|
||||
radLabel_InstallationKey.Anchor = AnchorStyles.Left;
|
||||
radLabel_InstallationKey.Location = new Point(3, 66);
|
||||
radLabel_InstallationKey.Name = "radLabel_InstallationKey";
|
||||
radLabel_InstallationKey.Size = new Size(81, 18);
|
||||
radLabel_InstallationKey.TabIndex = 12;
|
||||
radLabel_InstallationKey.Text = "Installation key";
|
||||
radLabel_InstallationKey.Visible = false;
|
||||
//
|
||||
// radTextBox_InstallKey
|
||||
//
|
||||
radTextBox_InstallKey.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tableLayoutPanel1.SetColumnSpan(radTextBox_InstallKey, 5);
|
||||
radTextBox_InstallKey.Location = new Point(98, 63);
|
||||
radTextBox_InstallKey.Name = "radTextBox_InstallKey";
|
||||
radTextBox_InstallKey.NullText = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE";
|
||||
radTextBox_InstallKey.Size = new Size(321, 24);
|
||||
radTextBox_InstallKey.TabIndex = 4;
|
||||
radTextBox_InstallKey.Visible = false;
|
||||
radTextBox_InstallKey.TextChanged += RadTextBox_InstallationKey_TextInserted;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleBaseSize = new Size(7, 15);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(422, 151);
|
||||
Controls.Add(tableLayoutPanel1);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
MaximizeBox = false;
|
||||
MinimumSize = new Size(430, 0);
|
||||
Name = "MainForm";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Minecraft Modpack Updater";
|
||||
FormClosing += Form1_FormClosing;
|
||||
Load += Form1_Load;
|
||||
Shown += Form1_Shown;
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_MinecraftProfile).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_ModpackUrl).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadTextBox_MinecraftProfileFolder).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadTextBox_ModpackConfig).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadButton_Install).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadButton_CheckForUpdates).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadButton_SearchMinecraftProfileFolder).EndInit();
|
||||
tableLayoutPanel1.ResumeLayout(false);
|
||||
tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_Status).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RadLabel_StatusDesc).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)radLabel_InstallationKey).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)radTextBox_InstallKey).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)this).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
internal Telerik.WinControls.UI.RadLabel RadLabel_MinecraftProfile;
|
||||
internal Telerik.WinControls.UI.RadLabel RadLabel_ModpackUrl;
|
||||
internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_MinecraftProfileFolder;
|
||||
internal Telerik.WinControls.UI.RadTextBoxControl RadTextBox_ModpackConfig;
|
||||
internal Telerik.WinControls.UI.RadSplitButton RadButton_Install;
|
||||
internal Telerik.WinControls.UI.RadButton RadButton_CheckForUpdates;
|
||||
internal Telerik.WinControls.UI.RadButton RadButton_SearchMinecraftProfileFolder;
|
||||
private TableLayoutPanel tableLayoutPanel1;
|
||||
internal Telerik.WinControls.UI.RadLabel radLabel_InstallationKey;
|
||||
internal Telerik.WinControls.UI.RadTextBoxControl radTextBox_InstallKey;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Repair;
|
||||
private Telerik.WinControls.UI.RadMenuItem radMenuItem_Install;
|
||||
internal Telerik.WinControls.UI.RadLabel RadLabel_Status;
|
||||
internal Telerik.WinControls.UI.RadLabel RadLabel_StatusDesc;
|
||||
}
|
||||
}
|
||||
126
ModpackUpdater.Apps.Client.Gui/MainForm.axaml
Normal file
126
ModpackUpdater.Apps.Client.Gui/MainForm.axaml
Normal file
@@ -0,0 +1,126 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:svg="clr-namespace:Avalonia.Svg;assembly=Avalonia.Svg"
|
||||
mc:Ignorable="d"
|
||||
x:Class="ModpackUpdater.Apps.Client.Gui.MainForm"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Title="Minecraft Modpack Updater"
|
||||
Icon="/Assets/app.ico"
|
||||
>
|
||||
|
||||
<Grid
|
||||
RowDefinitions="Auto,Auto,Auto,Auto,Auto"
|
||||
Margin="3, 3, 3, 3"
|
||||
RowSpacing="6"
|
||||
ColumnSpacing="6"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*" MinWidth="300"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Labels -->
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="Minecraft profile:" />
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="Modpack config url:" />
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" IsVisible="false" x:Name="LabelInstallKey" Content="Installation key:" />
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Content="Status:" />
|
||||
<Label Grid.Row="3" Grid.Column="1" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="16" Height="16" x:Name="ImageStatus" />
|
||||
<TextBlock Margin="3, 0, 0, 0" x:Name="TextStatus" />
|
||||
</StackPanel>
|
||||
</Label>
|
||||
|
||||
<!-- TextBoxes: Profile -->
|
||||
<TextBox
|
||||
x:Name="TextBoxMinecraftProfileFolder"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="C:\..."
|
||||
TextInput="TextBoxMinecraftProfileFolder_TextInserted"
|
||||
/>
|
||||
|
||||
<!-- TextBoxes: ModpackConfig -->
|
||||
<TextBox
|
||||
x:Name="TextBoxModpackConfig"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="https://..."
|
||||
TextInput="TextBoxModpackConfig_TextInserted"
|
||||
/>
|
||||
|
||||
<!-- TextBoxes: InstallKey -->
|
||||
<TextBox
|
||||
x:Name="TextBoxInstallKey"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="XXXXX-YYYYY-ZZZZZ-AAAAA-BBBBB"
|
||||
TextInput="TextBoxInstallKey_TextInserted"
|
||||
IsVisible="false"
|
||||
/>
|
||||
|
||||
<!-- Button: SearchProfileFolder -->
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
Click="ButtonSearchProfileFolder_Click"
|
||||
>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageSearchProfileFolder" />
|
||||
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0">Search</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Button: CheckForUpdates -->
|
||||
<Button
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" x:Name="ButtonCheckForUpdates" Click="ButtonCheckForUpdates_Click"
|
||||
>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageCheckForUpdates" />
|
||||
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0">Check for updates</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Button: Install -->
|
||||
<SplitButton
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
x:Name="ButtonInstall"
|
||||
Click="ButtonInstall_Click"
|
||||
>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image VerticalAlignment="Center" Width="16" Height="16" x:Name="ButtonImageInstall" />
|
||||
<TextBlock VerticalAlignment="Center" Margin="3, 0, 0, 0">Install</TextBlock>
|
||||
</StackPanel>
|
||||
<SplitButton.Flyout>
|
||||
<MenuFlyout>
|
||||
<MenuItem Header="Repair" Click="MenuItemRepair_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" x:Name="MenuItemImageRepair" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuFlyout>
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,22 +1,26 @@
|
||||
using ModpackUpdater.Manager;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ModpackUpdater.Manager;
|
||||
using ModpackUpdater.My.Resources;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using Pilz.Extensions;
|
||||
using Pilz.UI.Symbols;
|
||||
using Pilz.UI.WinForms.Extensions;
|
||||
using Pilz.SymbolPacks.Sets;
|
||||
using Pilz.UI.AvaloniaUI.Symbols;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace ModpackUpdater.Apps.Client.Gui;
|
||||
|
||||
public partial class MainForm
|
||||
public partial class MainForm : Window
|
||||
{
|
||||
private readonly UpdateCheckOptions updateOptions = new();
|
||||
private ModpackInfo modpackInfo = new();
|
||||
private ModpackConfig updateConfig = new();
|
||||
private ModpackFeatures features;
|
||||
private UpdateCheckResult lastUpdateCheckResult;
|
||||
private ModpackFeatures? features;
|
||||
private UpdateCheckResult? lastUpdateCheckResult;
|
||||
private bool currentUpdating;
|
||||
private bool loadingData;
|
||||
private int curOptionsRow = 3;
|
||||
@@ -25,42 +29,42 @@ public partial class MainForm
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Text = $"{Text} (v{Assembly.GetExecutingAssembly().GetAppVersion()})";
|
||||
RadButton_Install.DefaultItem = radMenuItem_Install;
|
||||
Title = $"{Title} (v{Assembly.GetExecutingAssembly().GetAppVersion()})";
|
||||
|
||||
RadButton_CheckForUpdates.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small);
|
||||
RadButton_SearchMinecraftProfileFolder.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.opened_folder, SymbolSize.Small);
|
||||
RadButton_Install.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small);
|
||||
radMenuItem_Install.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small);
|
||||
radMenuItem_Repair.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.wrench, SymbolSize.Small);
|
||||
Closing += MainForm_Closing;
|
||||
Loaded += MainForm_Loaded;
|
||||
|
||||
ButtonImageSearchProfileFolder.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.opened_folder);
|
||||
ButtonImageCheckForUpdates.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.update);
|
||||
ButtonImageInstall.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer);
|
||||
MenuItemImageRepair.Source = Symbols.Fluent.GetImageSource(SymbolsFluent.wrench);
|
||||
|
||||
ClearStatus();
|
||||
LoadProfileToUi();
|
||||
}
|
||||
|
||||
#region Features
|
||||
|
||||
private void SetStatus(string statusText, RadSvgImage image)
|
||||
private void SetStatus(string statusText, IImage? image)
|
||||
{
|
||||
RadLabel_Status.Text = statusText;
|
||||
RadLabel_Status.SvgImage = image;
|
||||
TextStatus.Text = statusText;
|
||||
ImageStatus.Source = image;
|
||||
}
|
||||
|
||||
private void ClearStatus()
|
||||
{
|
||||
RadLabel_Status.Text = "-";
|
||||
RadLabel_Status.SvgImage = null;
|
||||
TextStatus.Text = "-";
|
||||
ImageStatus.Source = null;
|
||||
}
|
||||
|
||||
private void LoadProfileToUi()
|
||||
{
|
||||
loadingData = true;
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
|
||||
RadTextBox_MinecraftProfileFolder.Text = modpackInfo?.LocaLPath ?? AppConfig.Instance.LastMinecraftProfilePath ?? RadTextBox_MinecraftProfileFolder.Text;
|
||||
RadTextBox_ModpackConfig.Text = modpackInfo?.ConfigUrl ?? RadTextBox_ModpackConfig.Text;
|
||||
radTextBox_InstallKey.Text = modpackInfo?.ExtrasKey ?? radTextBox_InstallKey.Text;
|
||||
TextBoxMinecraftProfileFolder.Text = modpackInfo?.LocaLPath ?? AppConfig.Instance.LastMinecraftProfilePath ?? TextBoxMinecraftProfileFolder.Text;
|
||||
TextBoxModpackConfig.Text = modpackInfo?.ConfigUrl ?? TextBoxModpackConfig.Text;
|
||||
TextBoxInstallKey.Text = modpackInfo?.ExtrasKey ?? TextBoxInstallKey.Text;
|
||||
|
||||
tableLayoutPanel1.ResumeLayout();
|
||||
loadingData = false;
|
||||
}
|
||||
|
||||
@@ -82,7 +86,7 @@ public partial class MainForm
|
||||
{
|
||||
try
|
||||
{
|
||||
modpackInfo = ModpackInfo.TryLoad(RadTextBox_MinecraftProfileFolder.Text.Trim());
|
||||
modpackInfo = ModpackInfo.TryLoad(TextBoxMinecraftProfileFolder.Text?.Trim());
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -93,7 +97,7 @@ public partial class MainForm
|
||||
|
||||
try
|
||||
{
|
||||
updateConfig = ModpackConfig.LoadFromUrl(RadTextBox_ModpackConfig.Text);
|
||||
updateConfig = ModpackConfig.LoadFromUrl(TextBoxModpackConfig.Text);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -102,71 +106,71 @@ public partial class MainForm
|
||||
if (modpackInfo != null)
|
||||
features = new(updateConfig);
|
||||
|
||||
radTextBox_InstallKey.Visible = radLabel_InstallationKey.Visible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
|
||||
LabelInstallKey.IsVisible = TextBoxInstallKey.IsVisible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
|
||||
|
||||
if (modpackInfo == null || string.IsNullOrWhiteSpace(RadTextBox_MinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/)
|
||||
if (modpackInfo == null || string.IsNullOrWhiteSpace(TextBoxMinecraftProfileFolder.Text) /*|| modpackInfo.Valid*/)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_MinecraftProfileWarning, AppGlobals.Symbols.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small));
|
||||
RadButton_CheckForUpdates.Enabled = false;
|
||||
RadButton_Install.Enabled = false;
|
||||
SetStatus(LangRes.StatusText_MinecraftProfileWarning, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
|
||||
ButtonCheckForUpdates.IsEnabled = false;
|
||||
ButtonInstall.IsEnabled = false;
|
||||
return false;
|
||||
}
|
||||
else if (updateConfig == null || string.IsNullOrWhiteSpace(RadTextBox_ModpackConfig.Text))
|
||||
else if (updateConfig == null || string.IsNullOrWhiteSpace(TextBoxModpackConfig.Text))
|
||||
{
|
||||
SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, AppGlobals.Symbols.GetSvgImage(AppSymbols.general_warning_sign, SymbolSize.Small));
|
||||
RadButton_CheckForUpdates.Enabled = false;
|
||||
RadButton_Install.Enabled = false;
|
||||
SetStatus(LangRes.StatusText_ConfigIncompleteOrNotLoaded, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
|
||||
ButtonCheckForUpdates.IsEnabled = false;
|
||||
ButtonInstall.IsEnabled = false;
|
||||
return false;
|
||||
}
|
||||
else if (updateConfig.Maintenance && !updateOptions.IgnoreMaintenance)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_Maintenance, AppGlobals.Symbols.GetSvgImage(AppSymbols.services, SymbolSize.Small));
|
||||
RadButton_CheckForUpdates.Enabled = false;
|
||||
RadButton_Install.Enabled = false;
|
||||
SetStatus(LangRes.StatusText_Maintenance, Symbols.Fluent.GetImageSource(SymbolsFluent.services));
|
||||
ButtonCheckForUpdates.IsEnabled = false;
|
||||
ButtonInstall.IsEnabled = false;
|
||||
return false;
|
||||
}
|
||||
LoadOptionsToUi();
|
||||
RadButton_CheckForUpdates.Enabled = true;
|
||||
RadButton_Install.Enabled = true;
|
||||
ButtonCheckForUpdates.IsEnabled = true;
|
||||
ButtonInstall.IsEnabled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task ExecuteUpdate(bool doInstall, bool repair)
|
||||
{
|
||||
// Ensure set extras key
|
||||
modpackInfo.ExtrasKey = radTextBox_InstallKey.Text.Trim();
|
||||
modpackInfo.ExtrasKey = TextBoxInstallKey.Text?.Trim();
|
||||
|
||||
var updater = new ModpackInstaller(updateConfig, modpackInfo);
|
||||
updater.InstallProgessUpdated += Update_InstallProgessUpdated;
|
||||
updater.CheckingProgressUpdated += Updated_CheckingProgresssUpdated;
|
||||
|
||||
|
||||
void error()
|
||||
{
|
||||
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.close, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_ErrorWhileUpdateCheckOrUpdate, Symbols.Fluent.GetImageSource(SymbolsFluent.close));
|
||||
currentUpdating = false;
|
||||
}
|
||||
void installing()
|
||||
{
|
||||
SetStatus(LangRes.StatusText_Installing, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_Installing, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||
currentUpdating = true;
|
||||
}
|
||||
void updatesAvailable()
|
||||
{
|
||||
SetStatus(LangRes.StatusText_UpdateAvailable, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_UpdateAvailable, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||
}
|
||||
void everythingOk()
|
||||
{
|
||||
SetStatus(LangRes.StatusTest_EverythingOk, AppGlobals.Symbols.GetSvgImage(AppSymbols.done, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusTest_EverythingOk, Symbols.Fluent.GetImageSource(SymbolsFluent.done));
|
||||
currentUpdating = false;
|
||||
}
|
||||
|
||||
// Check only if not pressed "install", not really needed otherwise.
|
||||
if (lastUpdateCheckResult is null || !doInstall || repair)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_CheckingForUpdates, AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small));
|
||||
SetStatus(LangRes.StatusText_CheckingForUpdates, Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||
|
||||
// Check for extras once again
|
||||
updateOptions.IncludeExtras = features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
||||
updateOptions.IncludeExtras = features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
||||
|
||||
// Force re-install on repair
|
||||
updateOptions.IgnoreInstalledVersion = repair;
|
||||
@@ -238,75 +242,77 @@ public partial class MainForm
|
||||
|
||||
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
|
||||
{
|
||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small));
|
||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||
}
|
||||
|
||||
private void Update_InstallProgessUpdated(UpdateCheckResult result, int processedSyncs)
|
||||
{
|
||||
int actionCount = result.Actions.Count;
|
||||
SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
||||
SetStatus(Math.Round(processedSyncs / (double)actionCount * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Gui
|
||||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
private void MainForm_Closing(object? sender, WindowClosingEventArgs e)
|
||||
{
|
||||
AppConfig.Instance.LastMinecraftProfilePath = RadTextBox_MinecraftProfileFolder.Text.Trim();
|
||||
AppConfig.Instance.LastMinecraftProfilePath = TextBoxMinecraftProfileFolder.Text?.Trim();
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private async void Form1_Shown(object sender, EventArgs e)
|
||||
private async void MainForm_Loaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var updater = new AppUpdater(Program.UPDATE_URL);
|
||||
if (await updater.Check() && RadMessageBox.Show(LangRes.MsgBox_UpdateAvailable, LangRes.MsgBox_UpdateAvailable_Title, MessageBoxButtons.YesNo, RadMessageIcon.Info).IsYes())
|
||||
if (await updater.Check() && await MessageBoxManager.GetMessageBoxStandard(LangRes.MsgBox_UpdateAvailable_Title, LangRes.MsgBox_UpdateAvailable, ButtonEnum.YesNo).ShowWindowDialogAsync(this) == ButtonResult.Ok)
|
||||
{
|
||||
SetStatus(LangRes.StatusText_InstallingAppUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.software_installer, SymbolSize.Small));
|
||||
Enabled = false;
|
||||
SetStatus(LangRes.StatusText_InstallingAppUpdate, Symbols.Fluent.GetImageSource(SymbolsFluent.software_installer));
|
||||
IsEnabled = false;
|
||||
await updater.Install();
|
||||
Application.Restart();
|
||||
//Application.Restart(); // FIXME
|
||||
return;
|
||||
}
|
||||
|
||||
CheckStatusAndUpdate(true);
|
||||
}
|
||||
|
||||
private void RadTextBox_MinecraftFolder_TextInserted(object o, EventArgs args)
|
||||
private void TextBoxMinecraftProfileFolder_TextInserted(object? o, Avalonia.Input.TextInputEventArgs args)
|
||||
{
|
||||
if (!loadingData)
|
||||
CheckStatusAndUpdate(true);
|
||||
}
|
||||
|
||||
private void RadTextBox_ModpackUrl_TextInserted(object o, EventArgs args)
|
||||
private void TextBoxModpackConfig_TextInserted(object? o, Avalonia.Input.TextInputEventArgs args)
|
||||
{
|
||||
if (!loadingData)
|
||||
CheckStatusAndUpdate(false);
|
||||
}
|
||||
|
||||
private void RadTextBox_InstallationKey_TextInserted(object o, EventArgs args)
|
||||
private void TextBoxInstallKey_TextInserted(object? o, Avalonia.Input.TextInputEventArgs args)
|
||||
{
|
||||
if (!loadingData)
|
||||
CheckStatusAndUpdate(false);
|
||||
}
|
||||
|
||||
private void ButtonX_SearchMinecraftProfile_Click(object sender, EventArgs e)
|
||||
private async void ButtonSearchProfileFolder_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var ofd = new RadOpenFolderDialog();
|
||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
||||
RadTextBox_MinecraftProfileFolder.Text = ofd.FileName;
|
||||
var filePaths = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||
{
|
||||
Title = LangRes.FileDialog_SelectMinecraftProfileFolder,
|
||||
SuggestedStartLocation = await StorageProvider.TryGetFolderFromPathAsync(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)),
|
||||
AllowMultiple = false,
|
||||
});
|
||||
|
||||
if (filePaths.Count >= 1)
|
||||
TextBoxMinecraftProfileFolder.Text = filePaths[0].Path.ToString();
|
||||
}
|
||||
|
||||
private async void ButtonX_CheckForUpdates_Click(object sender, EventArgs e)
|
||||
private async void ButtonCheckForUpdates_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ClearStatus();
|
||||
await ExecuteUpdate(false, false);
|
||||
}
|
||||
|
||||
private async void RadMenuItem_Install_Click(object sender, EventArgs e)
|
||||
private async void ButtonInstall_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!currentUpdating)
|
||||
{
|
||||
@@ -315,7 +321,7 @@ public partial class MainForm
|
||||
}
|
||||
}
|
||||
|
||||
private async void RadMenuItem_Repair_Click(object sender, EventArgs e)
|
||||
private async void MenuItemRepair_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!currentUpdating)
|
||||
{
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,18 +2,24 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ApplicationIcon>minecraft modpack updater.ico</ApplicationIcon>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ApplicationIcon>Assets/app.ico</ApplicationIcon>
|
||||
<AssemblyName>Minecraft Modpack Updater</AssemblyName>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<Nullable>enable</Nullable>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Version.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="FiledialogFilters.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
@@ -41,24 +47,35 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.3.0" />
|
||||
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Pilz.Configuration" Version="3.2.6" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.1.2" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.1.0" />
|
||||
<PackageReference Include="Pilz.UI" Version="3.0.0" />
|
||||
<PackageReference Include="Pilz.UI.WinForms" Version="2.6.2" />
|
||||
<PackageReference Include="Pilz.UI.WinForms.Telerik" Version="2.13.3" />
|
||||
<PackageReference Include="Pilz.UI.WinForms.Telerik.Symbols" Version="1.2.1" />
|
||||
<PackageReference Include="UI.for.WinForms.Common" Version="2025.2.612-preview" />
|
||||
<PackageReference Include="UI.for.WinForms.Themes" Version="2025.2.612-preview" />
|
||||
<PackageReference Include="Pilz.SymbolPacks.Fluent" Version="1.0.12" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI" Version="1.0.0" />
|
||||
<PackageReference Include="Pilz.UI.AvaloniaUI.Symbols" Version="1.0.0" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.8" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.8" />
|
||||
<PackageReference Include="Avalonia.Svg" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.8" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.8" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.8">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ModpackUpdater.Apps.AppUpdates\ModpackUpdater.Apps.AppUpdates.csproj" />
|
||||
<ProjectReference Include="..\ModpackUpdater.Apps\ModpackUpdater.Apps.csproj" />
|
||||
<ProjectReference Include="..\ModpackUpdater.Manager\ModpackUpdater.Manager.csproj" />
|
||||
<ProjectReference Include="..\ModpackUpdater\ModpackUpdater.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,4 +1,5 @@
|
||||
using Castle.Core.Logging;
|
||||
using Avalonia;
|
||||
using Castle.Core.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Pilz.Configuration;
|
||||
|
||||
@@ -23,9 +24,15 @@ public static class Program
|
||||
[STAThread]
|
||||
internal static void Main(string[] args)
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
AppGlobals.Initialize();
|
||||
Application.Run(new MainForm());
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
{
|
||||
return AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
|
||||
private static string GetSettingsPath(int? settingsVersion = 3)
|
||||
|
||||
Reference in New Issue
Block a user