update client gui

This commit is contained in:
Pilzinsel64
2024-06-24 09:04:20 +02:00
parent d0048e008d
commit ebd9fb90da
16 changed files with 606 additions and 984 deletions

View File

@@ -22,14 +22,14 @@ namespace Pilz.Updating.Client.GUI {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class MyIcons { internal class LangRes {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal MyIcons() { internal LangRes() {
} }
/// <summary> /// <summary>
@@ -39,7 +39,7 @@ namespace Pilz.Updating.Client.GUI {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.GUI.MyIcons", typeof(MyIcons).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.GUI.LangRes", typeof(LangRes).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -61,22 +61,29 @@ namespace Pilz.Updating.Client.GUI {
} }
/// <summary> /// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// Sucht eine lokalisierte Zeichenfolge, die &lt;html&gt;&lt;a href=&quot;{0}&quot;&gt;Open link to notes in browser!&lt;/a&gt;&lt;/html&gt; ähnelt.
/// </summary> /// </summary>
internal static System.Drawing.Bitmap icons8_delete_16px { internal static string NotesLinkToExternal {
get { get {
object obj = ResourceManager.GetObject("icons8_delete_16px", resourceCulture); return ResourceManager.GetString("NotesLinkToExternal", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
} }
} }
/// <summary> /// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// Sucht eine lokalisierte Zeichenfolge, die No release notes not available or not provided. ähnelt.
/// </summary> /// </summary>
internal static System.Drawing.Bitmap icons8_software_installer_16px { internal static string NotesNotAvailable {
get { get {
object obj = ResourceManager.GetObject("icons8_software_installer_16px", resourceCulture); return ResourceManager.GetString("NotesNotAvailable", resourceCulture);
return ((System.Drawing.Bitmap)(obj)); }
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Updates available ähnelt.
/// </summary>
internal static string Title_UpdatesAvailable {
get {
return ResourceManager.GetString("Title_UpdatesAvailable", resourceCulture);
} }
} }
} }

View File

@@ -117,11 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <data name="NotesLinkToExternal" xml:space="preserve">
<data name="icons8_delete_16px" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>&lt;html&gt;&lt;a href="{0}"&gt;Open link to notes in browser!&lt;/a&gt;&lt;/html&gt;</value>
<value>Resources\icons8_delete_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8_software_installer_16px" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="NotesNotAvailable" xml:space="preserve">
<value>Resources\icons8_software_installer_16px.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>No release notes not available or not provided.</value>
</data>
<data name="Title_UpdatesAvailable" xml:space="preserve">
<value>Updates available</value>
</data> </data>
</root> </root>

View File

@@ -11,10 +11,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Update="MyIcons.Designer.cs"> <Compile Update="LangRes.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>MyIcons.resx</DependentUpon> <DependentUpon>LangRes.resx</DependentUpon>
</Compile> </Compile>
<Compile Update="SimpleActionDialog.Designer.cs"> <Compile Update="SimpleActionDialog.Designer.cs">
<DependentUpon>SimpleActionDialog.cs</DependentUpon> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
@@ -22,18 +22,11 @@
<Compile Update="SimpleActionDialog.cs"> <Compile Update="SimpleActionDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="UpdatesAvailableDialog.cs"> <Compile Update="UpdatesAvailableDialog.cs" />
<SubType>Form</SubType>
</Compile>
<Compile Update="UpdatesAvailableDialog.Designer.cs"> <Compile Update="UpdatesAvailableDialog.Designer.cs">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon> <DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="UpdatingClientGuiLangRes.Designer.cs"> <Compile Update="UpdatingClientGuiLangRes.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
@@ -42,10 +35,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="MyIcons.resx"> <EmbeddedResource Update="LangRes.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>MyIcons.Designer.cs</LastGenOutput> <LastGenOutput>LangRes.Designer.cs</LastGenOutput>
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="SimpleActionDialog.de.resx"> <EmbeddedResource Update="SimpleActionDialog.de.resx">
<DependentUpon>SimpleActionDialog.cs</DependentUpon> <DependentUpon>SimpleActionDialog.cs</DependentUpon>
@@ -59,12 +51,6 @@
<EmbeddedResource Update="UpdatesAvailableDialog.resx"> <EmbeddedResource Update="UpdatesAvailableDialog.resx">
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon> <DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<CustomToolNamespace>SM64_ROM_Manager.Updating.Client.GUI.My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Update="UpdatingClientGuiLangRes.de.resx"> <EmbeddedResource Update="UpdatingClientGuiLangRes.de.resx">
<Generator></Generator> <Generator></Generator>
<CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace> <CustomToolNamespace>Pilz.Updating.Client.GUI</CustomToolNamespace>
@@ -86,6 +72,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" /> <PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Pilz.IO" Version="2.0.0" /> <PackageReference Include="Pilz.IO" Version="2.0.0" />
<PackageReference Include="Pilz.UI.Telerik" Version="2.5.2" />
<PackageReference Include="Pilz.UI.Telerik.SymbolFactory" Version="2.0.3" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" /> <PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Markdig" Version="0.37.0" /> <PackageReference Include="Markdig" Version="0.37.0" />

View File

@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SM64_ROM_Manager.Updating.Client.GUI.My.Resources {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pilz.Updating.Client.GUI.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 B

View File

@@ -1,54 +1,19 @@
using Microsoft.VisualBasic.CompilerServices; using Microsoft.VisualBasic.CompilerServices;
using Pilz.UI;
using Pilz.UI.Telerik.Dialogs;
using Pilz.Updating.GUIBase;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices;
using Telerik.WinControls; using Telerik.WinControls;
namespace Pilz.Updating.Client.GUI; namespace Pilz.Updating.Client.GUI;
public class UpdateClientGUI public class UpdateClientGUI
{ {
// F i e l d s // F i e l d s
private Form parentForm; private Form parentForm;
private UpdateClient _UpdateClient; private SimpleActionDialog curProgressDialog;
private readonly UpdateClient updateClient;
private UpdateClient UpdateClient
{
[MethodImpl(MethodImplOptions.Synchronized)]
get
{
return _UpdateClient;
}
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
if (_UpdateClient != null)
{
// U p d a t e C l i e n t - E v e n t s
_UpdateClient.UpdateStatusChanged -= MyUpdateClient_UpdateStatusChanged;
_UpdateClient.DownloadingUpdate -= MyUpdateClient_DownloadingUpdate;
_UpdateClient.InstallingUpdate -= MyUpdateClient_InstallingUpdate;
_UpdateClient.UpdateInstallerStarted -= MyUpdateClient_FinishWork;
_UpdateClient.NoUpdatesFound -= MyUpdateClient_NoUpdatesFound;
}
_UpdateClient = value;
if (_UpdateClient != null)
{
_UpdateClient.UpdateStatusChanged += MyUpdateClient_UpdateStatusChanged;
_UpdateClient.DownloadingUpdate += MyUpdateClient_DownloadingUpdate;
_UpdateClient.InstallingUpdate += MyUpdateClient_InstallingUpdate;
_UpdateClient.UpdateInstallerStarted += MyUpdateClient_FinishWork;
_UpdateClient.NoUpdatesFound += MyUpdateClient_NoUpdatesFound;
}
}
}
private SimpleActionDialog curProgressDialog = null;
// P r o p e r t i e s // P r o p e r t i e s
@@ -60,7 +25,21 @@ public class UpdateClientGUI
public UpdateClientGUI(UpdateClient updateClient) public UpdateClientGUI(UpdateClient updateClient)
{ {
UpdateClient = updateClient; this.updateClient = updateClient;
updateClient.UpdateStatusChanged += MyUpdateClient_UpdateStatusChanged;
updateClient.DownloadingUpdate += MyUpdateClient_DownloadingUpdate;
updateClient.InstallingUpdate += MyUpdateClient_InstallingUpdate;
updateClient.UpdateInstallerStarted += MyUpdateClient_FinishWork;
updateClient.NoUpdatesFound += MyUpdateClient_NoUpdatesFound;
}
~UpdateClientGUI()
{
updateClient.UpdateStatusChanged -= MyUpdateClient_UpdateStatusChanged;
updateClient.DownloadingUpdate -= MyUpdateClient_DownloadingUpdate;
updateClient.InstallingUpdate -= MyUpdateClient_InstallingUpdate;
updateClient.UpdateInstallerStarted -= MyUpdateClient_FinishWork;
updateClient.NoUpdatesFound -= MyUpdateClient_NoUpdatesFound;
} }
// F e a t u r e s // F e a t u r e s
@@ -68,13 +47,12 @@ public class UpdateClientGUI
public async Task UpdateInteractive(Form parentForm) public async Task UpdateInteractive(Form parentForm)
{ {
this.parentForm = parentForm; this.parentForm = parentForm;
await UpdateClient.UpdateInteractive(); await updateClient.UpdateInteractive();
} }
private void EndUpdating() private void EndUpdating()
{ {
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close())); curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close()));
UpdateClient = null;
} }
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus) private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus)
@@ -104,8 +82,9 @@ public class UpdateClientGUI
var dres = default(DialogResult); var dres = default(DialogResult);
parentForm.Invoke(new Action(() => parentForm.Invoke(new Action(() =>
{ {
var dialog = new UpdatesAvailableDialog(MyAppIcon, UpdateClient.CurrentVersion.Version.ToString(), UpdateClient.CurrentVersion.Channel.ToString(), Conversions.ToString(UpdateClient.CurrentVersion.Build), pkg.Version.Version.ToString(), pkg.Version.Channel.ToString(), Conversions.ToString(pkg.Version.Build), pkg.Notes, UpdateClient.InstallAsAdmin); var dialog = new UpdatesAvailableDialog(MyAppIcon, updateClient.CurrentVersion.Version.ToString(), updateClient.CurrentVersion.Channel.ToString(), Conversions.ToString(updateClient.CurrentVersion.Build), pkg.Version.Version.ToString(), pkg.Version.Channel.ToString(), Conversions.ToString(pkg.Version.Build), pkg.Notes, updateClient.InstallAsAdmin);
dres = dialog.ShowDialog(parentForm); var symbol = GlobalSymbolFactory.Instance.GetImage(GlobalSymbols.software_installer, UI.Telerik.SvgImageSize.Small).ToIcon();
dres = RadDialogBase.ShowDialog(dialog, parentForm, LangRes.Title_UpdatesAvailable, symbol).Result;
})); }));
if (dres != DialogResult.OK) if (dres != DialogResult.OK)
{ {
@@ -132,9 +111,8 @@ public class UpdateClientGUI
private void MyUpdateClient_NoUpdatesFound() private void MyUpdateClient_NoUpdatesFound()
{ {
EndUpdating(); EndUpdating();
if (!UseHiddenSearch) if (!UseHiddenSearch)
{
RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info); RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info);
} }
} }
}

