Task-It Source Code

by XAML Team | Comments 32

Download Source Code 

Task-It Series

This post is part of a series of blog posts and videos about the Task-It (task management) application that I have been building with Silverlight 4 and Telerik's RadControls for Silverlight 4. For a full index of these resources, please go here.

Finally...the code

I've received many questions about when the source code for the Task-It application will be released. Well, the time has finally come.

I haven't been able to release this sooner due to the flurry of releases that have been coming out lately. Silverlight 4, WCF RIA Services, and even our Q1 Rad Controls. Each time I got the latest bits I ran into issues (either bugs or visual issues) in the Task-It that needed to be fixed. Having said that, the app is far from perfect. There are still some bugs lurking and things that need to be fixed up visually (especially the RadGridView filtering popup), but the main purpose of this app is to show the RadControls for Silverlight 4 in the context of a real-world application, and I don't want to keep delaying the release of the source code.

Minimum requirements

To run the app you will need the latest Silverlight bits. Silverlight 4 RTM, VS2010 and the Silverlight Tools for VS2010. I've also tried to make things lay out properly at a minimum resolution of 1024x768, but to be honest I get pretty used to laying them out on my monitor...which runs at 1920x1080. If you run it at 800x600 there are some things that may not lay out so well.

Custom styling

One thing you'll notice is that I've created a custom 'look' for the application. You may not be a fan of user interfaces that involve primarily black backgrounds, but my plan is to eventually have multiple skins available. What I have found in the last year of working with Silverlight app development though is that custom skinning is not for the faint of heart. It can be extremely time consuming getting things to look just as you'd like, and just when you have it right, a new release comes out that blows everything out of the water.

This is a piece of Silverlight that I think could be made a lot easier, and I have had some conversations with the Silverlight development team about this. Hopefully it'll get easier in the future. Oh, and one other thing, the custom skinning that I did is by no means a 'complete' skin. I didn't test things like control appearance in the disabled state, I didn't skin every control in the Telerik suite, etc., etc....so please don't take this as a new Telerik skin! :-)




As few frameworks as possible

There are a lot of Silverlight frameworks out there. One of my goals is to accomplish what I want to with as few of them as possible. After all, the more frameworks, the more dlls, the harder it is to manage framework updates, and the size of the Silverlight app grows and grows with all of those dlls. Aside from MEF, which is now part of Silverlight 4, the primary framework that I've leaned on is the MVVM Light Toolkit. Please check out some of my other blog posts, as I've blogged about using it for commands, and will soon be blogging about using it for publishing and subscribing to events (a.k.a. the Observer pattern).

Not entirely Blend-friendly

I'll admit that most of my development is done in VisualStudio, so if you open things in Blend you won't always get the correct appearance (most strings will not show up). A lot of this has to do with the fact that the view model classes that are the brains of the app are created dynamically by the MEF framework. I'm still working on this piece, and hopefully John Papa's View Model Locator pattern will be answer. I'm just trying to figure out how to implement it in the context of an app that includes multiple Silverlight Applications (the Tasks, Settings, Dashboard and Help project are each a separate Silverlight App that are dynamically loaded via MEF).

By the way, I'm not opposed to Blend, I just haven't had much luck with custom styling in it. For some reason I always seem to get a little ways into it, get stuck, and have to jump out to VisualStudio to examine the control template and understand how it is put together. One of these days hopefully I'll have time to really sit down with the latest version of Blend and get to the point where I am as comfortable in it as I am in VisualStudio.


Where are the comments?

One thing you'll find in my code is that there are very few comments. I spent several years working for an architect that is vehemently opposed to comments, so this is a style that I am used to. In his opinion, the code should be 'self-documenting'. The reason being that developers often spend a lot of times writing comments, only to find that they are frequently out of date...in the sense that the code has evolved but the comments have not. I've bought into this approach, where methods should contain very few lines, and have a name that clearly explain what the method is doing. I hope that you'll be able to read the code and make sense of what is going on.

Incomplete functionality

