From ef418acffe6f207a4c2b18f69aef633a8c3390e9 Mon Sep 17 00:00:00 2001 From: oZ-Zo <50652175+oz-zo@users.noreply.github.com> Date: Wed, 11 Sep 2019 17:57:24 +0300 Subject: [PATCH] First Powershell GUI --- VS/Windows-10-Setup-Script/App.config | 6 + VS/Windows-10-Setup-Script/App.xaml | 9 + VS/Windows-10-Setup-Script/App.xaml.cs | 17 + VS/Windows-10-Setup-Script/MainWindow.xaml | 661 +++++++++++++++++ VS/Windows-10-Setup-Script/MainWindow.xaml.cs | 28 + .../Properties/AssemblyInfo.cs | 55 ++ .../Properties/Resources.Designer.cs | 71 ++ .../Properties/Resources.resx | 117 +++ .../Properties/Settings.Designer.cs | 30 + .../Properties/Settings.settings | 7 + .../Windows-10-Setup-Script.csproj | 97 +++ .../Windows-10-Setup-Script.sln | 25 + Win-10-Setup-Script-GUI.ps1 | 665 ++++++++++++++++++ 13 files changed, 1788 insertions(+) create mode 100644 VS/Windows-10-Setup-Script/App.config create mode 100644 VS/Windows-10-Setup-Script/App.xaml create mode 100644 VS/Windows-10-Setup-Script/App.xaml.cs create mode 100644 VS/Windows-10-Setup-Script/MainWindow.xaml create mode 100644 VS/Windows-10-Setup-Script/MainWindow.xaml.cs create mode 100644 VS/Windows-10-Setup-Script/Properties/AssemblyInfo.cs create mode 100644 VS/Windows-10-Setup-Script/Properties/Resources.Designer.cs create mode 100644 VS/Windows-10-Setup-Script/Properties/Resources.resx create mode 100644 VS/Windows-10-Setup-Script/Properties/Settings.Designer.cs create mode 100644 VS/Windows-10-Setup-Script/Properties/Settings.settings create mode 100644 VS/Windows-10-Setup-Script/Windows-10-Setup-Script.csproj create mode 100644 VS/Windows-10-Setup-Script/Windows-10-Setup-Script.sln diff --git a/VS/Windows-10-Setup-Script/App.config b/VS/Windows-10-Setup-Script/App.config new file mode 100644 index 00000000..8e156463 --- /dev/null +++ b/VS/Windows-10-Setup-Script/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/VS/Windows-10-Setup-Script/App.xaml b/VS/Windows-10-Setup-Script/App.xaml new file mode 100644 index 00000000..396328aa --- /dev/null +++ b/VS/Windows-10-Setup-Script/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/VS/Windows-10-Setup-Script/App.xaml.cs b/VS/Windows-10-Setup-Script/App.xaml.cs new file mode 100644 index 00000000..5b14d20e --- /dev/null +++ b/VS/Windows-10-Setup-Script/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Windows_10_Setup_Script +{ + /// + /// Логика взаимодействия для App.xaml + /// + public partial class App : Application + { + } +} diff --git a/VS/Windows-10-Setup-Script/MainWindow.xaml b/VS/Windows-10-Setup-Script/MainWindow.xaml new file mode 100644 index 00000000..5e4925c9 --- /dev/null +++ b/VS/Windows-10-Setup-Script/MainWindow.xaml @@ -0,0 +1,661 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VS/Windows-10-Setup-Script/MainWindow.xaml.cs b/VS/Windows-10-Setup-Script/MainWindow.xaml.cs new file mode 100644 index 00000000..f0465e00 --- /dev/null +++ b/VS/Windows-10-Setup-Script/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Windows_10_Setup_Script +{ + /// + /// Логика взаимодействия для MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/VS/Windows-10-Setup-Script/Properties/AssemblyInfo.cs b/VS/Windows-10-Setup-Script/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..996f27c2 --- /dev/null +++ b/VS/Windows-10-Setup-Script/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// Общие сведения об этой сборке предоставляются следующим набором +// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, +// связанные со сборкой. +[assembly: AssemblyTitle("Windows-10-Setup-Script")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Windows-10-Setup-Script")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми +// для компонентов COM. Если необходимо обратиться к типу в этой сборке через +// COM, задайте атрибуту ComVisible значение TRUE для этого типа. +[assembly: ComVisible(false)] + +//Чтобы начать создание локализуемых приложений, задайте +//CultureYouAreCodingWith в файле .csproj +//внутри . Например, если используется английский США +//в своих исходных файлах установите в en-US. Затем отмените преобразование в комментарий +//атрибута NeutralResourceLanguage ниже. Обновите "en-US" в +//строка внизу для обеспечения соответствия настройки UICulture в файле проекта. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //где расположены словари ресурсов по конкретным тематикам + //(используется, если ресурс не найден на странице, + // или в словарях ресурсов приложения) + ResourceDictionaryLocation.SourceAssembly //где расположен словарь универсальных ресурсов + //(используется, если ресурс не найден на странице, + // в приложении или в каких-либо словарях ресурсов для конкретной темы) +)] + + +// Сведения о версии сборки состоят из следующих четырех значений: +// +// Основной номер версии +// Дополнительный номер версии +// Номер сборки +// Редакция +// +// Можно задать все значения или принять номер сборки и номер редакции по умолчанию. +// используя "*", как показано ниже: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VS/Windows-10-Setup-Script/Properties/Resources.Designer.cs b/VS/Windows-10-Setup-Script/Properties/Resources.Designer.cs new file mode 100644 index 00000000..5c63c370 --- /dev/null +++ b/VS/Windows-10-Setup-Script/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программным средством. +// Версия среды выполнения: 4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если +// код создан повторно. +// +//------------------------------------------------------------------------------ + +namespace Windows_10_Setup_Script.Properties +{ + + + /// + /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. + /// + // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder + // класс с помощью таких средств, как ResGen или Visual Studio. + // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen + // с параметром /str или заново постройте свой VS-проект. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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() + { + } + + /// + /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Windows_10_Setup_Script.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Переопределяет свойство CurrentUICulture текущего потока для всех + /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/VS/Windows-10-Setup-Script/Properties/Resources.resx b/VS/Windows-10-Setup-Script/Properties/Resources.resx new file mode 100644 index 00000000..af7dbebb --- /dev/null +++ b/VS/Windows-10-Setup-Script/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VS/Windows-10-Setup-Script/Properties/Settings.Designer.cs b/VS/Windows-10-Setup-Script/Properties/Settings.Designer.cs new file mode 100644 index 00000000..d5f80c0f --- /dev/null +++ b/VS/Windows-10-Setup-Script/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Windows_10_Setup_Script.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/VS/Windows-10-Setup-Script/Properties/Settings.settings b/VS/Windows-10-Setup-Script/Properties/Settings.settings new file mode 100644 index 00000000..033d7a5e --- /dev/null +++ b/VS/Windows-10-Setup-Script/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/VS/Windows-10-Setup-Script/Windows-10-Setup-Script.csproj b/VS/Windows-10-Setup-Script/Windows-10-Setup-Script.csproj new file mode 100644 index 00000000..f0add319 --- /dev/null +++ b/VS/Windows-10-Setup-Script/Windows-10-Setup-Script.csproj @@ -0,0 +1,97 @@ + + + + + Debug + AnyCPU + {D5A79EFF-F519-43EE-9806-A25ED11852C9} + WinExe + Windows_10_Setup_Script + Windows-10-Setup-Script + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/VS/Windows-10-Setup-Script/Windows-10-Setup-Script.sln b/VS/Windows-10-Setup-Script/Windows-10-Setup-Script.sln new file mode 100644 index 00000000..2a23ff17 --- /dev/null +++ b/VS/Windows-10-Setup-Script/Windows-10-Setup-Script.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.757 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windows-10-Setup-Script", "Windows-10-Setup-Script.csproj", "{D5A79EFF-F519-43EE-9806-A25ED11852C9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5A79EFF-F519-43EE-9806-A25ED11852C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5A79EFF-F519-43EE-9806-A25ED11852C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5A79EFF-F519-43EE-9806-A25ED11852C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5A79EFF-F519-43EE-9806-A25ED11852C9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {69F0CDEF-F15E-4CCD-B3F8-E0E1AE85BA4E} + EndGlobalSection +EndGlobal diff --git a/Win-10-Setup-Script-GUI.ps1 b/Win-10-Setup-Script-GUI.ps1 index e69de29b..a9619dec 100644 --- a/Win-10-Setup-Script-GUI.ps1 +++ b/Win-10-Setup-Script-GUI.ps1 @@ -0,0 +1,665 @@ +Add-Type -AssemblyName "PresentationCore", "PresentationFramework", "WindowsBase" + +[xml]$xamlMarkup = @' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +'@ + +$xamlGui = [System.Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xamlMarkup)) +$xamlGui.ShowDialog() +