View File

@@ -4,7 +4,7 @@ using System.Diagnostics;
namespace Pilz.Updating.Client.GUI namespace Pilz.Updating.Client.GUI
{ {
[DesignerGenerated()] [DesignerGenerated()]
internal partial class UpdatesAvailableDialog : Telerik.WinControls.UI.RadForm internal partial class UpdatesAvailableDialog
{ {
// Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. // Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
@@ -34,7 +34,6 @@ namespace Pilz.Updating.Client.GUI
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdatesAvailableDialog)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UpdatesAvailableDialog));
panel1 = new Panel();
radButton_Cancel = new Telerik.WinControls.UI.RadButton(); radButton_Cancel = new Telerik.WinControls.UI.RadButton();
radButton_Install = new Telerik.WinControls.UI.RadButton(); radButton_Install = new Telerik.WinControls.UI.RadButton();
panel_ChangelogPanel = new Panel(); panel_ChangelogPanel = new Panel();
@@ -54,7 +53,7 @@ namespace Pilz.Updating.Client.GUI
radLabel1 = new Telerik.WinControls.UI.RadLabel(); radLabel1 = new Telerik.WinControls.UI.RadLabel();
radPictureBox1 = new Telerik.WinControls.UI.RadPictureBox(); radPictureBox1 = new Telerik.WinControls.UI.RadPictureBox();
layoutControlLabelItem1 = new Telerik.WinControls.UI.LayoutControlLabelItem(); layoutControlLabelItem1 = new Telerik.WinControls.UI.LayoutControlLabelItem();
panel1.SuspendLayout(); tableLayoutPanel1 = new TableLayoutPanel();
((System.ComponentModel.ISupportInitialize)radButton_Cancel).BeginInit(); ((System.ComponentModel.ISupportInitialize)radButton_Cancel).BeginInit();
((System.ComponentModel.ISupportInitialize)radButton_Install).BeginInit(); ((System.ComponentModel.ISupportInitialize)radButton_Install).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel10).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel10).BeginInit();
@@ -72,55 +71,33 @@ namespace Pilz.Updating.Client.GUI
((System.ComponentModel.ISupportInitialize)radLabel2).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel2).BeginInit();
((System.ComponentModel.ISupportInitialize)radLabel1).BeginInit(); ((System.ComponentModel.ISupportInitialize)radLabel1).BeginInit();
((System.ComponentModel.ISupportInitialize)radPictureBox1).BeginInit(); ((System.ComponentModel.ISupportInitialize)radPictureBox1).BeginInit();
((System.ComponentModel.ISupportInitialize)this).BeginInit(); tableLayoutPanel1.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// panel1
//
panel1.BackColor = Color.Transparent;
panel1.Controls.Add(radButton_Cancel);
panel1.Controls.Add(radButton_Install);
panel1.Controls.Add(panel_ChangelogPanel);
panel1.Controls.Add(radLabel10);
panel1.Controls.Add(radLabel_CurrentVersionBuild);
panel1.Controls.Add(radLabel7);
panel1.Controls.Add(radLabel_AvailableVersionBuild);
panel1.Controls.Add(radLabel9);
panel1.Controls.Add(radLabel_CurrentVersionChannel);
panel1.Controls.Add(radLabel3);
panel1.Controls.Add(radLabel_AvailableVersionChannel);
panel1.Controls.Add(radLabel4);
panel1.Controls.Add(radLabel_CurrentVersion);
panel1.Controls.Add(radLabel5);
panel1.Controls.Add(radLabel_AvailableVersion);
panel1.Controls.Add(radLabel2);
panel1.Controls.Add(radLabel1);
panel1.Controls.Add(radPictureBox1);
resources.ApplyResources(panel1, "panel1");
panel1.Name = "panel1";
//
// radButton_Cancel // radButton_Cancel
// //
resources.ApplyResources(radButton_Cancel, "radButton_Cancel"); resources.ApplyResources(radButton_Cancel, "radButton_Cancel");
radButton_Cancel.DialogResult = DialogResult.Cancel; tableLayoutPanel1.SetColumnSpan(radButton_Cancel, 2);
radButton_Cancel.Image = MyIcons.icons8_delete_16px;
radButton_Cancel.Name = "radButton_Cancel"; radButton_Cancel.Name = "radButton_Cancel";
radButton_Cancel.Click += RadButton_Cancel_Click;
// //
// radButton_Install // radButton_Install
// //
resources.ApplyResources(radButton_Install, "radButton_Install"); resources.ApplyResources(radButton_Install, "radButton_Install");
radButton_Install.DialogResult = DialogResult.OK; tableLayoutPanel1.SetColumnSpan(radButton_Install, 2);
radButton_Install.Image = MyIcons.icons8_software_installer_16px;
radButton_Install.Name = "radButton_Install"; radButton_Install.Name = "radButton_Install";
radButton_Install.Click += RadButton_Install_Click;
// //
// panel_ChangelogPanel // panel_ChangelogPanel
// //
resources.ApplyResources(panel_ChangelogPanel, "panel_ChangelogPanel"); resources.ApplyResources(panel_ChangelogPanel, "panel_ChangelogPanel");
tableLayoutPanel1.SetColumnSpan(panel_ChangelogPanel, 7);
panel_ChangelogPanel.Name = "panel_ChangelogPanel"; panel_ChangelogPanel.Name = "panel_ChangelogPanel";
// //
// radLabel10 // radLabel10
// //
resources.ApplyResources(radLabel10, "radLabel10"); resources.ApplyResources(radLabel10, "radLabel10");
tableLayoutPanel1.SetColumnSpan(radLabel10, 2);
radLabel10.Name = "radLabel10"; radLabel10.Name = "radLabel10";
// //
// radLabel_CurrentVersionBuild // radLabel_CurrentVersionBuild
@@ -171,6 +148,7 @@ namespace Pilz.Updating.Client.GUI
// radLabel5 // radLabel5
// //
resources.ApplyResources(radLabel5, "radLabel5"); resources.ApplyResources(radLabel5, "radLabel5");
tableLayoutPanel1.SetColumnSpan(radLabel5, 2);
radLabel5.Name = "radLabel5"; radLabel5.Name = "radLabel5";
// //
// radLabel_AvailableVersion // radLabel_AvailableVersion
@@ -181,11 +159,13 @@ namespace Pilz.Updating.Client.GUI
// radLabel2 // radLabel2
// //
resources.ApplyResources(radLabel2, "radLabel2"); resources.ApplyResources(radLabel2, "radLabel2");
tableLayoutPanel1.SetColumnSpan(radLabel2, 2);
radLabel2.Name = "radLabel2"; radLabel2.Name = "radLabel2";
// //
// radLabel1 // radLabel1
// //
resources.ApplyResources(radLabel1, "radLabel1"); resources.ApplyResources(radLabel1, "radLabel1");
tableLayoutPanel1.SetColumnSpan(radLabel1, 6);
radLabel1.Name = "radLabel1"; radLabel1.Name = "radLabel1";
// //
// radPictureBox1 // radPictureBox1
@@ -203,19 +183,36 @@ namespace Pilz.Updating.Client.GUI
layoutControlLabelItem1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; layoutControlLabelItem1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
layoutControlLabelItem1.UseCompatibleTextRendering = false; layoutControlLabelItem1.UseCompatibleTextRendering = false;
// //
// tableLayoutPanel1
//
resources.ApplyResources(tableLayoutPanel1, "tableLayoutPanel1");
tableLayoutPanel1.Controls.Add(radButton_Install, 3, 5);
tableLayoutPanel1.Controls.Add(radButton_Cancel, 5, 5);
tableLayoutPanel1.Controls.Add(radPictureBox1, 0, 0);
tableLayoutPanel1.Controls.Add(radLabel1, 1, 0);
tableLayoutPanel1.Controls.Add(panel_ChangelogPanel, 0, 4);
tableLayoutPanel1.Controls.Add(radLabel5, 0, 1);
tableLayoutPanel1.Controls.Add(radLabel10, 0, 3);
tableLayoutPanel1.Controls.Add(radLabel_CurrentVersion, 2, 1);
tableLayoutPanel1.Controls.Add(radLabel4, 3, 2);
tableLayoutPanel1.Controls.Add(radLabel3, 3, 1);
tableLayoutPanel1.Controls.Add(radLabel_CurrentVersionChannel, 4, 1);
tableLayoutPanel1.Controls.Add(radLabel_AvailableVersionChannel, 4, 2);
tableLayoutPanel1.Controls.Add(radLabel9, 5, 2);
tableLayoutPanel1.Controls.Add(radLabel7, 5, 1);
tableLayoutPanel1.Controls.Add(radLabel_CurrentVersionBuild, 6, 1);
tableLayoutPanel1.Controls.Add(radLabel_AvailableVersionBuild, 6, 2);
tableLayoutPanel1.Controls.Add(radLabel2, 0, 2);
tableLayoutPanel1.Controls.Add(radLabel_AvailableVersion, 2, 2);
tableLayoutPanel1.Name = "tableLayoutPanel1";
//
// UpdatesAvailableDialog // UpdatesAvailableDialog
// //
AcceptButton = radButton_Install;
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
CancelButton = radButton_Cancel; Controls.Add(tableLayoutPanel1);
Controls.Add(panel1);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
MinimizeBox = false;
Name = "UpdatesAvailableDialog"; Name = "UpdatesAvailableDialog";
panel1.ResumeLayout(false); Controls.SetChildIndex(tableLayoutPanel1, 0);
panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)radButton_Cancel).EndInit(); ((System.ComponentModel.ISupportInitialize)radButton_Cancel).EndInit();
((System.ComponentModel.ISupportInitialize)radButton_Install).EndInit(); ((System.ComponentModel.ISupportInitialize)radButton_Install).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel10).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel10).EndInit();
@@ -233,11 +230,10 @@ namespace Pilz.Updating.Client.GUI
((System.ComponentModel.ISupportInitialize)radLabel2).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel2).EndInit();
((System.ComponentModel.ISupportInitialize)radLabel1).EndInit(); ((System.ComponentModel.ISupportInitialize)radLabel1).EndInit();
((System.ComponentModel.ISupportInitialize)radPictureBox1).EndInit(); ((System.ComponentModel.ISupportInitialize)radPictureBox1).EndInit();
((System.ComponentModel.ISupportInitialize)this).EndInit(); tableLayoutPanel1.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
} }
private Panel panel1;
private Telerik.WinControls.UI.RadPictureBox radPictureBox1; private Telerik.WinControls.UI.RadPictureBox radPictureBox1;
private Telerik.WinControls.UI.RadLabel radLabel1; private Telerik.WinControls.UI.RadLabel radLabel1;
private Telerik.WinControls.UI.RadLabel radLabel_CurrentVersion; private Telerik.WinControls.UI.RadLabel radLabel_CurrentVersion;
@@ -257,5 +253,6 @@ namespace Pilz.Updating.Client.GUI
private Telerik.WinControls.UI.RadLabel radLabel10; private Telerik.WinControls.UI.RadLabel radLabel10;
private Telerik.WinControls.UI.RadButton radButton_Cancel; private Telerik.WinControls.UI.RadButton radButton_Cancel;
private Telerik.WinControls.UI.RadButton radButton_Install; private Telerik.WinControls.UI.RadButton radButton_Install;
private TableLayoutPanel tableLayoutPanel1;
} }
} }

