Redesigned SampleBrowser

Added pagination
Added missing features
This commit is contained in:
SND\floAr_cp 2012-09-08 08:40:36 +00:00
parent 708c65febc
commit 91cef16007
16 changed files with 382 additions and 213 deletions

View File

@ -50,6 +50,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SampleDataHalfVisual.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SampleDataHalfVisual.Designer.cs">
<DependentUpon>SampleDataHalfVisual.cs</DependentUpon>
</Compile>
<Compile Include="SampleBrowser.cs">
<SubType>Form</SubType>
</Compile>
@ -59,12 +65,9 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleData.cs" />
<Compile Include="SampleDataVisual.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="SampleDataVisual.Designer.cs">
<DependentUpon>SampleDataVisual.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="SampleDataHalfVisual.resx">
<DependentUpon>SampleDataHalfVisual.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SampleBrowser.resx">
<DependentUpon>SampleBrowser.cs</DependentUpon>
</EmbeddedResource>
@ -78,20 +81,13 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="SampleDataVisual.resx">
<DependentUpon>SampleDataVisual.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\ANX.Framework.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\header.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\sample1.png" />
<Content Include="anx.ico" />
<Content Include="Resources\button.png" />
<None Include="Resources\ANX.Framework.Logo_120x32.png" />
<None Include="Resources\ANX.Icon_100x100.png" />
<None Include="Resources\appbar.arrow.right.png" />
<None Include="Resources\appbar.arrow.left.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Drawing;
namespace AnxSampleBrowser
{
@ -18,4 +19,13 @@ namespace AnxSampleBrowser
Application.Run(new AnxSampleBrowser());
}
}
static class Style
{
public static System.Drawing.Color BG { get { return System.Drawing.Color.FromArgb(44, 44, 44); } }
public static System.Drawing.Color FG { get { return System.Drawing.Color.FromArgb(64, 64, 64); } }
public static System.Drawing.Color Text { get { return System.Drawing.Color.FromArgb(255, 255, 255); } }
public static Font Font16 { get { return new System.Drawing.Font("Segoe", 16F); } }
public static Font Font12 { get { return new System.Drawing.Font("Segoe",12F); } }
}
}

View File

