Browse files

initial search box support. Woo hoo!

  • Loading branch information...
1 parent 7ec2adb commit f08b62745aa432adfce744a69f6afb754c797a1d @philc committed Jan 13, 2007
View
7 InstallPad.csproj
@@ -183,6 +183,9 @@
</Compile>
<Compile Include="src\ProxyOptions.cs" />
<Compile Include="src\RemoteVersionChecker.cs" />
+ <Compile Include="src\ui\ImageButton.cs">
+ <SubType>Component</SubType>
+ </Compile>
<Compile Include="src\Zip.cs" />
</ItemGroup>
<ItemGroup>
@@ -220,7 +223,11 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <None Include="data\images\close.png" />
+ <None Include="data\images\closePressed.png" />
+ <None Include="data\images\closeOver.png" />
<Content Include="icon.ico" />
+ <None Include="Resources\close.bmp" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
21 Properties/Resources.Designer.cs
@@ -220,6 +220,27 @@ internal class Resources {
}
}
+ internal static System.Drawing.Bitmap close {
+ get {
+ object obj = ResourceManager.GetObject("close", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap closeOver {
+ get {
+ object obj = ResourceManager.GetObject("closeOver", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap closePressed {
+ get {
+ object obj = ResourceManager.GetObject("closePressed", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
/// <summary>
/// Looks up a localized string similar to Comment.
/// </summary>
View
48 Properties/Resources.resx
@@ -644,4 +644,52 @@ The terms "reproduce," "reproduction" and "distribution" have the same meaning h
<data name="BadProxyOption" xml:space="preserve">
<value>Unrecognized proxy option</value>
</data>
+ <data name="close" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+ CxMBAJqcGAAAAl5JREFUOE+NkN1L02EcxR+lmyiKoL+iv6EoQSTUNjXFNF8aW8M0ab5VzgudGrbAl7CI
+ 3WSvVGIXUWGZ2txuaqE53+Ys/SmKilPbUnK4rdNzHi2Cbhp8d3bO+Ry23+LenMo4ceDwwdvxh/Ydwd49
+ YueFXf1b4pSJ24qK7Y3t+cX4/XXCnZ0zHmy24cfzOwj2dWCt/y6+ux5g0/0QG7tHvyrzb7JXXLMt5jxb
+ OC9cmdlYr6vGyvVaDLXY4Gqrx7TDjrWOFqzea0XgfitmpHfebMCg7MmR504407KwVFUGrbYG3s4nGOzt
+ wYC9EX5rBRZrr8JfU6k8c/bkyHMn+nWZmLeUYrmxHptDg4hFIpj65EG39QqGS8xK6ZmzX260KZ470Zea
+ gbmSYiyUW7Byqx3hqSlEwmFooyN40VCnlJ75Sns7FsosiudO9KakQysyY/biBcxdkr+grQVhbQaxaBTB
+ QEApPXP25MhzJ94lp2PGfB6zxUXQ5E3IovtaA0KrAfBFpWfOnhx57kTPST2+GI0q8JqMeFVZAW3Eq74x
+ GgoppWfOnhx57sRb+eY7Z8CYyYT3NVb4PR71jFtfp7HkcCilZ86eHHnuRHeSHiN5hfBayjHncu/8qz4f
+ ZpvsmDTKx5FKz5w9OfLciddJOgzlFMB/2Yr1ATeCHz3Qmm5g3GDCWL5BKT1z9uTIcydeJup+fsjKw3Ch
+ CRNV1Zgoq4K3wIjPuQV/jp45e3Lk5Q6iKyFtuCf5TMypy4VT/x8nOclHuhL0PvEovzTnaeLphWdHU9B5
+ TN5v3f3M/J87rp98nG5I/QUoEWHM6/6wWgAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="closeOver" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+ CxMBAJqcGAAAAgdJREFUOE+NkE1PE1EUhi8mxIVu9F+48Be4aGDjJ6EGpNoW0E7S6Qe1gLAYwwhUgjEk
+ RiIlGhNdoDVRcCsmRo1ujSBtTIUNGmLTqLXQSKQzndd5r50hrupNTs495zzPyc1teqAm2w/v27m3d3/z
+ QasZotHZYzSJ6i+jsGQe0ERODRTM+Rng7Rys5UcyasuZ+j3j3p0eOfIfor2bIq/4gLsTwONbyKZ1ZC71
+ wFq0ly3eBp6lYT1P23kWDweDWJkZkRx5eiLffRqYGgZuaHjxdAHFjQ1kEgowrbnBmn3OcdPu2zw9kfd7
+ YV0bgHV9ECiXwENwIRrEz/GYzKzlsefkyNMTH8+2wRxPoDaRhDk76S74vLaK+4kwmB2Rc/Oqzdk8PZHz
+ 2fJoBFaqDwZj+gqsb4W/Qv2wZp/zWioueXoi13UKVV2FZT/RGIujMhLB/FD8H5k1+5ybYzHJ0xPZMyex
+ fTkMQ49gR4/hiXJu96n1FXw6+5xX9ajk6YmVzhOoDCnY1sKYUwLu59SKX/H7zhSYnU/knBx5emLJexw/
+ +npQ7r+wK5a+o5IaxtZASOaaXTsLNvtDkqcn3rcfQzHajdLFXgkQ3JrUUE6ed4O1s4AceXriXdtRfAn5
+ UFD9stkoCmpA8vTEm9bW9WyHF6v+DqwFuxrGJ38nyNMTLz1HDr3ytKy/9rTgf4M8vT/A3XpekMbFTAAA
+ AABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="closePressed" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEwAA
+ CxMBAJqcGAAAAfVJREFUOE+NkdtLVFEYxXeX/0F6l/6M3gR11Ey8oXOhGeschxmbaZS84ZgiIeYlEfKh
+ h6AyiGbwwaDn8qGXLKbRBoIIvI3OxSbxEs7s1V7HOSfNB/tg8Z1vfb+12exz4UWgu/FK7OP0xUK+RPxn
+ yUuXt9KlV1vFu5qa7PrIPZmKTCAdmUQ6qsT+r4o+OfKLVbYfItZah/V2O5JaCz4012GurBwZv/OM6HNP
+ jjxzYul6Oba8DmT9LryPLCC1toFXTjdygZuWONPnnhx55sSn2gpkfE7kgm7InQxYBOftLmx4XUbnzOKe
+ HHnmRKy+ErudHux1a9gfD1sHrH37jjm9A+xmkHty5JkTXxps2O+5jcM+HQdKh2O9kNubRsAszvSNvRJ5
+ 5kS8sQq/+zXkwzqOBnTs9d7Cm2DoVJgzfe7JkWdOxJuqDSM/6MNR2IcFt8e6qnkCr06fe3LkmRMrzSp8
+ 34/8cAeibZr1OEglUXj6SL1e0npE7smRZ04kWmohHwQgR+/+DeaykLNDygsaHWo2/wI58syJhOMG8LAL
+ mOw5vuWvn8CzKWBKzaY402eRUzxzIuFpAp6MANEZ4O2s0uNi5/dJFX1yimdOrLQ7vhZez0gsPof8/PJc
+ kSO/rNlXxbx+51o8pG8mBtQjDPvOFblYpzcdCfXZ/gAKmYl1lexrIwAAAABJRU5ErkJggg==
+</value>
+ </data>
</root>
View
BIN data/images/buttons/close.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN data/images/buttons/closeOver.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN data/images/buttons/closePressed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
6 src/ApplicationItem.cs
@@ -137,12 +137,16 @@ public string UnInstallString
/// <summary>
/// Detect the version that's already installed.
/// </summary>
- /// <returns></returns>
+ /// <returns>Whether the version was successfully retrieved from the registry</returns>
public bool DetectVersion()
{
RegistryKey UninstallKey = Registry.LocalMachine;
UninstallKey = UninstallKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true);
+ // If this app doesn't have a name, we can't find it in the registry..
+ if (name == null || name == "")
+ return false;
+
try
{
// Iterate subkeys... each subkey is an installed package
View
28 src/ControlList.cs
@@ -88,7 +88,8 @@ public ControlList()
private Control highlightedEntry = null;
private void ControlList_Load(object sender, EventArgs e)
- {
+ {
+
// Build a scrollable control and add a table layout to it.
this.tableLayout = new TableLayoutPanel();
@@ -102,12 +103,6 @@ private void ControlList_Load(object sender, EventArgs e)
this.Controls.Add(scrollPanel);
this.scrollPanel.Controls.Add(this.tableLayout);
- this.tableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- // Don't anchor to the bottom; if you do, the table control will be too big and won't scroll right.
- //| System.Windows.Forms.AnchorStyles.Bottom));
-
this.tableLayout.ColumnCount = 1;
this.tableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayout.Location = new System.Drawing.Point(0, 0);
@@ -116,8 +111,20 @@ private void ControlList_Load(object sender, EventArgs e)
this.tableLayout.RowCount = 1;
this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 149F));
this.tableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 149F));
- this.tableLayout.Size = scrollPanel.Size;
- this.tableLayout.TabIndex = 2;
+
+ this.tableLayout.Size = scrollPanel.Size;
+
+ this.tableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ // Don't anchor to the bottom; if you do, the table control will be too big and won't scroll right.
+ //| System.Windows.Forms.AnchorStyles.Bottom));
+
+ this.tableLayout.TabIndex = 2;
+
+ Console.WriteLine(this.Width);
+ Console.WriteLine(this.scrollPanel.Width);
+ Console.WriteLine(this.tableLayout.Width);
foreach (RowStyle style in this.tableLayout.RowStyles)
style.SizeType = SizeType.Absolute;
@@ -240,8 +247,7 @@ private void ShiftRowsUp(int row)
/// </summary>
/// <param name="controls"></param>
public void AddAll(List<Control> controls)
- {
-
+ {
foreach (Control control in controls)
{
FormatAndAddControl(control);
View
196 src/InstallPad.Designer.cs
@@ -42,78 +42,37 @@ private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallPad));
this.buttonInstall = new System.Windows.Forms.Button();
- this.controlListPanel = new System.Windows.Forms.Panel();
- this.errorPanel = new System.Windows.Forms.Panel();
- this.errorLabel = new System.Windows.Forms.Label();
- this.errorLink = new System.Windows.Forms.LinkLabel();
this.logoBox = new System.Windows.Forms.PictureBox();
this.openAppList = new System.Windows.Forms.LinkLabel();
this.preferencesLink = new System.Windows.Forms.LinkLabel();
this.aboutLink = new System.Windows.Forms.LinkLabel();
- this.controlListPanel.SuspendLayout();
- this.errorPanel.SuspendLayout();
+ this.splitContainer = new System.Windows.Forms.SplitContainer();
+ this.searchPanel = new System.Windows.Forms.Panel();
+ this.button1 = new System.Windows.Forms.Button();
+ this.SearchBox = new System.Windows.Forms.TextBox();
+ this.labelSearchOnline = new System.Windows.Forms.Label();
+ this.errorPanel = new System.Windows.Forms.Panel();
+ this.errorLabel = new System.Windows.Forms.Label();
+ this.errorLink = new System.Windows.Forms.LinkLabel();
((System.ComponentModel.ISupportInitialize)(this.logoBox)).BeginInit();
+ this.splitContainer.Panel1.SuspendLayout();
+ this.splitContainer.Panel2.SuspendLayout();
+ this.splitContainer.SuspendLayout();
+ this.searchPanel.SuspendLayout();
+ this.errorPanel.SuspendLayout();
this.SuspendLayout();
//
// buttonInstall
//
this.buttonInstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonInstall.Location = new System.Drawing.Point(331, 423);
+ this.buttonInstall.Location = new System.Drawing.Point(331, 422);
this.buttonInstall.Name = "buttonInstall";
- this.buttonInstall.Size = new System.Drawing.Size(89, 23);
+ this.buttonInstall.Size = new System.Drawing.Size(89, 22);
this.buttonInstall.TabIndex = 0;
this.buttonInstall.Text = "&Install Checked";
this.buttonInstall.UseVisualStyleBackColor = true;
this.buttonInstall.Click += new System.EventHandler(this.buttonInstall_Click);
//
- // controlListPanel
- //
- this.controlListPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.controlListPanel.BackColor = System.Drawing.SystemColors.Window;
- this.controlListPanel.Controls.Add(this.errorPanel);
- this.controlListPanel.Location = new System.Drawing.Point(0, 75);
- this.controlListPanel.Margin = new System.Windows.Forms.Padding(0);
- this.controlListPanel.Name = "controlListPanel";
- this.controlListPanel.Size = new System.Drawing.Size(428, 335);
- this.controlListPanel.TabIndex = 1;
- //
- // errorPanel
- //
- this.errorPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.errorPanel.BackColor = System.Drawing.SystemColors.ControlLight;
- this.errorPanel.Controls.Add(this.errorLabel);
- this.errorPanel.Controls.Add(this.errorLink);
- this.errorPanel.Location = new System.Drawing.Point(0, 310);
- this.errorPanel.Name = "errorPanel";
- this.errorPanel.Size = new System.Drawing.Size(428, 25);
- this.errorPanel.TabIndex = 0;
- this.errorPanel.Visible = false;
- //
- // errorLabel
- //
- this.errorLabel.AutoSize = true;
- this.errorLabel.BackColor = System.Drawing.Color.Transparent;
- this.errorLabel.Location = new System.Drawing.Point(4, 6);
- this.errorLabel.Name = "errorLabel";
- this.errorLabel.Size = new System.Drawing.Size(262, 13);
- this.errorLabel.TabIndex = 12;
- this.errorLabel.Text = "There were some problems loading the application file.";
- //
- // errorLink
- //
- this.errorLink.AutoSize = true;
- this.errorLink.BackColor = System.Drawing.Color.Transparent;
- this.errorLink.LinkColor = System.Drawing.Color.MediumBlue;
- this.errorLink.Location = new System.Drawing.Point(264, 6);
- this.errorLink.Name = "errorLink";
- this.errorLink.Size = new System.Drawing.Size(59, 13);
- this.errorLink.TabIndex = 11;
- this.errorLink.TabStop = true;
- this.errorLink.Text = "View errors";
- //
// logoBox
//
this.logoBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -133,7 +92,7 @@ private void InitializeComponent()
this.openAppList.AutoSize = true;
this.openAppList.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.openAppList.LinkColor = System.Drawing.Color.MediumBlue;
- this.openAppList.Location = new System.Drawing.Point(6, 426);
+ this.openAppList.Location = new System.Drawing.Point(6, 425);
this.openAppList.Name = "openAppList";
this.openAppList.Size = new System.Drawing.Size(147, 16);
this.openAppList.TabIndex = 11;
@@ -147,7 +106,7 @@ private void InitializeComponent()
this.preferencesLink.AutoSize = true;
this.preferencesLink.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.preferencesLink.LinkColor = System.Drawing.Color.MediumBlue;
- this.preferencesLink.Location = new System.Drawing.Point(159, 426);
+ this.preferencesLink.Location = new System.Drawing.Point(159, 425);
this.preferencesLink.Name = "preferencesLink";
this.preferencesLink.Size = new System.Drawing.Size(81, 16);
this.preferencesLink.TabIndex = 12;
@@ -161,26 +120,127 @@ private void InitializeComponent()
this.aboutLink.AutoSize = true;
this.aboutLink.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.aboutLink.LinkColor = System.Drawing.Color.MediumBlue;
- this.aboutLink.Location = new System.Drawing.Point(246, 426);
+ this.aboutLink.Location = new System.Drawing.Point(246, 425);
this.aboutLink.Name = "aboutLink";
this.aboutLink.Size = new System.Drawing.Size(43, 16);
this.aboutLink.TabIndex = 13;
this.aboutLink.TabStop = true;
this.aboutLink.Text = "About";
this.aboutLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.aboutLink_LinkClicked);
//
+ // splitContainer
+ //
+ this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.splitContainer.BackColor = System.Drawing.SystemColors.Control;
+ this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
+ this.splitContainer.IsSplitterFixed = true;
+ this.splitContainer.Location = new System.Drawing.Point(-1, 73);
+ this.splitContainer.Name = "splitContainer";
+ this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer.Panel1
+ //
+ this.splitContainer.Panel1.BackColor = System.Drawing.Color.White;
+ this.splitContainer.Panel1.Controls.Add(this.errorPanel);
+ //
+ // splitContainer.Panel2
+ //
+ this.splitContainer.Panel2.Controls.Add(this.searchPanel);
+ this.splitContainer.Size = new System.Drawing.Size(429, 349);
+ this.splitContainer.SplitterDistance = 315;
+ this.splitContainer.TabIndex = 17;
+ //
+ // searchPanel
+ //
+ this.searchPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.searchPanel.Controls.Add(this.button1);
+ this.searchPanel.Controls.Add(this.SearchBox);
+ this.searchPanel.Controls.Add(this.labelSearchOnline);
+ this.searchPanel.Location = new System.Drawing.Point(0, 0);
+ this.searchPanel.Margin = new System.Windows.Forms.Padding(0);
+ this.searchPanel.Name = "searchPanel";
+ this.searchPanel.Size = new System.Drawing.Size(429, 30);
+ this.searchPanel.TabIndex = 17;
+ //
+ // button1
+ //
+ this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.button1.Location = new System.Drawing.Point(332, 3);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(53, 22);
+ this.button1.TabIndex = 2;
+ this.button1.Text = "Search";
+ this.button1.UseVisualStyleBackColor = true;
+ //
+ // SearchBox
+ //
+ this.SearchBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.SearchBox.Location = new System.Drawing.Point(124, 4);
+ this.SearchBox.Name = "SearchBox";
+ this.SearchBox.Size = new System.Drawing.Size(199, 20);
+ this.SearchBox.TabIndex = 1;
+ //
+ // labelSearchOnline
+ //
+ this.labelSearchOnline.AutoSize = true;
+ this.labelSearchOnline.Location = new System.Drawing.Point(6, 7);
+ this.labelSearchOnline.Name = "labelSearchOnline";
+ this.labelSearchOnline.Size = new System.Drawing.Size(112, 13);
+ this.labelSearchOnline.TabIndex = 0;
+ this.labelSearchOnline.Text = "&Find new applications:";
+ //
+ // errorPanel
+ //
+ this.errorPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.errorPanel.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.errorPanel.Controls.Add(this.errorLabel);
+ this.errorPanel.Controls.Add(this.errorLink);
+ this.errorPanel.Location = new System.Drawing.Point(0, 291);
+ this.errorPanel.Name = "errorPanel";
+ this.errorPanel.Size = new System.Drawing.Size(428, 25);
+ this.errorPanel.TabIndex = 16;
+ this.errorPanel.Visible = false;
+ //
+ // errorLabel
+ //
+ this.errorLabel.AutoSize = true;
+ this.errorLabel.BackColor = System.Drawing.Color.Transparent;
+ this.errorLabel.Location = new System.Drawing.Point(4, 6);
+ this.errorLabel.Name = "errorLabel";
+ this.errorLabel.Size = new System.Drawing.Size(262, 13);
+ this.errorLabel.TabIndex = 12;
+ this.errorLabel.Text = "There were some problems loading the application file.";
+ //
+ // errorLink
+ //
+ this.errorLink.AutoSize = true;
+ this.errorLink.BackColor = System.Drawing.Color.Transparent;
+ this.errorLink.LinkColor = System.Drawing.Color.MediumBlue;
+ this.errorLink.Location = new System.Drawing.Point(264, 6);
+ this.errorLink.Name = "errorLink";
+ this.errorLink.Size = new System.Drawing.Size(59, 13);
+ this.errorLink.TabIndex = 11;
+ this.errorLink.TabStop = true;
+ this.errorLink.Text = "View errors";
+ //
// InstallPad
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
- this.ClientSize = new System.Drawing.Size(427, 458);
+ this.ClientSize = new System.Drawing.Size(427, 457);
this.Controls.Add(this.aboutLink);
this.Controls.Add(this.preferencesLink);
this.Controls.Add(this.openAppList);
this.Controls.Add(this.buttonInstall);
this.Controls.Add(this.logoBox);
- this.Controls.Add(this.controlListPanel);
+ this.Controls.Add(this.splitContainer);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MinimumSize = new System.Drawing.Size(435, 275);
@@ -189,10 +249,14 @@ private void InitializeComponent()
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "InstallPad";
this.Load += new System.EventHandler(this.InstallPad_Load);
- this.controlListPanel.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.logoBox)).EndInit();
+ this.splitContainer.Panel1.ResumeLayout(false);
+ this.splitContainer.Panel2.ResumeLayout(false);
+ this.splitContainer.ResumeLayout(false);
+ this.searchPanel.ResumeLayout(false);
+ this.searchPanel.PerformLayout();
this.errorPanel.ResumeLayout(false);
this.errorPanel.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.logoBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -201,11 +265,15 @@ private void InitializeComponent()
#endregion
private System.Windows.Forms.Button buttonInstall;
- private System.Windows.Forms.Panel controlListPanel;
private System.Windows.Forms.PictureBox logoBox;
private System.Windows.Forms.LinkLabel openAppList;
private System.Windows.Forms.LinkLabel preferencesLink;
private System.Windows.Forms.LinkLabel aboutLink;
+ private System.Windows.Forms.SplitContainer splitContainer;
+ private System.Windows.Forms.Panel searchPanel;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.TextBox SearchBox;
+ private System.Windows.Forms.Label labelSearchOnline;
private System.Windows.Forms.Panel errorPanel;
private System.Windows.Forms.Label errorLabel;
private System.Windows.Forms.LinkLabel errorLink;
View
38 src/InstallPad.cs
@@ -22,6 +22,7 @@
using CodeProject.AboutDialog;
using System.IO;
using InstallPad.Properties;
+using InstallPad.UI;
namespace InstallPad
{
/// <summary>
@@ -51,9 +52,12 @@ public partial class InstallPad : Form
PreferencesDialog preferencesDialog;
+ private Panel controlListPanel = null;
+
public InstallPad()
{
InitializeComponent();
+ this.controlListPanel = splitContainer.Panel1;
}
/// <summary>
@@ -114,6 +118,7 @@ private void LoadConfigFile()
private void InstallPad_Load(object sender, EventArgs e)
{
+
preferencesDialog = new PreferencesDialog();
this.logoBox.Click += new EventHandler(logoBox_Click);
this.errorLink.Click += new EventHandler(errorLink_Click);
@@ -122,8 +127,8 @@ private void InstallPad_Load(object sender, EventArgs e)
this.controlList = new ControlList();
this.controlList.ListItemClicked += new MouseEventHandler(controlList_ListItemClicked);
this.controlList.ListItemDoubleClicked += new MouseEventHandler(controlList_ListItemDoubleClicked);
- controlList.Width = this.controlListPanel.Width;
- controlList.Height = this.controlListPanel.Height;
+
+ controlList.Size = this.controlListPanel.Size;
this.controlListPanel.Controls.Add(controlList);
controlList.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom;
@@ -182,11 +187,33 @@ private void InstallPad_Load(object sender, EventArgs e)
appListErrorBox.Visible = false;
appListErrorBox.openLink.Click += new EventHandler(openLink_Click);
+ BuildSearchBox();
+
+
// Load the application list. If not successful (file not found),
// all controls will be disabled.
LoadApplicationList(InstallPadApp.AppListFile);
}
+
+
+ void BuildSearchBox()
+ {
+ // Add a close button to the search box; only visible when it's "open"
+ ImageButton button = new ImageButton();
+ button.Parent = this.searchPanel;
+ button.Location=new Point(this.searchPanel.Width-21,8);
+ button.Anchor = AnchorStyles.Right | AnchorStyles.Top;
+
+ button.BackgroundImage = global::InstallPad.Properties.Resources.close;
+ button.OverImage = global::InstallPad.Properties.Resources.closeOver;
+ button.PressedImage = global::InstallPad.Properties.Resources.closePressed;
+ button.Visible = false;
+
+ this.searchPanel.Controls.Add(button);
+
+ }
+
void controlList_ListItemDoubleClicked(object sender, MouseEventArgs e)
{
Control doubleClickedControl = controlList.ControlAtAbsolutePosition(Cursor.Position);
@@ -365,12 +392,15 @@ private void SetErrorPanelVisibility(bool visible)
if (visible)
{
this.errorPanel.Show();
- this.controlList.Height = controlList.Height - (this.controlList.Bottom - errorPanel.Top);
+ //this.controlListPanel.Height = errorPanel.Top - this.logoBox.Bottom;
+ this.controlList.Height = controlListPanel.Height-this.errorPanel.Height;
}
else
{
//this.controlList.Bottom = errorPanel.Bottom;
- this.controlList.Height = controlList.Height - (this.controlList.Bottom - errorPanel.Bottom);
+ //this.controlList.Height = controlList.Height - (this.controlList.Bottom - errorPanel.Bottom);
+ //this.controlListPanel.Height = this.errorPanel.Bottom - this.logoBox.Bottom; //controlList.Height - (this.controlList.Bottom - errorPanel.Bottom);
+ this.controlList.Height = controlListPanel.Height;// -this.errorPanel.Height;
this.errorPanel.Hide();
}
}
View
141 src/ui/ImageButton.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace InstallPad.UI
+{
+ // This code shows a simple way to have a
+ // button-like control that has a background image.
+ // freely available from
+ // http://msdn2.microsoft.com/en-us/library/ms172532(VS.80).aspx
+
+ //
+ // Example usage:
+ //
+ // PictureButton button = new PictureButton();
+ // button.Parent = this;
+ // button.Bounds = new Rectangle(10, 30, 150, 30);
+ // button.ForeColor = Color.White;
+ // button.BackgroundImage = someIMage
+ // button.PressedImage = some iamge
+ // button.Text = "click me";
+ // button.Click += new EventHandler(button_Click);
+ public class ImageButton : Control
+ {
+ Image backgroundImage, pressedImage, overImage;
+
+ bool pressed = false;
+
+ // Whether the mouse is hovering over this button
+ bool over = false;
+
+ public override Image BackgroundImage
+ {
+ get
+ {
+ return this.backgroundImage;
+ }
+ set
+ {
+ // Make this button the size of the image
+ this.Size = value.Size;
+
+ this.backgroundImage = value;
+ }
+ }
+
+ // Show when the button is pressed
+ public Image PressedImage
+ {
+ get
+ {
+ return this.pressedImage;
+ }
+ set
+ {
+ this.pressedImage = value;
+ }
+ }
+ // Shown when the mouse hovers over the button
+ public Image OverImage
+ {
+ get
+ {
+ return this.overImage;
+ }
+ set
+ {
+ this.overImage = value;
+ }
+ }
+
+ // When the mouse button is pressed, set the "pressed" flag to true
+ // and invalidate the form to cause a repaint. The .NET Compact Framework
+ // sets the mouse capture automatically.
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ this.pressed = true;
+ this.Invalidate();
+ base.OnMouseDown(e);
+ }
+
+ // When the mouse is released, reset the "pressed" flag
+ // and invalidate to redraw the button in the unpressed state.
+ protected override void OnMouseUp(MouseEventArgs e)
+ {
+ this.pressed = false;
+ this.Invalidate();
+ base.OnMouseUp(e);
+ }
+
+ protected override void OnMouseEnter(EventArgs e)
+ {
+ this.over = true;
+ Console.WriteLine("enter: " + this.over);
+ this.Refresh();
+ base.OnMouseEnter(e);
+ }
+
+ protected override void OnMouseLeave(EventArgs e)
+ {
+ this.over = false;
+ this.Refresh();
+ base.OnMouseLeave(e);
+ }
+ // Override the OnPaint method to draw the background image and the text.
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ int w = this.backgroundImage.Size.Width;
+ int h = this.backgroundImage.Size.Height;
+
+ if (this.pressed && this.pressedImage != null && this.over)
+ e.Graphics.DrawImage(this.pressedImage, 0, 0, w, h);
+ else if (this.over && this.overImage!=null)
+ e.Graphics.DrawImage(this.overImage, 0, 0, w, h);
+ else
+ e.Graphics.DrawImage(this.backgroundImage, 0,0,w,h);
+
+ //// Draw the text if there is any.
+ if (this.Text.Length > 0)
+ {
+ SizeF size = e.Graphics.MeasureString(this.Text, this.Font);
+
+ // Center the text inside the client area of the PictureButton.
+ e.Graphics.DrawString(this.Text,
+ this.Font,
+ new SolidBrush(this.ForeColor),
+ (this.ClientSize.Width - size.Width) / 2,
+ (this.ClientSize.Height - size.Height) / 2);
+ }
+
+ // Draw a border around the outside of the
+ // control to look like Pocket PC buttons.
+ //e.Graphics.DrawRectangle(new Pen(Color.Black), 0, 0,
+ // this.ClientSize.Width - 1, this.ClientSize.Height - 1);
+
+ base.OnPaint(e);
+ }
+ }
+}
+

0 comments on commit f08b627

Please sign in to comment.