diff --git a/Retriever/FormProfileEditor.cs b/Retriever/FormProfileEditor.cs
index fd8b969..ef804cb 100644
--- a/Retriever/FormProfileEditor.cs
+++ b/Retriever/FormProfileEditor.cs
@@ -49,13 +49,13 @@ public FormProfileEditor(Profile profile, string selectedService, string selecte
appBar.Text = String.Format("Editing '{0}'", this.profile.Name);
appBar.ToolTip = new ModernToolTip();
- foreach (var r in RegionEndpoint.EnumerableAllRegions)
- {
- AppBarMenuItem regionMenuItem = new AppBarMenuTextItem(r.SystemName);
- regionMenuItem.Click += RegionMenuItem_Click;
- appBar.MenuItems.Add(regionMenuItem);
- }
-
+ AppAction regionAction = new AppAction();
+ regionAction.Image = Resources.Gear50;
+ regionAction.Cursor = Cursors.Hand;
+ regionAction.ToolTip = "Regions Editor";
+ regionAction.Click += RegionAction_Click;
+ this.appBar.Actions.Add(regionAction);
+
AppAction saveProfileAction = new AppAction();
saveProfileAction.Image = Resources.Output50;
saveProfileAction.Cursor = Cursors.Hand;
@@ -75,9 +75,10 @@ public FormProfileEditor(Profile profile, string selectedService, string selecte
}
}
- private void RegionMenuItem_Click(object sender, EventArgs e)
+ private void RegionAction_Click(object sender, EventArgs e)
{
- // (sender as AppBarMenuTextItem).Text
+ FormRegions formRegions = new FormRegions(this.profile);
+ formRegions.ShowDialog();
}
private void SaveProfileAction_Click(object sender, System.EventArgs e)
diff --git a/Retriever/FormRegions.Designer.cs b/Retriever/FormRegions.Designer.cs
new file mode 100644
index 0000000..24c18b5
--- /dev/null
+++ b/Retriever/FormRegions.Designer.cs
@@ -0,0 +1,113 @@
+namespace Retriever
+{
+ partial class FormRegions
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.appBar1 = new NickAc.ModernUIDoneRight.Controls.AppBar();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.panel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // appBar1
+ //
+ this.appBar1.CastShadow = true;
+ this.appBar1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.appBar1.HamburgerButtonSize = 32;
+ this.appBar1.IconVisible = false;
+ this.appBar1.Location = new System.Drawing.Point(1, 33);
+ this.appBar1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.appBar1.Name = "appBar1";
+ this.appBar1.OverrideParentText = false;
+ this.appBar1.Size = new System.Drawing.Size(1027, 70);
+ this.appBar1.TabIndex = 0;
+ this.appBar1.Text = "Regions Editor";
+ this.appBar1.TextFont = new System.Drawing.Font("Segoe UI", 14F);
+ this.appBar1.ToolTip = null;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.label1);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel1.Location = new System.Drawing.Point(1, 103);
+ this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(1027, 47);
+ this.panel1.TabIndex = 1;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(4, 13);
+ this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(269, 21);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Click a region to toggle for all service:";
+ //
+ // flowLayoutPanel1
+ //
+ this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.flowLayoutPanel1.Location = new System.Drawing.Point(1, 150);
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(1027, 479);
+ this.flowLayoutPanel1.TabIndex = 2;
+ //
+ // FormRegions
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1029, 630);
+ this.ColorScheme.MouseDownColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(64)))), ((int)(((byte)(101)))));
+ this.ColorScheme.MouseHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(100)))), ((int)(((byte)(158)))));
+ this.ColorScheme.PrimaryColor = System.Drawing.Color.FromArgb(((int)(((byte)(2)))), ((int)(((byte)(119)))), ((int)(((byte)(189)))));
+ this.ColorScheme.SecondaryColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(75)))), ((int)(((byte)(120)))));
+ this.Controls.Add(this.flowLayoutPanel1);
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.appBar1);
+ this.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Location = new System.Drawing.Point(0, 0);
+ this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+ this.MinimumSize = new System.Drawing.Size(123, 55);
+ this.Name = "FormRegions";
+ this.Text = "Regions Editor";
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private NickAc.ModernUIDoneRight.Controls.AppBar appBar1;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ }
+}
\ No newline at end of file
diff --git a/Retriever/FormRegions.cs b/Retriever/FormRegions.cs
new file mode 100644
index 0000000..42a3073
--- /dev/null
+++ b/Retriever/FormRegions.cs
@@ -0,0 +1,54 @@
+using Amazon;
+using NickAc.ModernUIDoneRight.Controls;
+using NickAc.ModernUIDoneRight.Forms;
+using Retriever.Model;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Retriever
+{
+ public partial class FormRegions : ModernForm
+ {
+ private Profile profile;
+
+ public FormRegions(Profile profile)
+ {
+ this.profile = profile;
+
+ InitializeComponent();
+
+ foreach (RegionEndpoint region in RegionEndpoint.EnumerableAllRegions)
+ {
+ CheckBox checkBox = new CheckBox();
+ checkBox.Text = region.DisplayName;
+ checkBox.AutoSize = true;
+ checkBox.Tag = region.SystemName;
+ checkBox.Checked = this.profile.RegionEnabled(region.SystemName);
+ checkBox.Click += CheckBox_Click;
+ this.flowLayoutPanel1.Controls.Add(checkBox);
+ }
+ }
+
+ private void CheckBox_Click(object sender, EventArgs e)
+ {
+ CheckBox checkbox = (sender as CheckBox);
+ string region = checkbox.Tag as string;
+ this.profile.EnableRegion(region, checkbox.Checked);
+ if (checkbox.Checked)
+ {
+ ModernMessageBox.Show(String.Format("Region enabled for {0}", region));
+ } else
+ {
+ ModernMessageBox.Show(String.Format("Region disabled for {0}", region));
+ }
+
+ }
+ }
+}
diff --git a/Retriever/FormRegions.resx b/Retriever/FormRegions.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Retriever/FormRegions.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/Retriever/Model/Profile.cs b/Retriever/Model/Profile.cs
index 18929ef..4807d48 100644
--- a/Retriever/Model/Profile.cs
+++ b/Retriever/Model/Profile.cs
@@ -116,6 +116,18 @@ public void Set(ProfileRecord p)
}
}
+ public bool RegionEnabled(string systemName)
+ {
+ foreach (ProfileRecord pr in this)
+ {
+ if (pr.RegionEnabled(systemName))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void EnableRegion(string region, bool enabled)
{
for (int i = 0; i < this.Count; i++)
diff --git a/Retriever/Model/ProfileRecord.cs b/Retriever/Model/ProfileRecord.cs
index 0d8e033..e2fa567 100644
--- a/Retriever/Model/ProfileRecord.cs
+++ b/Retriever/Model/ProfileRecord.cs
@@ -1,4 +1,5 @@
-using AWSRetriver.Controls;
+using System;
+using AWSRetriver.Controls;
namespace Retriever
{
@@ -45,6 +46,11 @@ public void EnableRegion(string region, bool enabled)
}
this.regions = rs.Text();
}
+
+ public bool RegionEnabled(string systemName)
+ {
+ return this.regions.Contains(systemName);
+ }
}
}
}
\ No newline at end of file
diff --git a/Retriever/Retriever.csproj b/Retriever/Retriever.csproj
index dcd5f56..53c2ed8 100644
--- a/Retriever/Retriever.csproj
+++ b/Retriever/Retriever.csproj
@@ -122,6 +122,12 @@
FormProfileEditor.cs
+
+ Form
+
+
+ FormRegions.cs
+
Form
@@ -179,6 +185,9 @@
FormProfileEditor.cs
+
+ FormRegions.cs
+
FormRun.cs