@ -60,30 +60,30 @@ namespace AnxSampleBrowser.Properties {
}
}
internal static System.Drawing.Bitmap ANX_Framework {
internal static System.Drawing.Bitmap ANX_Framework_Logo_120x32 {
get {
object obj = ResourceManager.GetObject("ANX.Framework", resourceCulture);
object obj = ResourceManager.GetObject("ANX.Framework.Logo_120x32", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap button {
internal static System.Drawing.Bitmap ANX_Icon_100x100 {
get {
object obj = ResourceManager.GetObject("button", resourceCulture);
object obj = ResourceManager.GetObject("ANX.Icon_100x100", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap header {
internal static System.Drawing.Bitmap appbar_arrow_left {
get {
object obj = ResourceManager.GetObject("header", resourceCulture);
object obj = ResourceManager.GetObject("appbar.arrow.left", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap sample1 {
internal static System.Drawing.Bitmap appbar_arrow_right {
get {
object obj = ResourceManager.GetObject("sample1", resourceCulture);
object obj = ResourceManager.GetObject("appbar.arrow.right", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}

View File

@ -118,16 +118,16 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ANX.Framework" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ANX.Framework.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="ANX.Framework.Logo_120x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ANX.Framework.Logo_120x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="header" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\header.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="ANX.Icon_100x100" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ANX.Icon_100x100.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="button" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="appbar.arrow.right" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\appbar.arrow.right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="sample1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sample1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="appbar.arrow.left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\appbar.arrow.left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 702 B

View File

@ -30,36 +30,141 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AnxSampleBrowser));
this._pSamples = new System.Windows.Forms.Panel();
this._cFilter = new System.Windows.Forms.CheckedListBox();
this._lFilter = new System.Windows.Forms.Label();
this._lCategorie = new System.Windows.Forms.Label();
this._dCategories = new System.Windows.Forms.ComboBox();
this._lSortBy = new System.Windows.Forms.Label();
this._dSort = new System.Windows.Forms.ComboBox();
this._lPageIndex = new System.Windows.Forms.Label();
this._bApply = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this._pLogo = new System.Windows.Forms.Panel();
this._lTitle = new System.Windows.Forms.Label();
this._bClear = new System.Windows.Forms.Button();
this._tSearch = new System.Windows.Forms.TextBox();
this._bSearch = new System.Windows.Forms.Button();
this.panel3 = new System.Windows.Forms.Panel();
this._dCategories = new System.Windows.Forms.ComboBox();
this._lCategorie = new System.Windows.Forms.Label();
this._lFilter = new System.Windows.Forms.Label();
this._cFilter = new System.Windows.Forms.CheckedListBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// _pSamples
//
this._pSamples.AutoScroll = true;
this._pSamples.BackColor = System.Drawing.Color.Transparent;
this._pSamples.Location = new System.Drawing.Point(0, 56);
this._pSamples.Location = new System.Drawing.Point(3, 68);
this._pSamples.Name = "_pSamples";
this._pSamples.RightToLeft = System.Windows.Forms.RightToLeft.No;
this._pSamples.Size = new System.Drawing.Size(730, 470);
this._pSamples.Size = new System.Drawing.Size(730, 442);
this._pSamples.TabIndex = 2;
//
// _cFilter
//
this._cFilter.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this._cFilter.BorderStyle = System.Windows.Forms.BorderStyle.None;
this._cFilter.Font = new System.Drawing.Font("Segoe UI", 10F);
this._cFilter.ForeColor = System.Drawing.Color.White;
this._cFilter.FormattingEnabled = true;
this._cFilter.Location = new System.Drawing.Point(751, 91);
this._cFilter.Name = "_cFilter";
this._cFilter.Size = new System.Drawing.Size(171, 160);
this._cFilter.TabIndex = 0;
//
// _lFilter
//
this._lFilter.AutoSize = true;
this._lFilter.BackColor = System.Drawing.Color.Transparent;
this._lFilter.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._lFilter.ForeColor = System.Drawing.Color.White;
this._lFilter.Location = new System.Drawing.Point(739, 61);
this._lFilter.Name = "_lFilter";
this._lFilter.Size = new System.Drawing.Size(47, 21);
this._lFilter.TabIndex = 1;
this._lFilter.Text = "Filter";
//
// _lCategorie
//
this._lCategorie.AutoSize = true;
this._lCategorie.BackColor = System.Drawing.Color.Transparent;
this._lCategorie.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._lCategorie.ForeColor = System.Drawing.Color.White;
this._lCategorie.Location = new System.Drawing.Point(739, 274);
this._lCategorie.Name = "_lCategorie";
this._lCategorie.Size = new System.Drawing.Size(82, 21);
this._lCategorie.TabIndex = 2;
this._lCategorie.Text = "Categorie";
//
// _dCategories
//
this._dCategories.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this._dCategories.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this._dCategories.ForeColor = System.Drawing.Color.White;
this._dCategories.FormattingEnabled = true;
this._dCategories.Location = new System.Drawing.Point(751, 304);
this._dCategories.Name = "_dCategories";
this._dCategories.Size = new System.Drawing.Size(171, 21);
this._dCategories.TabIndex = 3;
//
// _lSortBy
//
this._lSortBy.AutoSize = true;
this._lSortBy.BackColor = System.Drawing.Color.Transparent;
this._lSortBy.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._lSortBy.ForeColor = System.Drawing.Color.White;
this._lSortBy.Location = new System.Drawing.Point(739, 389);
this._lSortBy.Name = "_lSortBy";
this._lSortBy.Size = new System.Drawing.Size(67, 21);
this._lSortBy.TabIndex = 4;
this._lSortBy.Text = "Sort by:";
//
// _dSort
//
this._dSort.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this._dSort.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this._dSort.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._dSort.ForeColor = System.Drawing.Color.White;
this._dSort.FormattingEnabled = true;
this._dSort.Items.AddRange(new object[] {
"Name",
"Categorie"});
this._dSort.Location = new System.Drawing.Point(751, 419);
this._dSort.Name = "_dSort";
this._dSort.Size = new System.Drawing.Size(171, 23);
this._dSort.TabIndex = 5;
this._dSort.SelectedIndexChanged += new System.EventHandler(this._cSort_SelectedIndexChanged);
//
// _lPageIndex
//
this._lPageIndex.AutoSize = true;
this._lPageIndex.BackColor = System.Drawing.Color.Transparent;
this._lPageIndex.Font = new System.Drawing.Font("Segoe UI", 15F);
this._lPageIndex.ForeColor = System.Drawing.Color.White;
this._lPageIndex.Location = new System.Drawing.Point(807, 464);
this._lPageIndex.Name = "_lPageIndex";
this._lPageIndex.Size = new System.Drawing.Size(64, 28);
this._lPageIndex.TabIndex = 11;
this._lPageIndex.Text = "99/99";
//
// _bApply
//
this._bApply.BackColor = System.Drawing.SystemColors.Desktop;
this._bApply.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this._bApply.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold);
this._bApply.ForeColor = System.Drawing.Color.White;
this._bApply.Location = new System.Drawing.Point(751, 341);
this._bApply.Name = "_bApply";
this._bApply.Size = new System.Drawing.Size(171, 34);
this._bApply.TabIndex = 5;
this._bApply.Text = "Apply";
this._bApply.UseVisualStyleBackColor = false;
this._bApply.Click += new System.EventHandler(this._bApply_Click);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Maroon;
this.panel1.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.header;
this.panel1.Controls.Add(this.panel2);
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))));
this.panel1.Controls.Add(this._pLogo);
this.panel1.Controls.Add(this._lTitle);
this.panel1.Controls.Add(this._bClear);
this.panel1.Controls.Add(this._tSearch);
@ -69,144 +174,137 @@
this.panel1.Size = new System.Drawing.Size(936, 50);
this.panel1.TabIndex = 0;
//
// panel2
// _pLogo
//
this.panel2.BackColor = System.Drawing.Color.White;
this.panel2.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.ANX_Framework;
this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel2.Location = new System.Drawing.Point(13, 4);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(119, 43);
this.panel2.TabIndex = 3;
this._pLogo.BackColor = System.Drawing.Color.Transparent;
this._pLogo.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.ANX_Framework_Logo_120x32;
this._pLogo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this._pLogo.Location = new System.Drawing.Point(13, 4);
this._pLogo.Name = "_pLogo";
this._pLogo.Size = new System.Drawing.Size(119, 43);
this._pLogo.TabIndex = 3;
//
// _lTitle
//
this._lTitle.AutoSize = true;
this._lTitle.BackColor = System.Drawing.Color.Transparent;
this._lTitle.Font = new System.Drawing.Font("Calibri", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._lTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(157)))), ((int)(((byte)(23)))));
this._lTitle.Font = new System.Drawing.Font("Segoe UI", 16F);
this._lTitle.ForeColor = System.Drawing.Color.White;
this._lTitle.Location = new System.Drawing.Point(138, 9);
this._lTitle.Name = "_lTitle";
this._lTitle.Size = new System.Drawing.Size(213, 36);
this._lTitle.Size = new System.Drawing.Size(170, 30);
this._lTitle.TabIndex = 2;
this._lTitle.Text = "Sample Browser";
//
// _bClear
//
this._bClear.BackColor = System.Drawing.SystemColors.Desktop;
this._bClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this._bClear.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._bClear.ForeColor = System.Drawing.Color.White;
this._bClear.Location = new System.Drawing.Point(838, 12);
this._bClear.Name = "_bClear";
this._bClear.Size = new System.Drawing.Size(84, 23);
this._bClear.Size = new System.Drawing.Size(84, 33);
this._bClear.TabIndex = 4;
this._bClear.Text = "Clear";
this._bClear.UseVisualStyleBackColor = true;
this._bClear.UseVisualStyleBackColor = false;
this._bClear.Click += new System.EventHandler(this._bClear_Click);
//
// _tSearch
//
this._tSearch.Location = new System.Drawing.Point(567, 14);
this._tSearch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this._tSearch.BorderStyle = System.Windows.Forms.BorderStyle.None;
this._tSearch.Font = new System.Drawing.Font("Segoe UI", 18F);
this._tSearch.ForeColor = System.Drawing.Color.White;
this._tSearch.Location = new System.Drawing.Point(446, 12);
this._tSearch.Name = "_tSearch";
this._tSearch.Size = new System.Drawing.Size(159, 20);
this._tSearch.Size = new System.Drawing.Size(299, 32);
this._tSearch.TabIndex = 1;
//
// _bSearch
//
this._bSearch.BackColor = System.Drawing.SystemColors.Desktop;
this._bSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this._bSearch.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._bSearch.ForeColor = System.Drawing.Color.White;
this._bSearch.Location = new System.Drawing.Point(751, 12);
this._bSearch.Name = "_bSearch";
this._bSearch.Size = new System.Drawing.Size(84, 23);
this._bSearch.Size = new System.Drawing.Size(84, 33);
this._bSearch.TabIndex = 0;
this._bSearch.Text = "Search";
this._bSearch.UseVisualStyleBackColor = true;
this._bSearch.UseVisualStyleBackColor = false;
this._bSearch.Click += new System.EventHandler(this._bSearch_Click);
//
// panel3
// pictureBox1
//
this.panel3.BackColor = System.Drawing.Color.Transparent;
this.panel3.Controls.Add(this._dCategories);
this.panel3.Controls.Add(this._lCategorie);
this.panel3.Controls.Add(this._lFilter);
this.panel3.Controls.Add(this._cFilter);
this.panel3.Location = new System.Drawing.Point(736, 40);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(200, 486);
this.panel3.TabIndex = 1;
this.pictureBox1.Image = global::AnxSampleBrowser.Properties.Resources.appbar_arrow_left;
this.pictureBox1.Location = new System.Drawing.Point(751, 457);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(42, 50);
this.pictureBox1.TabIndex = 12;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// _dCategories
// pictureBox2
//
this._dCategories.FormattingEnabled = true;
this._dCategories.Location = new System.Drawing.Point(15, 260);
this._dCategories.Name = "_dCategories";
this._dCategories.Size = new System.Drawing.Size(171, 21);
this._dCategories.TabIndex = 3;
this._dCategories.SelectedIndexChanged += new System.EventHandler(this._dCategories_SelectedIndexChanged);
//
// _lCategorie
//
this._lCategorie.AutoSize = true;
this._lCategorie.BackColor = System.Drawing.Color.Transparent;
this._lCategorie.Font = new System.Drawing.Font("Calibri", 16F);
this._lCategorie.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(157)))), ((int)(((byte)(23)))));
this._lCategorie.Location = new System.Drawing.Point(3, 230);
this._lCategorie.Name = "_lCategorie";
this._lCategorie.Size = new System.Drawing.Size(99, 27);
this._lCategorie.TabIndex = 2;
this._lCategorie.Text = "Categorie";
//
// _lFilter
//
this._lFilter.AutoSize = true;
this._lFilter.BackColor = System.Drawing.Color.Transparent;
this._lFilter.Font = new System.Drawing.Font("Calibri", 16F);
this._lFilter.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(157)))), ((int)(((byte)(23)))));
this._lFilter.Location = new System.Drawing.Point(3, 17);
this._lFilter.Name = "_lFilter";
this._lFilter.Size = new System.Drawing.Size(58, 27);
this._lFilter.TabIndex = 1;
this._lFilter.Text = "Filter";
//
// _cFilter
//
this._cFilter.FormattingEnabled = true;
this._cFilter.Location = new System.Drawing.Point(15, 47);
this._cFilter.Name = "_cFilter";
this._cFilter.Size = new System.Drawing.Size(171, 169);
this._cFilter.TabIndex = 0;
this.pictureBox2.Image = global::AnxSampleBrowser.Properties.Resources.appbar_arrow_right;
this.pictureBox2.Location = new System.Drawing.Point(880, 457);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(42, 50);
this.pictureBox2.TabIndex = 13;
this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
//
// AnxSampleBrowser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonFace;
this.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.header;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))));
this.ClientSize = new System.Drawing.Size(934, 522);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this._bApply);
this.Controls.Add(this._lPageIndex);
this.Controls.Add(this._dSort);
this.Controls.Add(this._pSamples);
this.Controls.Add(this._lFilter);
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel3);
this.Controls.Add(this._lSortBy);
this.Controls.Add(this._cFilter);
this.Controls.Add(this._lCategorie);
this.Controls.Add(this._dCategories);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "AnxSampleBrowser";
this.Text = "ANX.Framework Sample Browser";
this.Load += new System.EventHandler(this.AnxSampleBrowser_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel _pLogo;
private System.Windows.Forms.TextBox _tSearch;
private System.Windows.Forms.Button _bSearch;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button _bClear;
private System.Windows.Forms.Label _lFilter;
private System.Windows.Forms.CheckedListBox _cFilter;
private System.Windows.Forms.Label _lTitle;
private System.Windows.Forms.Panel _pSamples;
private System.Windows.Forms.ComboBox _dCategories;
private System.Windows.Forms.CheckedListBox _cFilter;
private System.Windows.Forms.Label _lFilter;
private System.Windows.Forms.Label _lCategorie;
private System.Windows.Forms.ComboBox _dCategories;
private System.Windows.Forms.Label _lSortBy;
private System.Windows.Forms.ComboBox _dSort;
private System.Windows.Forms.Label _lPageIndex;
private System.Windows.Forms.Button _bApply;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
}
}

