This commit is contained in:
Kamil Zmich 2014-06-05 19:44:35 +01:00
commit c39705d1a0
5 changed files with 53 additions and 22 deletions

View file

@ -29,9 +29,9 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
this.scMain = new System.Windows.Forms.SplitContainer();
this.tcMain = new System.Windows.Forms.TabControl();
this.lvMain = new HelpersLib.MyListView();
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tcMain = new System.Windows.Forms.TabControl();
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
this.scMain.Panel1.SuspendLayout();
this.scMain.Panel2.SuspendLayout();
@ -59,12 +59,22 @@ private void InitializeComponent()
this.scMain.SplitterWidth = 3;
this.scMain.TabIndex = 0;
//
// tcMain
//
this.tcMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcMain.Location = new System.Drawing.Point(0, 0);
this.tcMain.Name = "tcMain";
this.tcMain.SelectedIndex = 0;
this.tcMain.Size = new System.Drawing.Size(460, 500);
this.tcMain.TabIndex = 0;
//
// lvMain
//
this.lvMain.AutoFillColumn = true;
this.lvMain.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader2});
this.lvMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvMain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.lvMain.FullRowSelect = true;
this.lvMain.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvMain.HideSelection = false;
@ -76,15 +86,7 @@ private void InitializeComponent()
this.lvMain.UseCompatibleStateImageBehavior = false;
this.lvMain.View = System.Windows.Forms.View.Details;
this.lvMain.SelectedIndexChanged += new System.EventHandler(this.lvMain_SelectedIndexChanged);
//
// tcMain
//
this.tcMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tcMain.Location = new System.Drawing.Point(0, 0);
this.tcMain.Name = "tcMain";
this.tcMain.SelectedIndex = 0;
this.tcMain.Size = new System.Drawing.Size(460, 500);
this.tcMain.TabIndex = 0;
this.lvMain.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lvMain_MouseUp);
//
// TabToListView
//

View file

@ -74,7 +74,7 @@ public ImageList ImageList
}
set
{
lvMain.SmallImageList = value;
lvMain.SmallImageList = tcMain.ImageList = value;
}
}
@ -120,17 +120,39 @@ private void FillListView(TabControl tab)
}
}
private void lvMain_MouseUp(object sender, MouseEventArgs e)
{
if (lvMain.SelectedItems.Count == 0 && (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right))
{
ListViewItem lvi = lvMain.GetItemAt(e.X, e.Y);
if (lvi == null)
{
// Workaround for 1px space between items
lvi = lvMain.GetItemAt(e.X, e.Y - 1);
}
if (lvi != null)
{
lvi.Selected = true;
}
}
}
private void lvMain_SelectedIndexChanged(object sender, EventArgs e)
{
if (lvMain.SelectedItems != null && lvMain.SelectedItems.Count > 0)
if (lvMain.SelectedItems.Count > 0)
{
TabPage tabPage = lvMain.SelectedItems[0].Tag as TabPage;
ListViewItem lvi = lvMain.SelectedItems[0];
TabPage tabPage = lvi.Tag as TabPage;
if (tabPage != null)
if (tabPage != null && !tcMain.TabPages.Contains(tabPage))
{
tcMain.Visible = true;
tcMain.TabPages.Clear();
tcMain.TabPages.Add(tabPage);
// Need to set ImageKey again otherwise icon not show up
tabPage.ImageKey = lvi.ImageKey;
lvMain.Focus();
}
}
}

View file

@ -521,7 +521,13 @@
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>"$(ProjectDir)prebuild.cmd" "$(ProjectDir)" "GitHash.txt"</PreBuildEvent>
<PreBuildEvent>cd $(ProjectDir)
for %25%25x in (git.exe) do if not [%25%25~$PATH:x]==[] (
git rev-parse HEAD &gt; GitHash.txt
) else (
type nul &gt; GitHash.txt
)</PreBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View file

@ -1,6 +0,0 @@
cd %1
if defined git (
"%git%" rev-parse HEAD > %2
) else (
type nul > %2
)

View file

@ -429,6 +429,13 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<PropertyGroup>
<PreBuildEvent>cd $(ProjectDir)APIKeys\
if not exist APIKeysLocal.cs (
type nul &gt; APIKeysLocal.cs
)</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">