There are some pieces that aren't finished yet. One example would be the Attachments functionality. Another would be the ability to send a message to Facebook from the Tasks grid view. I put some stuff in as placeholders and just haven't had a chance to complete them yet. The app is also not set up for multiple users, it uses one hard-coded user (in the database's TaskItUser table) named John Doe. I did also hard-code the data in the Dashboard's Task Overview widget for now. At one time I was successfully populating this RadChart with data from a WCF RIA Services method call, but this was before I moved from LINQ to SQL to the Entity Framework. I'm still battling how to return the results returned by a stored prodecure (that takes a parameter) with the Entity Framework, and the documentation (and my Google searches) haven't provided the answer yet.






Telerik RadControls

Naturally I made heavy use of the Telerik RadControls in the app. Not just because I work for Telerik, but because I honestly feel that they are the best set of 3rd party controls out there, and that they provide enough functionality above what the Silverlight Toolkit controls have to offer to make them worth it. I've only been a Telerik employee for a little over 3 months, and for almost 4 years prior to joining the team I used RadControls in my applications for the reasons I mentioned above.

Validation and Internationalization

Currently there is some support for form validation and internationalization (or localization, or globalization, or whatever you want to call it) built into the app. For validation I'm not currently using the SL Toolkit DataForm. Although it does some nice functionality, there are some things I don't like about it, so I've implemented a different method of validation. As far as internationalization, I'm currently obtaining strings in the UI via binding to properties in my view model classes that return strings from the .resx files. I'm not sure yet whether I'm happy with either of these implementations (validation and internationalization) as there are some negatives to them, so things may change in the future...but after all, that's what development and refactoring is all about. Continue searching for ways to make things work in a cleaner more effective way!

The database

Unlike my previous posts the database lives in the App_Data folder under the .Web project. The web.config connection string is currently set to use .\SQLEXPRESS, so you may need to update that if your database instance name is different.

DLL security issues?

If by any chance you get warnings about security issues with dll's that were downloaded from another machine, go to the Libs directory under the Task-It project (on your file system, not in VisualStudio), right-click each of the 3 dll's in that directory and click the Unblock button in the bottom right section of the dialog.

More blogs to come...

Please keep an eye on my blog or follow me on Twitter (@rwozniak) as I will continue blogging about techniques and technologies used in Task-It. Please let me know if there are any particular topics you would like me to blog about. Oh, and please let me know what you think of the app and the code (and if you find bugs...I may or may not be aware of them). I'm always open to suggestions for improvement!

32 Comments

Tim
Very cool!  Thanks this will be an excellent reference application.
JACKY
Thanks for your shared!
Francois Vanderseypen
Very cool. Only noticed...you don't use OpenAccess. Probably also Resharper rather than JustCode, but less sure about that :)

I mean, thanks for sharing this code.
Tim
Very cool!  Thanks this will be an excellent reference application.
Ross
Francois, you are correct that I didn't use OpenAccess. Perhaps at some point in the future I will do a version that leverages that product, or just switch over in the main codebase, but wanted to stay with the ORM framework (RIA Services) that is a bit more familiar to developers initially.
Mike
Ross, thanks for posting the project.

I did download the project and tried to compile and I'm receiving a couple of errors, and I was hoping you might help me resolve one of them.

The one error appears to be a security issue because the dll's in the solution came from your computer and they were being blocked by my computer.  I was able to change the security on those files and that error seemed to go away.

The other error, which I'm hoping you can help with, is "TaskIt.Web.Task' does not contain a definition for 'IsComplete' and no extension method 'IsComplete' accepting a first argument of type 'TaskIt.Web.Task' could be found (are you missing a using directive or an assembly reference?)".  I'm get 10 instances of this error in the solution and they're all occurring in the file ListViewModel.cs.

Is there something missing in the project, or is there a another change I need to make to get it to work?
Ross
Hi Mike,

Sorry about the first error, though it sounds like you have that resolved. I'll update this post with the solution to that issue. I haven't figured out yet why that happens sometimes and doesn't others.

With regard to the second issue, it sounds like you are having a problem with RIA Services. If you look in Task.shared (in the Web project under Models/Shared) you should see this property. You can then click on the TaskIt project (the main Silverlight project) and click the Show all Files button in the toolbar above. Under Generated_Code/Models/Shared you should see Task.shared.cs, and if you open that you should se the same code you saw on the server side.

Do you have the latest Silverlight 4 stuff (RTM version and the latest Silverlight Tools for VS2010...which includes the latest WCF RIA Services bits)?

Ross
Ross
I added the DLL Security Issues? section to the end, in case folks run into the same issue that Mike did.

By the way, if you download the code and did not get this security warning please add a comment to let me know. I'm curious to see if this happens to everyone, or just some folks.

Ultimately I'd like to figure out if there's a way to prevent this from happening to anyone, but I'm not sure if that's possible. These security warnings seem to be new to SL4.

Thanks,
Ross
Mike
Ross, don't waste too much effort looking into my last post.  It looks like all of the problems I was having were related to the assemblies that were in the zip file were being "blocked" because they came from "the internet".  

As soon as I found all of the files that were blocked and unblocked them, I was able to perform a rebuild on the solution without any further errors.

Thanks again.
Mike
Just to follow up with the DLL security issue.

It took more than just unblocking the three DLLs in the libs directory for it to work for me.  I ended up having to unblock those files as well as files in most of the other include project\bin directories.  Specifically, GalaSoft.MvvmLight.SL4.dll had to be done every where it existed.  And there were several, but not all, files in the TaskIt\TaskIt\bin\Debug directory as well.

It was no big deal once I understood what I was facing.

I'm not sure why this has been happening for me more and more lately.  I've never run into this as frequently has I have been in the last month.  Maybe it's something I changed on my machine.

Mike
Ross
As other folks download the solution please let me know if you are experiencing the same thing as Mike.

I don't know how long you've had SL4 on your machine, but I've been working w/ it for several months, and I believe it's been since the Beta version first came out that I started getting these security messages when I downloaded other developer's solutions that included referenced dll's as part of the download...so it appears to be something new to SL4.

Thanks,
Ross
Bruce Krasnof
In case it helps, unblocking the zip file before extracting might unblock everything, but also, there's a free command line tool to unblock all assemblies recursively:

http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx

see this article:

http://elijahmanor.com/webdevdotnet/post/Recursively-Unblock-Assemblies-with-Streams.aspx
Sean
Great reference project, not even Microsoft with its amount of resource can deliver such a solid reference sample project. 

Also, I really think you should stay with the RiaServices where the majority goes. That way it could attract more people to your blog and eventually benefit Telerik. 

Hope to see this project grow with more features. (ie with scheduler control)

Again, well done!
Sean


 
Ross
Thanks very much for the words of encouragement Sean!

If you grab the Task-It source code you'll see that I've used the RadScheduler in the Tasks and Dashboard pages. In the Tasks page, click the icon in the upper right (the toggle button next to the Incomplete/Complete dropdown. That will show you the tasks in 'Calendar' view...which is the RadSceduler. You can right click on calendar items for a RadContextMenu and even drag and drop them on the RadTreeView, just as you can with items in the RadGridView.

In the Dashboard the Tasks Due This Week and Projects Due This Week widgets also use the RadScheduler, though they are currently read-only.

One note though, it may not 'look' entirely like the RadScheduler because I'm only using the Timeline view. The reason is that tasks are not really like traditional appointments. They don't have a start and end time, just a Due Date, which is what determines whether the task will show up in those views. For this reason, using the Month, Day and Week views don't really fit.

I think I'll add 'Using the RadScheduler in Task-It' to my list of upcoming blog posts. :-)

Ross
Daniel Plomp
Very nice project! I was wondering what I should do to run it as a standalone website. So, to deploy it to a webserver?
Ross
Thanks Daniel.

You can right-click on the .Web project and select the Publish command.

You may also want to check out this post:

http://forums.silverlight.net/forums/t/4706.aspx

Ross
Gary
At last a real world application to guide me through all of EF, MVVM, WCF RIA Services, Telerik RADControls, SL 4. I felt all at sea before with only snippets of code to show a slice of the software technology pie we are expected to eat as developers of Today's applications.

I downloaded the app and proceeded to build it. I got the 'IsCompleted' error as detailed above. So as it was in the generated code section of the client from the server's service code, i did a 'Clean Solution' then app built OK.
I didn't encounter any of the security dll blocking issues.

I'm using VS2010, SL 4, SL 4 Toolkit which includes WCF RIA Services v1.0, Telerik RADControls for SL 4.
Gary
At last a real world application to guide me through all of EF, MVVM, WCF RIA Services, Telerik RADControls, SL 4. I felt all at sea before with only snippets of code to show a slice of the software technology pie we are expected to eat as developers of Today's applications.

I downloaded the app and proceeded to build it. I got the 'IsCompleted' error as detailed above. So as it was in the generated code section of the client from the server's service code, i did a 'Clean Solution' then app built OK.
I didn't encounter any of the security dll blocking issues.

I'm using VS2010, SL 4, SL 4 Toolkit which includes WCF RIA Services v1.0, Telerik RADControls for SL 4.
Dirk

Great Demo!

But I get an 10 errors in TaskIt.Modules.Taks -> ViewModels -> ListViewModel.cs

All errors have a problem with the definition for 'IsComplete'

 

Utils

 

 

.DataContext.Tasks.Where(t => t.IsComplete == SelectedTaskStatus.Value) :

 

 

 

Utils.DataContext.Tasks.Where(t => t.TaskCategoryID == SelectedTaskCategory.ID).Where(t => t.IsComplete == SelectedTaskStatus.Value);

 


Error-Message:
TaskIt.Web.Task does not contain a definition for 'IsComplete' and no extension method 'IsComplete' accepting a first argument of type TaskIt.Web.Task could be found. (are you missing a using directive or an assembly reference?)

What's to do, to solve this issue?


Regards
Dirk
dirk
I've solved the problem in my last post. I've first build the application and then I've clean the solution and I try to build again it didn't work.
I've new unzip all, clean the solution and build it. After I don't get the IsComplete Error.

Now I get a nullreference error in MainViewModel.cs

 

 

public

 

 

void LoadPackage(AsyncCompletedEventArgs args, Package package)

 

{

 

 

Utils.HideBusyIndicator();

 

 

 

if (!args.Cancelled && args.Error == null)

 

{

Packages.AddPackage(package);  <== null reference

}

}

In debugger package have entries.

 

 

 

 



I don't find the problem.

Regards
Dirk

 

dirk
My Exeption Details:
System.NullReferenceException was unhandled by user code
  Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  StackTrace:
       bei System.ComponentModel.Composition.Packaging.PackageCatalog.AddPackage(Package package)
       bei TaskIt.ViewModels.MainPageViewModel.LoadPackage(AsyncCompletedEventArgs args, Package package)
       bei System.ComponentModel.Composition.Packaging.Package.client_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e)
       bei System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
       bei System.Net.WebClient.OpenReadOperationCompleted(Object arg)
  InnerException:
Ross Wozniak
Hi Dirk,

I'm not sure offhand what the problem could be. Many folks have downloaded the source and not run into this issue. The first thing I'd check is to make sure you have 5 .xap files in the ClientBin folder under the TaskIt.Web project.

Ross
Brian
Hi Ross,

What Project Template did you use for creating TaskIt.Modules.Tasks project?

Thanks
Brian
Ross
Hi Brian,

If I remember right (it's been a while), I simply used the Silverlight Application template. I didn't really need the navigation stuff from the Navigation template or any of the additional stuff that the Business template. I also did not check the Enable RIA Services checkbox, because all of the app's data comes from the DataProvider class in the TaskIt project.

Ross
Simon Phillips
Hi Ross,

I have downloaded your application but have run into an issue, Visual Studio is saying that a lot of your classes are not CLS-Compliant. What can i do to fix this error?

Thanks,
Simon
Allen
I have the same setup as Gary and had a lot of trouble getting the project to run.  After doing all the unblocking with Streams and also updating all the references for the latest Telerik Silverlight (2010.2.714.1040), I still couldn't get a compile.  Then, I used the solution clean and that finally got the project to run.  Hope that helps somebody else.
Arturas
Hi

I'm having trouble starting this solution.
The problem is in System.ComponentModel.Composition.Packaging.Toolkit assambly, that apparently is removed from toolkit. PackageCatalog class has been renamed to DeploymentCatalog, but the problem is that DeplyomentCatalog doesnt have AddPackage or AddDeployment, for that matter, method.
How can i work around this.

Thanks
Helen W
When I attach the database to my SQL2008 (Developer Edition) and build the project, I keep getting the error:

Error 34 'TaskIt.Web.Task' does not contain a definition for 'IsComplete' and no extension method 'IsComplete' accepting a first argument of type 'TaskIt.Web.Task' could be found (are you missing a using directive or an assembly reference?) 

Do I have the wrong version of the database or code?

Thx
KS
I got the same error about the 'IsComplete' and what fixed this for me was to clean the solution then build it again. I did clean then build. Not the rebuild.
Denis
Why the project displays only "There were no items found"?

What should I do with database?
Gilberto Beltrao
Initially, I was having the same problem as Dirk and others (IsComplete). After I cleaned up the app it ran fine, but when I clicked the first icon (Tasks) it is throwing an exception as follow:

XmalParseException Occurred:

The invocation of the constructor on type 'TaskIt.Modules.Tasks.Views.TasksPage' that matches the specified binding constraints threw an exception. [Line: 12 Position: 22]

Any clues?

Regards,
Gilberto
Dave
Hi Ross,



Rockin app!



For anyone getting errors in the TaskIt project, once I installed SP1 for WCF RIA Silverlight 4 VS 2010, it all came together nicely. So make sure that is installed.



I'm a bit late to the party, but I now intend to read all the posts and follow along for the ride.



Big cheers.

Comments

  1.    
      
      
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)
Read more articles by XAML Team - or - read latest articles in Developer Tools