View File

@ -1,20 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.IO;
using System.Linq;
namespace AnxSampleBrowser
{
/// <summary>
/// WinForm project which let you browse through the ANX samples
/// </summary>
public partial class AnxSampleBrowser : Form
{
//list of all registered samples
private List<SampleData> _sampleAtlas;
private List<SampleData> _filteredSamples;
private int _currentPage = 1;
private int _pageCount;
//default path to the samples folder
public String SamplePath { get { return "../Samples/"; } }
/// <summary>
@ -25,7 +30,6 @@ namespace AnxSampleBrowser
{
InitializeComponent();
//make the form fixed size
this.FormBorderStyle = FormBorderStyle.FixedDialog;
// Set the MaximizeBox to false to remove the maximize box.
@ -35,23 +39,31 @@ namespace AnxSampleBrowser
//init sample list
_sampleAtlas = new List<SampleData>();
_filteredSamples = new List<SampleData>();
//add default categorie (everything)...
_dCategories.Items.Add("all");
//...and select it
_dCategories.SelectedIndex = 0;
_dCategories.DropDownStyle = ComboBoxStyle.DropDownList;
//load out Samples.xml
parseXMl();
addAll();
calculatePages();
_dSort.SelectedIndex = 0;
_dSort.DropDownStyle = ComboBoxStyle.DropDownList;
_cFilter.CheckOnClick = true;
for (int i = 0; i < _cFilter.Items.Count; ++i)
{
_cFilter.SetItemChecked(i, true);
}
this._cFilter.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this._cFilter_ItemCheck);
// this._cFilter.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this._cFilter_ItemCheck);
@ -70,6 +82,24 @@ namespace AnxSampleBrowser
}
}
private void calculatePages()
{
_pSamples.Controls.Clear();
if (_filteredSamples.Count == 0)
return;
_pageCount = (int)Math.Ceiling(_filteredSamples.Count / 6f);
while (_currentPage > _pageCount)
_currentPage--;
_lPageIndex.Text = _currentPage + " / " + _pageCount;
for (int i = 6 * (_currentPage - 1); i < _currentPage * 6 && i < _filteredSamples.Count; ++i)
{
addSampleDataVisual(_filteredSamples[i]);
}
}
private void parseXMl()
{
XmlDocument sampleDescription = new XmlDocument();
@ -133,29 +163,52 @@ namespace AnxSampleBrowser
_dCategories.Items.AddRange(_categorieAtlas.ToArray());
_cFilter.Items.AddRange(_tagAtlas.ToArray());
}
private void addAll()
{
_pSamples.Controls.Clear();
foreach (SampleData data in _sampleAtlas)
_filteredSamples.Clear();
_filteredSamples.AddRange(_sampleAtlas);
calculatePages();
}
private void addAll(List<SampleData> value)
{
_filteredSamples.Clear();
_filteredSamples.AddRange(value);
calculatePages();
}
private bool isFiltered(SampleData data)
{
foreach (String tag in data.Tags)
{
addSampleDataVisual(data);
if(_cFilter.CheckedItems.Contains(tag))
return true;
}
return false;
}
private void addSampleDataVisual(SampleData data)
{
SampleDataVisual dataV = new SampleDataVisual(data,this);
dataV.Location = new Point(0, this._pSamples.Controls.Count * (dataV.Size.Height + 5));
SampleDataHalfVisual dataV = new SampleDataHalfVisual(data, this);
if (this._pSamples.Controls.Count % 2 == 0)
dataV.Location = new Point(0, (this._pSamples.Controls.Count/2) * (dataV.Size.Height + 5));
else
dataV.Location = new Point(dataV.Width+5, ((this._pSamples.Controls.Count-1)/2) * (dataV.Size.Height + 5));
this._pSamples.Controls.Add(dataV);
}
private void search()
{
_filteredSamples.Clear();
String[] phrases=_tSearch.Text.Split(new char[]{' ',',',';'});
this._pSamples.Controls.Clear();
foreach (SampleData data in _sampleAtlas)
@ -180,37 +233,12 @@ namespace AnxSampleBrowser
}
}
if (add)
addSampleDataVisual(data);
}
}
private void pickCategorie()
{
_pSamples.Controls.Clear();
foreach (SampleData data in _sampleAtlas)
{
if (data.Categorie.Equals(_dCategories.SelectedItem))
addSampleDataVisual(data);
}
}
private void filter()
{
_pSamples.Controls.Clear();
foreach (SampleData data in _sampleAtlas)
{
foreach (String tag in data.Tags)
{
if (_cFilter.CheckedItems.Contains(tag))
{
addSampleDataVisual(data);
break;
}
}
_filteredSamples.Add(data);
}
calculatePages();
}
private void _bSearch_Click(object sender, EventArgs e)
{
@ -223,25 +251,56 @@ namespace AnxSampleBrowser
addAll();
}
private void _dCategories_SelectedIndexChanged(object sender, EventArgs e)
{
if (_dCategories.Items.Count == 0)
return;
if (_dCategories.SelectedItem.Equals("all"))
addAll();
else
pickCategorie();
}
private void _cFilter_ItemCheck(object sender, ItemCheckEventArgs e)
{
this.BeginInvoke((MethodInvoker)delegate { filter(); });
}
private void AnxSampleBrowser_Load(object sender, EventArgs e)
{
this.Text += " v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
private void _cSort_SelectedIndexChanged(object sender, EventArgs e)
{
if (_dSort.SelectedItem.Equals("categorie"))
{
_sampleAtlas.Sort((x, y) => x.Categorie.CompareTo(y.Categorie));
_filteredSamples.Sort((x, y) => x.Categorie.CompareTo(y.Categorie));
return;
}
if (_dSort.SelectedItem.Equals("name"))
{
_sampleAtlas.Sort((x, y) => x.Name.CompareTo(y.Name));
_filteredSamples.Sort((x, y) => x.Name.CompareTo(y.Name));
return;
}
}
private void _bApply_Click(object sender, EventArgs e)
{
_filteredSamples.Clear();
foreach (SampleData data in _sampleAtlas)
{
if (_dCategories.SelectedItem.Equals("all") || data.Categorie.Equals(_dCategories.SelectedItem))
{
if(isFiltered(data))
{
_filteredSamples.Add(data);
}
}
}
calculatePages() ;
}
private void pictureBox2_Click(object sender, EventArgs e)
{
_currentPage = _currentPage+1 > _pageCount ? _currentPage : _currentPage+1;
calculatePages();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
_currentPage = _currentPage - 1 <= 0 ? _currentPage : _currentPage - 1;
calculatePages();
}
}
static class StringExtender