View File

@@ -1,18 +1,29 @@
using Pilz.Updating.GUIBase; using Pilz.UI.Telerik;
using Pilz.UI.Telerik.Dialogs;
using Pilz.Updating.GUIBase;
using Telerik.WinControls.UI; using Telerik.WinControls.UI;
namespace Pilz.Updating.Client.GUI; namespace Pilz.Updating.Client.GUI;
internal partial class UpdatesAvailableDialog internal partial class UpdatesAvailableDialog : RadFlyoutBase
{ {
public UpdatesAvailableDialog(Image appIcon, string curVersion, string curChannel, string curBuild, string newVersion, string newChannel, string newBuild, UpdateNotes updateNotes, bool installAsAdmin) public UpdatesAvailableDialog(Image appIcon, string curVersion, string curChannel, string curBuild, string newVersion, string newChannel, string newBuild, UpdateNotes updateNotes, bool installAsAdmin)
{ {
InitializeComponent(); InitializeComponent();
ActionPanelVisible = false;
radButton_Cancel.SvgImage = GlobalSymbolFactory.Instance.GetSvgImage(GlobalSymbols.software_installer, SvgImageSize.Small);
if (installAsAdmin) if (installAsAdmin)
radButton_Install.Image = BaseFeatures.GetUacShieldImage(); radButton_Install.Image = BaseFeatures.GetUacShieldImage();
else
radButton_Install.SvgImage = GlobalSymbolFactory.Instance.GetSvgImage(GlobalSymbols.software_installer, SvgImageSize.Small);
if (appIcon == null)
radPictureBox1.SvgImage = GlobalSymbolFactory.Instance.GetSvgImage(GlobalSymbols.software_installer, SvgImageSize.Large);
else
radPictureBox1.Image = appIcon;
radPictureBox1.Image = appIcon ?? Icon.ToBitmap();
radLabel_CurrentVersion.Text = curVersion; radLabel_CurrentVersion.Text = curVersion;
radLabel_CurrentVersionChannel.Text = curChannel; radLabel_CurrentVersionChannel.Text = curChannel;
radLabel_CurrentVersionBuild.Text = curBuild; radLabel_CurrentVersionBuild.Text = curBuild;
@@ -20,34 +31,85 @@ internal partial class UpdatesAvailableDialog
radLabel_AvailableVersionChannel.Text = newChannel; radLabel_AvailableVersionChannel.Text = newChannel;
radLabel_AvailableVersionBuild.Text = newBuild; radLabel_AvailableVersionBuild.Text = newBuild;
// Update Notes SetNotes(updateNotes);
Control updateNotesControl = null; }
private void SetNotes(UpdateNotes updateNotes)
{
// Internal
if (updateNotes.Mode == UpdateNotesMode.Internal && !string.IsNullOrWhiteSpace(updateNotes.ContentUrl) && TryDownloadContent(updateNotes.ContentUrl) is string content)
{
switch (updateNotes.ContentType) switch (updateNotes.ContentType)
{ {
case UpdateNotesContentType.PlainText: case UpdateNotesContentType.PlainText:
var newUpdateNotesControl = new RadRichTextEditor SetNotesControls(new RadRichTextEditor
{ {
Text = updateNotes.Content Text = content
}; });
updateNotesControl = newUpdateNotesControl; return;
break;
case UpdateNotesContentType.Markdown: case UpdateNotesContentType.Markdown:
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel SetNotesControls(new Westermo.HtmlRenderer.WinForms.HtmlPanel
{ {
Text = Markdig.Markdown.ToHtml(updateNotes.Content) Text = Markdig.Markdown.ToHtml(content)
}; });
break; return;
case UpdateNotesContentType.HTML: case UpdateNotesContentType.HTML:
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel SetNotesControls(new Westermo.HtmlRenderer.WinForms.HtmlPanel
{ {
Text = updateNotes.Content Text = content
}; });
break; return;
} }
if (updateNotesControl is not null) }
// External
if (updateNotes.Mode == UpdateNotesMode.External && !string.IsNullOrWhiteSpace(updateNotes.ExternalUrl))
{
var label = new RadLabel
{
AutoSize = false,
Text = string.Format(LangRes.NotesLinkToExternal, updateNotes.ExternalUrl),
TextAlignment = ContentAlignment.MiddleCenter,
};
SetNotesControls(label);
return;
}
// None or not supported or fallback
SetNotesControls(new RadLabel
{
AutoSize = false,
Text = LangRes.NotesNotAvailable,
TextAlignment = ContentAlignment.MiddleCenter,
});
return;
}
private void SetNotesControls(Control updateNotesControl)
{ {
updateNotesControl.Dock = DockStyle.Fill; updateNotesControl.Dock = DockStyle.Fill;
panel_ChangelogPanel.Controls.Add(updateNotesControl); panel_ChangelogPanel.Controls.Add(updateNotesControl);
} }
private static string TryDownloadContent(string contentUrl)
{
try
{
return new HttpClient().GetStringAsync(contentUrl).Result;
}
catch
{
}
return null;
}
private void RadButton_Install_Click(object sender, EventArgs e)
{
Close(DialogResult.OK);
}
private void RadButton_Cancel_Click(object sender, EventArgs e)
{
Close(DialogResult.Cancel);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
using Pilz.UI.Telerik;
using System.Reflection;
namespace Pilz.Updating.GUIBase;
public class GlobalSymbolFactory : SymbolFactory<GlobalSymbols>
{
public static GlobalSymbolFactory Instance { get; } = new();
public override Assembly GetSvgImageResourceAssembly()
{
return Assembly.GetExecutingAssembly();
}
public override string GetSvgImageRessourcePath(GlobalSymbols svgImage)
{
return $"{GetType().Namespace}.Symbols.{Enum.GetName(svgImage)}.svg";
}
}

View File

@@ -0,0 +1,7 @@
namespace Pilz.Updating.GUIBase;
public enum GlobalSymbols
{
cancel,
software_installer,
}

View File

@@ -10,6 +10,10 @@
<Version>2.0.0</Version> <Version>2.0.0</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Symbols\*.svg" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
@@ -42,6 +46,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" /> <PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Pilz.UI.Telerik.SymbolFactory" Version="2.0.3" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" /> <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" /> <PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup> </ItemGroup>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="32" height="32">
<path fill="#f44336" d="M44,24c0,11-9,20-20,20S4,35,4,24S13,4,24,4S44,13,44,24z" />
<line x1="16.9" x2="31.1" y1="16.9" y2="31.1" fill="none" stroke="#fff" stroke-width="4" />
<line x1="31.1" x2="16.9" y1="16.9" y2="31.1" fill="none" stroke="#fff" stroke-width="4" />
</svg>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 48 48">
<path fill="#78909C" d="M6,29v10c0,2.209,1.791,4,4,4h28c2.209,0,4-1.791,4-4V29H6z" />
<path fill="#455A64" d="M42,29c0,2.209-1.791,4-4,4H10c-2.209,0-4-1.791-4-4l3-18c0.219-2.094,1.791-4,4-4h22c2.209,0,3.688,1.75,4,4L42,29z" />
<path fill="#64DD17" d="M35 36A2 2 0 1 0 35 40A2 2 0 1 0 35 36Z" />
<path fill="#00E5FF" d="M24.001 27.242L32 19.242 16 19.242z" />
<path fill="#00E5FF" d="M21 4H26.998V19.999000000000002H21z" />
</svg>