diff --git a/ModpackUpdater.Apps.Manager/LangRes/MsgBoxLangRes.Designer.cs b/ModpackUpdater.Apps.Manager/LangRes/MsgBoxLangRes.Designer.cs new file mode 100644 index 0000000..8504dae --- /dev/null +++ b/ModpackUpdater.Apps.Manager/LangRes/MsgBoxLangRes.Designer.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace ModpackUpdater.Apps.Manager.LangRes { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // 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 MsgBoxLangRes { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MsgBoxLangRes() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [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("ModpackUpdater.Apps.Manager.LangRes.MsgBoxLangRes", typeof(MsgBoxLangRes).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Are you sure that you want to delete this update? ähnelt. + /// + internal static string RemoveUpdate { + get { + return ResourceManager.GetString("RemoveUpdate", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Remove update ähnelt. + /// + internal static string RemoveUpdate_Title { + get { + return ResourceManager.GetString("RemoveUpdate_Title", resourceCulture); + } + } + } +} diff --git a/ModpackUpdater.Apps.Manager/LangRes/MsgBoxLangRes.resx b/ModpackUpdater.Apps.Manager/LangRes/MsgBoxLangRes.resx new file mode 100644 index 0000000..092b398 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/LangRes/MsgBoxLangRes.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Are you sure that you want to delete this update? + + + Remove update + + \ No newline at end of file diff --git a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs index 0069e7c..69e2210 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs +++ b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.Designer.cs @@ -60,6 +60,24 @@ namespace ModpackUpdater.Apps.Manager.LangRes { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Create update ähnelt. + /// + internal static string CreateUpdate { + get { + return ResourceManager.GetString("CreateUpdate", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Edit update ähnelt. + /// + internal static string EditUpdate { + get { + return ResourceManager.GetString("EditUpdate", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Setup GitLab workspace ähnelt. /// diff --git a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx index 4f8caa2..8db607a 100644 --- a/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx +++ b/ModpackUpdater.Apps.Manager/LangRes/TitlesLangRes.resx @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Create update + + + Edit update + Setup GitLab workspace diff --git a/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj b/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj index e7ec4c7..edb3b70 100644 --- a/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj +++ b/ModpackUpdater.Apps.Manager/ModpackUpdater.Apps.Manager.csproj @@ -39,6 +39,11 @@ True GeneralLangRes.resx + + True + True + MsgBoxLangRes.resx + True True @@ -55,6 +60,10 @@ ResXFileCodeGenerator GeneralLangRes.Designer.cs + + ResXFileCodeGenerator + MsgBoxLangRes.Designer.cs + ResXFileCodeGenerator TitlesLangRes.Designer.cs diff --git a/ModpackUpdater.Apps.Manager/Program.cs b/ModpackUpdater.Apps.Manager/Program.cs index ed28fcb..502e4da 100644 --- a/ModpackUpdater.Apps.Manager/Program.cs +++ b/ModpackUpdater.Apps.Manager/Program.cs @@ -28,7 +28,7 @@ public static class Program ApplicationConfiguration.Initialize(); AppGlobals.Initialize(); PluginFeatureController.Instance.RegisterAllOwn(); - Application.Run(new Form1()); + Application.Run(new Ui.MainForm()); } private static string GetSettingsPath() diff --git a/ModpackUpdater.Apps.Manager/Form1.Designer.cs b/ModpackUpdater.Apps.Manager/Ui/MainForm.Designer.cs similarity index 85% rename from ModpackUpdater.Apps.Manager/Form1.Designer.cs rename to ModpackUpdater.Apps.Manager/Ui/MainForm.Designer.cs index c0b23cd..6aec863 100644 --- a/ModpackUpdater.Apps.Manager/Form1.Designer.cs +++ b/ModpackUpdater.Apps.Manager/Ui/MainForm.Designer.cs @@ -1,6 +1,7 @@ -namespace ModpackUpdater.Apps.Manager; + +namespace ModpackUpdater.Apps.Manager.Ui; -partial class Form1 +partial class MainForm { /// /// Required designer variable. @@ -29,7 +30,7 @@ partial class Form1 private void InitializeComponent() { var tableViewDefinition1 = new Telerik.WinControls.UI.TableViewDefinition(); - var resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); + var resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); radSplitContainer1 = new Telerik.WinControls.UI.RadSplitContainer(); splitPanel1 = new Telerik.WinControls.UI.SplitPanel(); tableLayoutPanel2 = new TableLayoutPanel(); @@ -45,6 +46,11 @@ partial class Form1 radMenuItem_RecentWorkspaces = new Telerik.WinControls.UI.RadMenuItem(); radMenuItem_Tools = new Telerik.WinControls.UI.RadMenuItem(); radMenu1 = new Telerik.WinControls.UI.RadMenu(); + radMenuItem_Updates = new Telerik.WinControls.UI.RadMenuItem(); + radMenuItem_EditUpdate = new Telerik.WinControls.UI.RadMenuItem(); + radMenuSeparatorItem2 = new Telerik.WinControls.UI.RadMenuSeparatorItem(); + radMenuItem_CreateUpdate = new Telerik.WinControls.UI.RadMenuItem(); + radMenuItem_RemoveUpdate = new Telerik.WinControls.UI.RadMenuItem(); radWaitingBar_Updates = new Telerik.WinControls.UI.RadWaitingBar(); dotsRingWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsRingWaitingBarIndicatorElement(); radWaitingBar_Actions = new Telerik.WinControls.UI.RadWaitingBar(); @@ -179,6 +185,7 @@ partial class Form1 // radMenuItem_WorkspacePreferences.Name = "radMenuItem_WorkspacePreferences"; radMenuItem_WorkspacePreferences.Text = "Preferences"; + radMenuItem_WorkspacePreferences.Click += this.RadMenuItem_WorkspacePreferences_Click; // // radMenuItem_SaveWorkspace // @@ -208,12 +215,43 @@ partial class Form1 // // radMenu1 // - radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_Workspace, radMenuItem_Tools }); + radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_Workspace, radMenuItem_Updates, radMenuItem_Tools }); radMenu1.Location = new Point(0, 0); radMenu1.Name = "radMenu1"; radMenu1.Size = new Size(800, 28); radMenu1.TabIndex = 1; // + // radMenuItem_Updates + // + radMenuItem_Updates.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_EditUpdate, radMenuSeparatorItem2, radMenuItem_CreateUpdate, radMenuItem_RemoveUpdate }); + radMenuItem_Updates.Name = "radMenuItem_Updates"; + radMenuItem_Updates.Text = "Updates"; + radMenuItem_Updates.DropDownOpening += RadMenuItem_Updates_DropDownOpening; + // + // radMenuItem_EditUpdate + // + radMenuItem_EditUpdate.Name = "radMenuItem_EditUpdate"; + radMenuItem_EditUpdate.Text = "Edit"; + radMenuItem_EditUpdate.Click += RadMenuItem_EditUpdate_Click; + // + // radMenuSeparatorItem2 + // + radMenuSeparatorItem2.Name = "radMenuSeparatorItem2"; + radMenuSeparatorItem2.Text = "radMenuSeparatorItem2"; + radMenuSeparatorItem2.TextAlignment = ContentAlignment.MiddleLeft; + // + // radMenuItem_CreateUpdate + // + radMenuItem_CreateUpdate.Name = "radMenuItem_CreateUpdate"; + radMenuItem_CreateUpdate.Text = "Create"; + radMenuItem_CreateUpdate.Click += RadMenuItem_CreateUpdate_Click; + // + // radMenuItem_RemoveUpdate + // + radMenuItem_RemoveUpdate.Name = "radMenuItem_RemoveUpdate"; + radMenuItem_RemoveUpdate.Text = "Remove"; + radMenuItem_RemoveUpdate.Click += RadMenuItem_RemoveUpdate_Click; + // // radWaitingBar_Updates // radWaitingBar_Updates.AssociatedControl = radListControl_Updates; @@ -248,7 +286,7 @@ partial class Form1 // dotsRingWaitingBarIndicatorElement2.Name = "dotsRingWaitingBarIndicatorElement2"; // - // Form1 + // MainForm // AutoScaleBaseSize = new Size(7, 15); AutoScaleDimensions = new SizeF(7F, 15F); @@ -259,7 +297,7 @@ partial class Form1 Controls.Add(radSplitContainer1); Controls.Add(radMenu1); Icon = (Icon)resources.GetObject("$this.Icon"); - Name = "Form1"; + Name = "MainForm"; StartPosition = FormStartPosition.CenterScreen; Text = "Minecraft Modpack Updates Manager"; WindowState = FormWindowState.Maximized; @@ -304,4 +342,9 @@ partial class Form1 private Telerik.WinControls.UI.RadWaitingBar radWaitingBar_Actions; private Telerik.WinControls.UI.DotsRingWaitingBarIndicatorElement dotsRingWaitingBarIndicatorElement2; private Telerik.WinControls.UI.RadListControl radListControl_Updates; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_Updates; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_EditUpdate; + private Telerik.WinControls.UI.RadMenuSeparatorItem radMenuSeparatorItem2; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_CreateUpdate; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_RemoveUpdate; } diff --git a/ModpackUpdater.Apps.Manager/Form1.cs b/ModpackUpdater.Apps.Manager/Ui/MainForm.cs similarity index 73% rename from ModpackUpdater.Apps.Manager/Form1.cs rename to ModpackUpdater.Apps.Manager/Ui/MainForm.cs index b525f0d..d5dbcc4 100644 --- a/ModpackUpdater.Apps.Manager/Form1.cs +++ b/ModpackUpdater.Apps.Manager/Ui/MainForm.cs @@ -5,21 +5,26 @@ using ModpackUpdater.Apps.Manager.LangRes; using ModpackUpdater.Apps.Manager.Settings; using Pilz.Plugins.Advanced; using Pilz.Plugins.Advanced.UI.Telerik; +using Pilz.UI.Extensions; using Pilz.UI.Symbols; +using Pilz.UI.Telerik.Dialogs; +using Pilz.UI.Telerik.Extensions.Extensions; using Telerik.WinControls; using Telerik.WinControls.UI; -namespace ModpackUpdater.Apps.Manager; +namespace ModpackUpdater.Apps.Manager.Ui; -public partial class Form1 : RadForm, IMainApi +public partial class MainForm : RadForm, IMainApi { - private IWorkspace? workspace; + private WorkspaceTag? wsInfo; - public IWorkspace? Workspace => workspace; + IWorkspace? IMainApi.Workspace => wsInfo?.Workspace; - private record RecentFileItemTag(WorkspaceConfig Config, WorkspaceFeature Feature); + private record RecentFilesItemTag(WorkspaceConfig Config, WorkspaceFeature Feature); - public Form1() + private record WorkspaceTag(IWorkspace Workspace, WorkspaceFeature Feature); + + public MainForm() { InitializeComponent(); @@ -28,6 +33,10 @@ public partial class Form1 : RadForm, IMainApi radMenuItem_SaveWorkspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.save, SymbolSize.Small); radMenuItem_OpenNewWorkspace.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.new_window, SymbolSize.Small); radMenuItem_RecentWorkspaces.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.time_machine, SymbolSize.Small); + radMenuItem_Updates.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.update_done, SymbolSize.Small); + radMenuItem_EditUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small); + radMenuItem_CreateUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.add, SymbolSize.Small); + radMenuItem_RemoveUpdate.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.remove, SymbolSize.Small); radMenuItem_Tools.SvgImage = AppGlobals.Symbols.GetSvgImage(AppSymbols.tools, SymbolSize.Small); radMenuItem_SaveWorkspace.Shortcuts.Add(new(Keys.Control, Keys.S)); @@ -53,7 +62,7 @@ public partial class Form1 : RadForm, IMainApi var item = new RadMenuItem { Text = config.DisplayText, - Tag = new RecentFileItemTag(config, feature), + Tag = new RecentFilesItemTag(config, feature), SvgImage = feature.Icon as RadSvgImage, }; @@ -79,13 +88,13 @@ public partial class Form1 : RadForm, IMainApi settings.Workspaces.RemoveAt(20); } - private async Task LoadNewWorkspace(IWorkspace? workspace) + private async Task LoadNewWorkspace(IWorkspace? workspace, WorkspaceFeature feature) { if (workspace is null) return; - if (workspace != this.workspace) - this.workspace = workspace; + if (workspace != wsInfo?.Workspace) + wsInfo = new(workspace, feature); AddToRecentFiles(workspace); Invoke(LoadRecentWorkspaces); @@ -103,33 +112,61 @@ public partial class Form1 : RadForm, IMainApi private void LoadWorkspace() { - if (workspace?.Config is null || workspace.InstallInfos is null || workspace.UpdateInfos is null) + if (wsInfo?.Workspace.Config is null || wsInfo.Workspace.InstallInfos is null || wsInfo.Workspace.UpdateInfos is null) return; radWaitingBar_Updates.StartWaiting(); - Text = workspace.Config.DisplayText; + Text = wsInfo.Workspace.Config.DisplayText; radListControl_Updates.BeginUpdate(); radListControl_Updates.Items.Clear(); - radListControl_Updates.Items.Add(new RadListDataItem - { - Text = string.Format(GeneralLangRes.Node_Install, workspace.InstallInfos.Version.ToString()), - Tag = workspace.InstallInfos, - }); - - foreach (var update in workspace.UpdateInfos.Updates) - { - radListControl_Updates.Items.Add(new RadListDataItem - { - Text = string.Format(GeneralLangRes.Node_Update, update.Version.ToString()), - Tag = update, - }); - } + AddUpdateItem(wsInfo.Workspace.InstallInfos); + wsInfo.Workspace.UpdateInfos.Updates.ForEach(n => AddUpdateItem(n)); radListControl_Updates.EndUpdate(); radWaitingBar_Updates.StopWaiting(); } + private RadListDataItem AddUpdateItem(IActionSetInfos infos) + { + var item = CreateUpdateItem(infos); + radListControl_Updates.Items.Add(item); + return item; + } + + private RadListDataItem InsertUpdateItem(IActionSetInfos infos) + { + var item = CreateUpdateItem(infos); + radListControl_Updates.Items.Insert(Math.Min(1, radListControl_Updates.Items.Count), item); + return item; + } + + private RadListDataItem CreateUpdateItem(IActionSetInfos infos) + { + var item = new RadListDataItem(); + UpdateUpdateItem(item, infos); + return item; + } + + private void UpdateUpdateItem(RadListDataItem item) + { + if (item.Tag is IActionSetInfos infos) + UpdateUpdateItem(item, infos); + } + + private void UpdateUpdateItem(RadListDataItem item, IActionSetInfos infos) + { + if (item.Value != infos) + item.Value = infos; + + if (infos is UpdateInfo) + item.Text = string.Format(GeneralLangRes.Node_Update, infos.Version.ToString()); + else if (infos is InstallInfos) + item.Text = string.Format(GeneralLangRes.Node_Install, infos.Version.ToString()); + else + item.Text = infos.Version.ToString(); + } + private void LoadActionSet(IActionSetInfos infos) { radGridView_Actions.BeginUpdate(); @@ -297,14 +334,28 @@ public partial class Form1 : RadForm, IMainApi private async void RadMenuItem_OpenNewWorkspace_Click(object? sender, EventArgs e) { - if (sender is RadMenuItem item && item.Tag is WorkspaceFeature feature && feature.Configure(ref workspace)) - await LoadNewWorkspace(workspace); + if (sender is RadMenuItem item && item.Tag is WorkspaceFeature feature) + { + var ws = wsInfo?.Workspace; + if (feature.Configure(ref ws)) + await LoadNewWorkspace(ws, feature); + } } private async void RadMenuItem_OpenRecentWorkspace_Click(object? sender, EventArgs e) { - if (sender is RadMenuItem item && item.Tag is RecentFileItemTag tag && tag.Feature.CreateFromConfig(tag.Config) is IWorkspace workspace) - await LoadNewWorkspace(workspace); + if (sender is RadMenuItem item && item.Tag is RecentFilesItemTag tag && tag.Feature.CreateFromConfig(tag.Config) is IWorkspace workspace) + await LoadNewWorkspace(workspace, tag.Feature); + } + + private async void RadMenuItem_WorkspacePreferences_Click(object sender, EventArgs e) + { + if (wsInfo != null) + { + var ws = wsInfo.Workspace; + if (wsInfo.Feature.Configure(ref ws)) + await LoadNewWorkspace(ws, wsInfo.Feature); + } } private void RadMenuItem_ToolsItem_Click(object? sender, EventArgs e) @@ -315,7 +366,7 @@ public partial class Form1 : RadForm, IMainApi private void RadListControl_Updates_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e) { - if (radListControl_Updates.Items.ElementAtOrDefault(e.Position)?.Tag is IActionSetInfos infos) + if (radListControl_Updates.Items.ElementAtOrDefault(e.Position)?.Value is IActionSetInfos infos) LoadActionSet(infos); } @@ -424,4 +475,39 @@ public partial class Form1 : RadForm, IMainApi } } } + + private void RadMenuItem_Updates_DropDownOpening(object sender, System.ComponentModel.CancelEventArgs e) + { + radMenuItem_EditUpdate.Enabled = radListControl_Updates.SelectedItem?.Value is IActionSetInfos; + radMenuItem_RemoveUpdate.Enabled = radListControl_Updates.SelectedItem?.Value is UpdateInfo; + } + + private void RadMenuItem_EditUpdate_Click(object sender, EventArgs e) + { + if (radListControl_Updates.SelectedItem?.Value is IActionSetInfos infos + && RadDialogBase.Show(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid()) + UpdateUpdateItem(radListControl_Updates.SelectedItem); + } + + private void RadMenuItem_CreateUpdate_Click(object sender, EventArgs e) + { + var infos = new UpdateInfo(); + + if (wsInfo?.Workspace.UpdateInfos is not null + && RadDialogBase.Show(new UpdatePropertiesEditorFlyout(infos), TitlesLangRes.EditUpdate, AppGlobals.Symbols.GetSvgImage(AppSymbols.edit, SymbolSize.Small)).IsValid()) + { + wsInfo.Workspace.UpdateInfos.Updates.Insert(0, infos); + InsertUpdateItem(infos); + } + } + + private void RadMenuItem_RemoveUpdate_Click(object sender, EventArgs e) + { + if (radListControl_Updates.SelectedItem?.Value is UpdateInfo infos && wsInfo?.Workspace.UpdateInfos is not null + && RadMessageBox.Show(MsgBoxLangRes.RemoveUpdate, MsgBoxLangRes.RemoveUpdate_Title, MessageBoxButtons.YesNo, RadMessageIcon.Exclamation).IsOk()) + { + wsInfo.Workspace.UpdateInfos.Updates.Remove(infos); + radListControl_Updates.Items.Remove(radListControl_Updates.SelectedItem); + } + } } diff --git a/ModpackUpdater.Apps.Manager/Form1.resx b/ModpackUpdater.Apps.Manager/Ui/MainForm.resx similarity index 100% rename from ModpackUpdater.Apps.Manager/Form1.resx rename to ModpackUpdater.Apps.Manager/Ui/MainForm.resx diff --git a/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.Designer.cs b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.Designer.cs new file mode 100644 index 0000000..2b6e6ef --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.Designer.cs @@ -0,0 +1,99 @@ +namespace ModpackUpdater.Apps.Manager.Ui; + +partial class UpdatePropertiesEditorFlyout +{ + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + tableLayoutPanel1 = new TableLayoutPanel(); + radLabel1 = new Telerik.WinControls.UI.RadLabel(); + radTextBox_Version = new Telerik.WinControls.UI.RadTextBox(); + tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)radLabel1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)radTextBox_Version).BeginInit(); + SuspendLayout(); + // + // tableLayoutPanel1 + // + tableLayoutPanel1.AutoSize = true; + tableLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; + tableLayoutPanel1.ColumnCount = 1; + tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); + tableLayoutPanel1.Controls.Add(radLabel1, 0, 0); + tableLayoutPanel1.Controls.Add(radTextBox_Version, 0, 1); + tableLayoutPanel1.Dock = DockStyle.Fill; + tableLayoutPanel1.Location = new Point(0, 30); + tableLayoutPanel1.Name = "tableLayoutPanel1"; + tableLayoutPanel1.RowCount = 3; + tableLayoutPanel1.RowStyles.Add(new RowStyle()); + tableLayoutPanel1.RowStyles.Add(new RowStyle()); + tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + tableLayoutPanel1.Size = new Size(300, 58); + tableLayoutPanel1.TabIndex = 4; + // + // radLabel1 + // + radLabel1.Location = new Point(3, 3); + radLabel1.Name = "radLabel1"; + radLabel1.Size = new Size(55, 22); + radLabel1.TabIndex = 0; + radLabel1.Text = "Version"; + // + // radTextBox_Version + // + radTextBox_Version.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + radTextBox_Version.Location = new Point(3, 31); + radTextBox_Version.Name = "radTextBox_Version"; + radTextBox_Version.NullText = "1.5.37.0"; + radTextBox_Version.Size = new Size(294, 24); + radTextBox_Version.TabIndex = 1; + // + // UpdatePropertiesEditorFlyout + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + AutoSize = true; + AutoSizeMode = AutoSizeMode.GrowAndShrink; + BackColor = Color.Transparent; + Controls.Add(tableLayoutPanel1); + MinimumSize = new Size(300, 0); + Name = "UpdatePropertiesEditorFlyout"; + Size = new Size(300, 118); + Controls.SetChildIndex(tableLayoutPanel1, 0); + tableLayoutPanel1.ResumeLayout(false); + tableLayoutPanel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)radLabel1).EndInit(); + ((System.ComponentModel.ISupportInitialize)radTextBox_Version).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private TableLayoutPanel tableLayoutPanel1; + private Telerik.WinControls.UI.RadLabel radLabel1; + private Telerik.WinControls.UI.RadTextBox radTextBox_Version; +} diff --git a/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs new file mode 100644 index 0000000..3339eb3 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.cs @@ -0,0 +1,30 @@ +using Pilz.UI; +using Pilz.UI.Telerik.Dialogs; + +namespace ModpackUpdater.Apps.Manager.Ui; + +public partial class UpdatePropertiesEditorFlyout : RadFlyoutBase, ILoadContent +{ + private readonly IActionSetInfos infos; + + public UpdatePropertiesEditorFlyout(IActionSetInfos infos) + { + this.infos = infos; + InitializeComponent(); + } + + public void LoadContent() + { + radTextBox_Version.Text = infos.Version.ToString(); + } + + protected override bool ValidateOK() + { + if (!Version.TryParse(radTextBox_Version.Text.Trim(), out Version? version)) + return false; + + infos.Version = version; + + return base.ValidateOK(); + } +} diff --git a/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.resx b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ModpackUpdater.Apps.Manager/Ui/UpdatePropertiesEditorFlyout.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ModpackUpdater.Apps/AppSymbols.cs b/ModpackUpdater.Apps/AppSymbols.cs index cc12a80..25b9de9 100644 --- a/ModpackUpdater.Apps/AppSymbols.cs +++ b/ModpackUpdater.Apps/AppSymbols.cs @@ -26,4 +26,7 @@ public enum AppSymbols time_machine, settings, link, + add, + edit, + remove, } diff --git a/ModpackUpdater.Apps/Symbols/add.svg b/ModpackUpdater.Apps/Symbols/add.svg new file mode 100644 index 0000000..1137870 --- /dev/null +++ b/ModpackUpdater.Apps/Symbols/add.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ModpackUpdater.Apps/Symbols/edit.svg b/ModpackUpdater.Apps/Symbols/edit.svg new file mode 100644 index 0000000..b50db44 --- /dev/null +++ b/ModpackUpdater.Apps/Symbols/edit.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ModpackUpdater.Apps/Symbols/remove.svg b/ModpackUpdater.Apps/Symbols/remove.svg new file mode 100644 index 0000000..a87e3c0 --- /dev/null +++ b/ModpackUpdater.Apps/Symbols/remove.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ModpackUpdater/IActionSetInfos.cs b/ModpackUpdater/IActionSetInfos.cs index 3e9c84a..f673246 100644 --- a/ModpackUpdater/IActionSetInfos.cs +++ b/ModpackUpdater/IActionSetInfos.cs @@ -2,7 +2,7 @@ public interface IActionSetInfos { - Version Version { get; } + Version Version { get; set; } IEnumerable Actions { get; } }