View File

@ -1,6 +1,6 @@
namespace AnxSampleBrowser
{
partial class SampleDataVisual
partial class SampleDataHalfVisual
{
/// <summary>
/// Erforderliche Designervariable.
@ -28,68 +28,72 @@
/// </summary>
private void InitializeComponent()
{
this._pImage = new System.Windows.Forms.PictureBox();
this._lName = new System.Windows.Forms.Label();
this._bLaunch = new System.Windows.Forms.Button();
this._rDescription = new System.Windows.Forms.RichTextBox();
((System.ComponentModel.ISupportInitialize)(this._pImage)).BeginInit();
this._pImage = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// _pImage
//
this._pImage.ErrorImage = null;
this._pImage.ImageLocation = "0;0";
this._pImage.Location = new System.Drawing.Point(481, 28);
this._pImage.Name = "_pImage";
this._pImage.Size = new System.Drawing.Size(100, 100);
this._pImage.TabIndex = 0;
this._pImage.TabStop = false;
//
// _lName
//
this._lName.AutoSize = true;
this._lName.BackColor = System.Drawing.Color.Transparent;
this._lName.Font = new System.Drawing.Font("Calibri", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._lName.Location = new System.Drawing.Point(3, 19);
this._lName.Font = new System.Drawing.Font("Segoe WP", 15.75F);
this._lName.ForeColor = System.Drawing.Color.White;
this._lName.Location = new System.Drawing.Point(5, 10);
this._lName.Name = "_lName";
this._lName.Size = new System.Drawing.Size(64, 26);
this._lName.Size = new System.Drawing.Size(64, 28);
this._lName.TabIndex = 1;
this._lName.Text = "label1";
//
// _bLaunch
//
this._bLaunch.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.button;
this._bLaunch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this._bLaunch.Location = new System.Drawing.Point(587, 65);
this._bLaunch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))));
this._bLaunch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this._bLaunch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this._bLaunch.Font = new System.Drawing.Font("Segoe WP", 10F, System.Drawing.FontStyle.Bold);
this._bLaunch.ForeColor = System.Drawing.Color.White;
this._bLaunch.Location = new System.Drawing.Point(259, 103);
this._bLaunch.Name = "_bLaunch";
this._bLaunch.Size = new System.Drawing.Size(101, 26);
this._bLaunch.Size = new System.Drawing.Size(90, 26);
this._bLaunch.TabIndex = 2;
this._bLaunch.UseVisualStyleBackColor = true;
this._bLaunch.Text = "Launch";
this._bLaunch.UseVisualStyleBackColor = false;
this._bLaunch.Click += new System.EventHandler(this._bLaunch_Click);
//
// _rDescription
//
this._rDescription.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(157)))), ((int)(((byte)(23)))));
this._rDescription.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))));
this._rDescription.BorderStyle = System.Windows.Forms.BorderStyle.None;
this._rDescription.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this._rDescription.Location = new System.Drawing.Point(8, 48);
this._rDescription.Font = new System.Drawing.Font("Segoe WP", 12F);
this._rDescription.ForeColor = System.Drawing.Color.White;
this._rDescription.Location = new System.Drawing.Point(10, 39);
this._rDescription.Name = "_rDescription";
this._rDescription.Size = new System.Drawing.Size(452, 93);
this._rDescription.Size = new System.Drawing.Size(243, 90);
this._rDescription.TabIndex = 3;
this._rDescription.Text = "";
//
// SampleDataVisual
// _pImage
//
this._pImage.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.ANX_Icon_100x100;
this._pImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this._pImage.Location = new System.Drawing.Point(259, 10);
this._pImage.Name = "_pImage";
this._pImage.Size = new System.Drawing.Size(90, 90);
this._pImage.TabIndex = 4;
//
// SampleDataHalfVisual
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::AnxSampleBrowser.Properties.Resources.sample1;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))));
this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.Controls.Add(this._pImage);
this.Controls.Add(this._rDescription);
this.Controls.Add(this._bLaunch);
this.Controls.Add(this._lName);
this.Name = "SampleDataVisual";
this.Size = new System.Drawing.Size(700, 150);
((System.ComponentModel.ISupportInitialize)(this._pImage)).EndInit();
this.Name = "SampleDataHalfVisual";
this.Size = new System.Drawing.Size(358, 140);
this.ResumeLayout(false);
this.PerformLayout();
@ -97,9 +101,9 @@
#endregion
private System.Windows.Forms.PictureBox _pImage;
private System.Windows.Forms.Label _lName;
private System.Windows.Forms.Button _bLaunch;
private System.Windows.Forms.RichTextBox _rDescription;
private System.Windows.Forms.Panel _pImage;
}
}

View File

@ -10,17 +10,19 @@ using System.IO;
namespace AnxSampleBrowser
{
public partial class SampleDataVisual : UserControl
public partial class SampleDataHalfVisual : UserControl
{
private SampleData _source;
private AnxSampleBrowser _parent;
public SampleDataVisual(SampleData source,AnxSampleBrowser parent)
public SampleDataHalfVisual(SampleData source, AnxSampleBrowser parent)
{
InitializeComponent();
//until error is gone
_pImage.Visible = false;
// _pImage.Visible = false;
_rDescription.ReadOnly = true;
_parent = parent;
@ -31,7 +33,7 @@ namespace AnxSampleBrowser
if (source.ImagePath.Length > 0)
{
Bitmap b = new Bitmap(source.ImagePath);
_pImage.Image = b;
_pImage.BackgroundImage = b;
}
}