- timelinedemoproject.zip
- TimeLineDemoProject
- TimeLineControl
- bin
- Debug
- TimeLineControl.dll
- Transitionals.dll
- Controls
- ExtensionMethods
- Images
- close.png
- leftArrow.png
- Interfaces
- Lib
- Transitionals.dll
- Misc
- Properties
- Resources
- States
- TimeLineControl.csproj
- TimeLineControl.csproj.user
- TimeLineDemoProject.sln
- TimeLineDemoProject.suo
- TimeLineDemoProject
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Collections.ObjectModel;
namespace TimeLineControl
{
/// <summary>
/// Viewing months state
/// </summary>
public class ViewingMonthsState : BaseState, IState, IDisposable
{
#region Data
private TimeLineControl context;
#endregion
#region Ctor
public ViewingMonthsState(TimeLineControl context, NavigateArgs args)
{
this.NavigateTo = args;
this.context = context;
base.StateVisualiser = new ViewingMonthsStateControl();
base.StateVisualiser.CurrentViewingDate = NavigateTo.CurrentViewingDate;
base.StateVisualiser.NavigateUpAction = new Action(context.NavigateUp);
base.StateVisualiser.NavigateDownAction = new Action(context.NavigateDown);
base.StateVisualiser.Parent = context;
((UserControl)base.StateVisualiser).Loaded += ViewingMonthsState_Loaded;
}
#endregion
#region Private Methods
private void ViewingMonthsState_Loaded(object sender, RoutedEventArgs e)
{
((UserControl)base.StateVisualiser).Height = context.Height;
base.StateVisualiser.ItemsDataTemplate = context.ItemsDataTemplate;
base.StateVisualiser.ReDraw(TimeLineItems);
}
#endregion
#region Public Properties
public override List<ITimeLineItem> TimeLineItems
{
get
{
if (context.TimeLineItems == null)
return null;
return context.TimeLineItems.Where(
tm => tm.ItemTime.Year ==
base.StateVisualiser.CurrentViewingDate.Year).ToList().SortList();
}
}
#endregion
#region IState Members
public void NavigateDown(TimeLineControl context)
{
context.State = new ViewingDaysState(
context,
new NavigateArgs(context.State.StateVisualiser.CurrentViewingDate,
NavigatingToSource.DaysOfMonth));
}
public void NavigateUp(TimeLineControl context)
{
context.State = new ViewingYearsState(
context,
new NavigateArgs(context.State.StateVisualiser.CurrentViewingDate,
NavigatingToSource.YearsOfDecade));
}
#endregion
#region IDisposable Members
public void Dispose()
{
((UserControl)base.StateVisualiser).Loaded -= ViewingMonthsState_Loaded;
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
Both of these at Sussex University UK.
Award(s)
I am lucky enough to have won a few awards for Zany Crazy code articles over the years
- Microsoft C# MVP 2016
- Codeproject MVP 2016
- Microsoft C# MVP 2015
- Codeproject MVP 2015
- Microsoft C# MVP 2014
- Codeproject MVP 2014
- Microsoft C# MVP 2013
- Codeproject MVP 2013
- Microsoft C# MVP 2012
- Codeproject MVP 2012
- Microsoft C# MVP 2011
- Codeproject MVP 2011
- Microsoft C# MVP 2010
- Codeproject MVP 2010
- Microsoft C# MVP 2009
- Codeproject MVP 2009
- Microsoft C# MVP 2008
- Codeproject MVP 2008
- And numerous codeproject awards which you can see over at my blog