small code refactoring
This commit is contained in:
@@ -1,11 +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>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>Form1</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>0</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
@@ -1,8 +0,0 @@
|
||||
using global::System;
|
||||
using global::System.Reflection;
|
||||
using global::System.Runtime.InteropServices;
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
[assembly: Guid("f26b0b17-862f-42e2-afd5-340ef6761192")]
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
namespace Pilz.Updating.Client.GUI.My
|
||||
{
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
||||
internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.ApplicationBase
|
||||
{
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
}
|
||||
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer
|
||||
{
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
[DebuggerHidden()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public MyComputer() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
[HideModuleName()]
|
||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
||||
internal static class MyProject
|
||||
{
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.Computer")]
|
||||
internal static MyComputer Computer
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_ComputerObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new ThreadSafeObjectProvider<MyComputer>();
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.Application")]
|
||||
internal static MyApplication Application
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_AppObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new ThreadSafeObjectProvider<MyApplication>();
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.User")]
|
||||
internal static Microsoft.VisualBasic.ApplicationServices.User User
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_UserObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User> m_UserObjectProvider = new ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User>();
|
||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[System.ComponentModel.Design.HelpKeyword("My.WebServices")]
|
||||
internal static MyWebServices WebServices
|
||||
{
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
return m_MyWebServicesObjectProvider.GetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
|
||||
internal sealed class MyWebServices
|
||||
{
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
public override bool Equals(object o)
|
||||
{
|
||||
return base.Equals(o);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
internal new Type GetType()
|
||||
{
|
||||
return typeof(MyWebServices);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[DebuggerHidden()]
|
||||
public override string ToString()
|
||||
{
|
||||
return base.ToString();
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
private static T Create__Instance__<T>(T instance) where T : new()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
else
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
private void Dispose__Instance__<T>(ref T instance)
|
||||
{
|
||||
instance = default;
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public MyWebServices() : base()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private readonly static ThreadSafeObjectProvider<MyWebServices> m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider<MyWebServices>();
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[System.Runtime.InteropServices.ComVisible(false)]
|
||||
internal sealed class ThreadSafeObjectProvider<T> where T : new()
|
||||
{
|
||||
internal T GetInstance
|
||||
{
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
[DebuggerHidden()]
|
||||
get
|
||||
{
|
||||
var Value = m_Context.Value;
|
||||
if (Value == null)
|
||||
{
|
||||
Value = new T();
|
||||
m_Context.Value = Value;
|
||||
}
|
||||
|
||||
return Value;
|
||||
}
|
||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
}
|
||||
|
||||
[DebuggerHidden()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public ThreadSafeObjectProvider() : base()
|
||||
{
|
||||
}
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
||||
private readonly Microsoft.VisualBasic.MyServices.Internal.ContextValue<T> m_Context = new Microsoft.VisualBasic.MyServices.Internal.ContextValue<T>();
|
||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
@@ -1,253 +0,0 @@
|
||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// See Compiler::LoadXmlSolutionExtension
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.VisualBasic;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
|
||||
namespace Pilz.Updating.Client.GUI.My
|
||||
{
|
||||
[Embedded()]
|
||||
[DebuggerNonUserCode()]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal sealed class InternalXmlHelper
|
||||
{
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private InternalXmlHelper()
|
||||
{
|
||||
}
|
||||
|
||||
public static string get_Value(IEnumerable<XElement> source)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
return item.Value;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void set_Value(IEnumerable<XElement> source, string value)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
{
|
||||
item.Value = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
return Conversions.ToString(item.Attribute(name));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
||||
{
|
||||
foreach (XElement item in source)
|
||||
{
|
||||
item.SetAttributeValue(name, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static string get_AttributeValue(XElement source, XName name)
|
||||
{
|
||||
return Conversions.ToString(source.Attribute(name));
|
||||
}
|
||||
|
||||
public static void set_AttributeValue(XElement source, XName name, string value)
|
||||
{
|
||||
source.SetAttributeValue(name, value);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static XAttribute CreateAttribute(XName name, object value)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new XAttribute(name, value);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
||||
{
|
||||
var a = new XAttribute(name, ns.NamespaceName);
|
||||
a.AddAnnotation(ns);
|
||||
return a;
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static object RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, object obj)
|
||||
{
|
||||
if (obj is object)
|
||||
{
|
||||
XElement elem = obj as XElement;
|
||||
if (elem is object)
|
||||
{
|
||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elem);
|
||||
}
|
||||
else
|
||||
{
|
||||
IEnumerable elems = obj as IEnumerable;
|
||||
if (elems is object)
|
||||
{
|
||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elems);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static IEnumerable RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, IEnumerable obj)
|
||||
{
|
||||
if (obj is object)
|
||||
{
|
||||
IEnumerable<XElement> elems = obj as IEnumerable<XElement>;
|
||||
if (elems is object)
|
||||
{
|
||||
return elems.Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessXElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj.Cast<object>().Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject);
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
[DebuggerNonUserCode()]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
private sealed class RemoveNamespaceAttributesClosure
|
||||
{
|
||||
private readonly string[] m_inScopePrefixes;
|
||||
private readonly XNamespace[] m_inScopeNs;
|
||||
private readonly List<XAttribute> m_attributes;
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal RemoveNamespaceAttributesClosure(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes)
|
||||
{
|
||||
m_inScopePrefixes = inScopePrefixes;
|
||||
m_inScopeNs = inScopeNs;
|
||||
m_attributes = attributes;
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal XElement ProcessXElement(XElement elem)
|
||||
{
|
||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal object ProcessObject(object obj)
|
||||
{
|
||||
XElement elem = obj as XElement;
|
||||
if (elem is object)
|
||||
{
|
||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static XElement RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, XElement e)
|
||||
{
|
||||
if (e is object)
|
||||
{
|
||||
var a = e.FirstAttribute;
|
||||
while (a is object)
|
||||
{
|
||||
var nextA = a.NextAttribute;
|
||||
if (a.IsNamespaceDeclaration)
|
||||
{
|
||||
var ns = a.Annotation<XNamespace>();
|
||||
string prefix = a.Name.LocalName;
|
||||
if (ns is object)
|
||||
{
|
||||
if (inScopePrefixes is object && inScopeNs is object)
|
||||
{
|
||||
int lastIndex = inScopePrefixes.Length - 1;
|
||||
for (int i = 0, loopTo = lastIndex; i <= loopTo; i++)
|
||||
{
|
||||
string currentInScopePrefix = inScopePrefixes[i];
|
||||
var currentInScopeNs = inScopeNs[i];
|
||||
if (prefix.Equals(currentInScopePrefix))
|
||||
{
|
||||
if (ns == currentInScopeNs)
|
||||
{
|
||||
// prefix and namespace match. Remove the unneeded ns attribute
|
||||
a.Remove();
|
||||
}
|
||||
|
||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
||||
a = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (a is object)
|
||||
{
|
||||
// Prefix is not in scope
|
||||
// Now check whether it's going to be in scope because it is in the attributes list
|
||||
|
||||
if (attributes is object)
|
||||
{
|
||||
int lastIndex = attributes.Count - 1;
|
||||
for (int i = 0, loopTo1 = lastIndex; i <= loopTo1; i++)
|
||||
{
|
||||
var currentA = attributes[i];
|
||||
string currentInScopePrefix = currentA.Name.LocalName;
|
||||
var currentInScopeNs = currentA.Annotation<XNamespace>();
|
||||
if (currentInScopeNs is object)
|
||||
{
|
||||
if (prefix.Equals(currentInScopePrefix))
|
||||
{
|
||||
if (ns == currentInScopeNs)
|
||||
{
|
||||
// prefix and namespace match. Remove the unneeded ns attribute
|
||||
a.Remove();
|
||||
}
|
||||
|
||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
||||
a = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (a is object)
|
||||
{
|
||||
// Prefix is definitely not in scope
|
||||
a.Remove();
|
||||
// namespace is not defined either. Add this attributes list
|
||||
attributes.Add(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a = nextA;
|
||||
}
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.VisualBasic
|
||||
{
|
||||
[Embedded()]
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Module | AttributeTargets.Assembly, Inherited = false)]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
internal sealed class Embedded : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -1,52 +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>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualBasic;
|
||||
|
||||
namespace Pilz.Updating.Client.GUI.My
|
||||
{
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
[System.CodeDom.Compiler.GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal sealed partial class MySettings : System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
private static MySettings defaultInstance = (MySettings)Synchronized(new MySettings());
|
||||
|
||||
/* TODO ERROR: Skipped RegionDirectiveTrivia *//* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia *//* TODO ERROR: Skipped EndRegionDirectiveTrivia */
|
||||
public static MySettings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Pilz.Updating.Client.GUI.My
|
||||
{
|
||||
[HideModuleName()]
|
||||
[DebuggerNonUserCode()]
|
||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
||||
internal static class MySettingsProperty
|
||||
{
|
||||
[System.ComponentModel.Design.HelpKeyword("My.Settings")]
|
||||
internal static MySettings Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return MySettings.Default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,8 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
<RootNamespace>SM64_ROM_Manager.Updating.Client.GUI</RootNamespace>
|
||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
||||
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||
<LangVersion>latest</LangVersion>
|
||||
@@ -38,7 +37,6 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Version>2.0.0</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -46,9 +44,6 @@
|
||||
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
||||
<Version>2023.1.117</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
@@ -83,20 +78,11 @@
|
||||
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="My Project\Application.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="My Project\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Update="UpdatingClientGuiLangRes.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
@@ -137,17 +123,6 @@
|
||||
<LastGenOutput>UpdatingClientGuiLangRes.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>SM64_ROM_Manager.Updating.Client.GUI.My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" />
|
||||
<ProjectReference Include="..\Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj" />
|
||||
@@ -155,8 +130,10 @@
|
||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Markdig" Version="0.33.0" />
|
||||
<PackageReference Include="Markdig" Version="0.37.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
<PackageReference Include="UI.for.WinForms.Common" Version="2024.2.514" />
|
||||
<PackageReference Include="UI.for.WinForms.RichTextEditor" Version="2024.2.514" />
|
||||
<PackageReference Include="Westermo.HtmlRenderer.WinForms" Version="1.6.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
namespace Pilz.Updating.Client.GUI
|
||||
namespace Pilz.Updating.Client.GUI;
|
||||
|
||||
public partial class SimpleActionDialog
|
||||
{
|
||||
public partial class SimpleActionDialog
|
||||
public SimpleActionDialog()
|
||||
{
|
||||
public SimpleActionDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetCurrentState(UpdateStatus.Waiting);
|
||||
}
|
||||
InitializeComponent();
|
||||
SetCurrentState(UpdateStatus.Waiting);
|
||||
}
|
||||
|
||||
public void SetCurrentState(UpdateStatus curAction)
|
||||
public void SetCurrentState(UpdateStatus curAction)
|
||||
{
|
||||
string progressText = curAction switch
|
||||
{
|
||||
string progressText = curAction switch
|
||||
{
|
||||
UpdateStatus.Waiting => UpdatingClientGuiLangRes.SimpleActions_Waiting,
|
||||
UpdateStatus.Searching => UpdatingClientGuiLangRes.SimpleActions_Searching,
|
||||
UpdateStatus.DownloadingPackage => UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage,
|
||||
UpdateStatus.DownloadingInstaller => UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller,
|
||||
UpdateStatus.StartingInstaller => UpdatingClientGuiLangRes.SimpleActions_StartingInstaller,
|
||||
_ => string.Empty,
|
||||
};
|
||||
UpdateStatus.Waiting => UpdatingClientGuiLangRes.SimpleActions_Waiting,
|
||||
UpdateStatus.Searching => UpdatingClientGuiLangRes.SimpleActions_Searching,
|
||||
UpdateStatus.DownloadingPackage => UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage,
|
||||
UpdateStatus.DownloadingInstaller => UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller,
|
||||
UpdateStatus.StartingInstaller => UpdatingClientGuiLangRes.SimpleActions_StartingInstaller,
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
radProgressBar1.Visible = false;
|
||||
radWaitingBar1.Text = progressText;
|
||||
radWaitingBar1.BringToFront();
|
||||
radWaitingBar1.StartWaiting();
|
||||
}
|
||||
radProgressBar1.Visible = false;
|
||||
radWaitingBar1.Text = progressText;
|
||||
radWaitingBar1.BringToFront();
|
||||
radWaitingBar1.StartWaiting();
|
||||
}
|
||||
}
|
||||
@@ -1,146 +1,144 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
using System;
|
||||
using Telerik.WinControls;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
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
|
||||
|
||||
private Form parentForm;
|
||||
private UpdateClient _UpdateClient;
|
||||
|
||||
private UpdateClient UpdateClient
|
||||
{
|
||||
|
||||
// F i e l d s
|
||||
|
||||
private Form parentForm;
|
||||
private UpdateClient _UpdateClient;
|
||||
|
||||
private UpdateClient UpdateClient
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
get
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
get
|
||||
return _UpdateClient;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
set
|
||||
{
|
||||
if (_UpdateClient != null)
|
||||
{
|
||||
return _UpdateClient;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
set
|
||||
_UpdateClient = value;
|
||||
if (_UpdateClient != null)
|
||||
{
|
||||
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
|
||||
|
||||
public bool UseHiddenSearch { get; set; } = false;
|
||||
|
||||
private static Image MyAppIcon => Icon.ExtractAssociatedIcon(IO.Extensions.GetExecutablePath()).ToBitmap();
|
||||
|
||||
// C o n s t r u c t o r s
|
||||
|
||||
public UpdateClientGUI(UpdateClient updateClient)
|
||||
{
|
||||
UpdateClient = updateClient;
|
||||
}
|
||||
|
||||
// F e a t u r e s
|
||||
|
||||
public async Task UpdateInteractive(Form parentForm)
|
||||
{
|
||||
this.parentForm = parentForm;
|
||||
await UpdateClient.UpdateInteractive();
|
||||
}
|
||||
|
||||
private void EndUpdating()
|
||||
{
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close()));
|
||||
UpdateClient = null;
|
||||
}
|
||||
|
||||
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus)
|
||||
{
|
||||
bool useGui = false;
|
||||
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch))
|
||||
{
|
||||
useGui = true;
|
||||
}
|
||||
|
||||
if (useGui && curProgressDialog is null)
|
||||
{
|
||||
parentForm.Invoke(new Action(() =>
|
||||
{
|
||||
curProgressDialog = new SimpleActionDialog();
|
||||
curProgressDialog.SetCurrentState(UpdateStatus.Waiting);
|
||||
curProgressDialog.Show(parentForm);
|
||||
}));
|
||||
}
|
||||
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus)));
|
||||
}
|
||||
|
||||
private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||
{
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Hide()));
|
||||
var dres = default(DialogResult);
|
||||
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);
|
||||
dres = dialog.ShowDialog(parentForm);
|
||||
}));
|
||||
if (dres != DialogResult.OK)
|
||||
{
|
||||
e.Cancel = true;
|
||||
EndUpdating();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = false;
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Show()));
|
||||
}
|
||||
}
|
||||
|
||||
private void MyUpdateClient_InstallingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = false;
|
||||
}
|
||||
|
||||
private void MyUpdateClient_FinishWork()
|
||||
{
|
||||
EndUpdating();
|
||||
}
|
||||
|
||||
private void MyUpdateClient_NoUpdatesFound()
|
||||
{
|
||||
EndUpdating();
|
||||
if (!UseHiddenSearch)
|
||||
{
|
||||
RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
_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
|
||||
|
||||
public bool UseHiddenSearch { get; set; } = false;
|
||||
|
||||
private static Image MyAppIcon => Icon.ExtractAssociatedIcon(IO.Extensions.GetExecutablePath()).ToBitmap();
|
||||
|
||||
// C o n s t r u c t o r s
|
||||
|
||||
public UpdateClientGUI(UpdateClient updateClient)
|
||||
{
|
||||
UpdateClient = updateClient;
|
||||
}
|
||||
|
||||
// F e a t u r e s
|
||||
|
||||
public async Task UpdateInteractive(Form parentForm)
|
||||
{
|
||||
this.parentForm = parentForm;
|
||||
await UpdateClient.UpdateInteractive();
|
||||
}
|
||||
|
||||
private void EndUpdating()
|
||||
{
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close()));
|
||||
UpdateClient = null;
|
||||
}
|
||||
|
||||
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus)
|
||||
{
|
||||
bool useGui = false;
|
||||
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch))
|
||||
{
|
||||
useGui = true;
|
||||
}
|
||||
|
||||
if (useGui && curProgressDialog is null)
|
||||
{
|
||||
parentForm.Invoke(new Action(() =>
|
||||
{
|
||||
curProgressDialog = new SimpleActionDialog();
|
||||
curProgressDialog.SetCurrentState(UpdateStatus.Waiting);
|
||||
curProgressDialog.Show(parentForm);
|
||||
}));
|
||||
}
|
||||
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus)));
|
||||
}
|
||||
|
||||
private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||
{
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Hide()));
|
||||
var dres = default(DialogResult);
|
||||
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);
|
||||
dres = dialog.ShowDialog(parentForm);
|
||||
}));
|
||||
if (dres != DialogResult.OK)
|
||||
{
|
||||
e.Cancel = true;
|
||||
EndUpdating();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = false;
|
||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Show()));
|
||||
}
|
||||
}
|
||||
|
||||
private void MyUpdateClient_InstallingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = false;
|
||||
}
|
||||
|
||||
private void MyUpdateClient_FinishWork()
|
||||
{
|
||||
EndUpdating();
|
||||
}
|
||||
|
||||
private void MyUpdateClient_NoUpdatesFound()
|
||||
{
|
||||
EndUpdating();
|
||||
if (!UseHiddenSearch)
|
||||
{
|
||||
RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +1,55 @@
|
||||
using System.Drawing;
|
||||
using Pilz.Updating.GUIBase;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Pilz.Updating.GUIBase;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace Pilz.Updating.Client.GUI
|
||||
namespace Pilz.Updating.Client.GUI;
|
||||
|
||||
internal partial class UpdatesAvailableDialog
|
||||
{
|
||||
internal partial class UpdatesAvailableDialog
|
||||
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();
|
||||
|
||||
if (installAsAdmin)
|
||||
radButton_Install.Image = BaseFeatures.GetUacShieldImage();
|
||||
|
||||
radPictureBox1.Image = appIcon ?? Icon.ToBitmap();
|
||||
radLabel_CurrentVersion.Text = curVersion;
|
||||
radLabel_CurrentVersionChannel.Text = curChannel;
|
||||
radLabel_CurrentVersionBuild.Text = curBuild;
|
||||
radLabel_AvailableVersion.Text = newVersion;
|
||||
radLabel_AvailableVersionChannel.Text = newChannel;
|
||||
radLabel_AvailableVersionBuild.Text = newBuild;
|
||||
|
||||
// Update Notes
|
||||
Control updateNotesControl = null;
|
||||
switch (updateNotes.ContentType)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (installAsAdmin)
|
||||
radButton_Install.Image = BaseFeatures.GetUacShieldImage();
|
||||
|
||||
radPictureBox1.Image = appIcon ?? Icon.ToBitmap();
|
||||
radLabel_CurrentVersion.Text = curVersion;
|
||||
radLabel_CurrentVersionChannel.Text = curChannel;
|
||||
radLabel_CurrentVersionBuild.Text = curBuild;
|
||||
radLabel_AvailableVersion.Text = newVersion;
|
||||
radLabel_AvailableVersionChannel.Text = newChannel;
|
||||
radLabel_AvailableVersionBuild.Text = newBuild;
|
||||
|
||||
// Update Notes
|
||||
Control updateNotesControl = null;
|
||||
switch (updateNotes.ContentType)
|
||||
{
|
||||
case UpdateNotesContentType.PlainText:
|
||||
var newUpdateNotesControl = new RadRichTextEditor
|
||||
{
|
||||
Text = updateNotes.Content
|
||||
};
|
||||
updateNotesControl = newUpdateNotesControl;
|
||||
break;
|
||||
case UpdateNotesContentType.Markdown:
|
||||
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
||||
{
|
||||
Text = Markdig.Markdown.ToHtml(updateNotes.Content)
|
||||
};
|
||||
break;
|
||||
case UpdateNotesContentType.HTML:
|
||||
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
||||
{
|
||||
Text = updateNotes.Content
|
||||
};
|
||||
break;
|
||||
}
|
||||
if (updateNotesControl is not null)
|
||||
{
|
||||
updateNotesControl.Dock = DockStyle.Fill;
|
||||
panel_ChangelogPanel.Controls.Add(updateNotesControl);
|
||||
}
|
||||
case UpdateNotesContentType.PlainText:
|
||||
var newUpdateNotesControl = new RadRichTextEditor
|
||||
{
|
||||
Text = updateNotes.Content
|
||||
};
|
||||
updateNotesControl = newUpdateNotesControl;
|
||||
break;
|
||||
case UpdateNotesContentType.Markdown:
|
||||
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
||||
{
|
||||
Text = Markdig.Markdown.ToHtml(updateNotes.Content)
|
||||
};
|
||||
break;
|
||||
case UpdateNotesContentType.HTML:
|
||||
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
||||
{
|
||||
Text = updateNotes.Content
|
||||
};
|
||||
break;
|
||||
}
|
||||
if (updateNotesControl is not null)
|
||||
{
|
||||
updateNotesControl.Dock = DockStyle.Fill;
|
||||
panel_ChangelogPanel.Controls.Add(updateNotesControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user