Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup code, add some comments and add change selection mode runtime. #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Empty file.
Binary file added .vs/WindowsFormsCalendar/v17/.suo
Binary file not shown.
92 changes: 82 additions & 10 deletions TestHarness/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 33 additions & 13 deletions TestHarness/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using WindowsFormsCalendar;
Expand All @@ -26,9 +21,10 @@ public Form1()
{
InitializeComponent();

CalendarItem item = new CalendarItem( this.calendar1, DateTime.Now, DateTime.Now, "TEST" );
CalendarItem item = new CalendarItem(this.calendar1, DateTime.Now, DateTime.Now, "TEST");

_items.Add( item );
_items.Add(item);
_items.Add(new CalendarItem(this.calendar1, DateTime.Now, DateTime.Now.AddDays(2), "TEST 2"));

}

Expand All @@ -39,13 +35,13 @@ public Form1()
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarLoadEventArgs"/> instance containing the event data.</param>
private void calendar1_LoadItems( object sender, CalendarLoadEventArgs e )
private void calendar1_LoadItems(object sender, CalendarLoadEventArgs e)
{
foreach( CalendarItem calendarItem in _items )
foreach (CalendarItem calendarItem in _items)
{
if( this.calendar1.ViewIntersects( calendarItem ) )
if (this.calendar1.ViewIntersects(calendarItem))
{
this.calendar1.Items.Add( calendarItem );
this.calendar1.Items.Add(calendarItem);
}
}
}
Expand All @@ -59,12 +55,36 @@ private void calendar1_LoadItems( object sender, CalendarLoadEventArgs e )
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void monthView1_SelectionChanged( object sender, EventArgs e )
private void monthView1_SelectionChanged(object sender, EventArgs e)
{
this.calendar1.SetViewRange( this.monthView1.SelectionStart.Date, this.monthView1.SelectionEnd.Date);
this.calendar1.SetViewRange(this.monthView1.SelectionStart.Date, this.monthView1.SelectionEnd.Date);
}

#endregion

private void toolStripComboBox1_Click(object sender, EventArgs e)
{

}

private void dayToolStripMenuItem1_Click(object sender, EventArgs e)
{
this.monthView1.SelectionMode = MonthViewSelection.Day;
}

private void weekToolStripMenuItem_Click(object sender, EventArgs e)
{
this.monthView1.SelectionMode = MonthViewSelection.Week;
}

private void workWeekToolStripMenuItem_Click(object sender, EventArgs e)
{
this.monthView1.SelectionMode = MonthViewSelection.WorkWeek;
}

private void monthToolStripMenuItem_Click(object sender, EventArgs e)
{
this.monthView1.SelectionMode = MonthViewSelection.Month;
}
}
}
3 changes: 3 additions & 0 deletions TestHarness/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>130, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>54</value>
</metadata>
Expand Down
6 changes: 2 additions & 4 deletions TestHarness/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace TestHarness
Expand All @@ -14,8 +12,8 @@ static class Program
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new Form1() );
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
25 changes: 12 additions & 13 deletions TestHarness/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "TestHarness" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "HP" )]
[assembly: AssemblyProduct( "TestHarness" )]
[assembly: AssemblyCopyright( "Copyright © HP 2012" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
[assembly: AssemblyTitle("TestHarness")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("TestHarness")]
[assembly: AssemblyCopyright("Copyright © HP 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "734b7e11-5f67-4701-ae69-c7e558ebdb14" )]
[assembly: Guid("734b7e11-5f67-4701-ae69-c7e558ebdb14")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -32,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading