Ranting and raving about anything I feel like complaining about.

Tag: Open Source

Total Results: 11
Page 1 > >>

Phoney Tools 1.0 Released!

Url: http://phoney.codeplex.com/

PhoneyTools on CodePlex

UPDATE: Last update (hopefully for a bit), found another issue and now that NuGet is up, the new package is ther for 1.0.3.

UPDATE: Another small issue.  1.0.2.  That's why you should use NuGet ;)

UPDATE: Found a small issue, if you downloaded 1.0, please go get 1.0.1!

I am proud to announce that PhoneyTools has now reached 1.0! If you haven't had a chance to look at the project, it's a collection of tools for your Windows Phone 7 applications.  The PhoneyTools project includes:

Controls

  • FadingMessage class
  • SelectSwitch Control
  • SimpleLongListSelector Control
  • ClearableTextbox Control

Helpers

  • BitlyHelper class
  • GravatarHelper class
  • InstaPaperHelper class
  • InputScopeHelper class
  • EnumHelper class

Other Classes

  • GameTimer class
  • InputPanelProvider
  • MD5Managed class
  • MicrophoneRecorder class
  • ObservableObject class
  • Phone Resources classes
  • PhoneNetworking class
  • PhoneLogger class
  • SoundEffectPlayer class
  • ObstructionDetector class

Converters

  •  DateTimeConverter
  • MoneyConverter
  • NullVisibilityConverter
  • StringCaseConverter
  • StringFormatConverter
  • UnHtmlConverter
  • VisibilityConverter

Getting Phoney Tools

You can get the Phoney Tools in three ways:

 

 

 
 

Phone Tools v0.6 Released - Breaking Change!

Url: http://phoney.codeplex.com

Phoney Logo

A new version of Phoney Tools is now available. There are some significant changes and some new code so go check it out!

Breaking Changes

In prior versions if you included PhoneyTools in your project you'd get the following capabilities detected even if you weren't using them:

ID_CAP__MICROPHONE
ID_CAP__NETWORKING

We've addressed this by splitting the tools into three assemblies:

 

  • AgiliTrain.PhoneyTools: The main PhoneyTools classes.
  • AgiliTrain.PhoneyTools.Net: PhoneyTools Networking classes.
  • AgiliTrain.PhoneyTools.Microphone: PhoneyTool Microphone class.

 

New Classes

NuGet Changes

Following Scott Hanselman's excellent advice, we've streamlined the Nuget process and removed the pre-and post scripts and added a ReadMe file to help explain what to do next.

 

 
 

On Silverlight TV to Talk About Phoney Tools

Url: http://shawnw.me/dEUJJk

Silverlight TV

I had the pleasure to join John Papa on Silverlight TV to talk about my Phoney Toolkit. If you get a chance take a look and see if you like what i've built. I got a chance to plug the upcoming Open Source Fest at MIX 11 as well.

 

 
 

Phoney Tools Updated (WP7 Open Source Library)

Url: http://phoney.codeplex.com

Phoney Tools

A new version of the Phoney Tools are available now (v0.3.1). This is the last Alpha release before I get ready for Beta in the next couple of weeks.  The official release is slated for MIX11!

Changes in this version include:

  • Refactored FadingMessage class to not allow concurrent messages, but you can get the behavior by deriving your own FadingMessage class (example is shown in the Example app).
  • Added new Converters: StringFormat, VisibilityConverter, NullVisibilityConverter, MoneyConverter and DateTime Converter.
  • Added new class called GameTimer to handle the FrameworkDispatcher.Update for you when using certain XNA libraries from Silverlight.
  • Added new class called MicrophoneRecorder to simplify recording sound.
  • Added new class called SoundEffectPlayer to simplify playing sounds without a MediaElement.
  • Added new class called PhoneNetworking to allow you to detect what type of network connection the phone is using (if any).
  • Fixed a number of small bugs.
  • Refactored the Example application to show off all the new features.

You can get the library by going to http://phoney.codeplex.com or using NuGet to get the latest Phoney Tools package!

Let me know what you think!

 

 
 

Introducing Phoney's FadingMessage Class

Url: http://www.vimeo.com/20362526

Windows Phone 7

I wanted to show how my new FadingMessage class works so I recorded a quick video to show it off.  If you want to play with the code, don't forget you can get Phoney from codeplex (http://phoney.codeplex.com) or just search for Phoney on NuGet!

Here's the video:

 

 

 
 

Phoney Windows Phone 7 Project Now Available!

Url: http://phoney.codeplex.com/

Silverlight Logo

UPDATE: Phoney now has a NuGet package.  Search on NuGet to add Phoney to your project!

I started this project when I found I had a number of small classes that I'd built for my Windows Phone 7 application so I thought it was time to share. here is the information on the new library.  

It is currently in a very early Alpha stage, but I expect to have it at a release version by MIX 11 (Mid-April). Let me know what you think!

Project Description

This is a project that contains several classes and controls for use with Windows Phone 7 applications. There are plans for:

  • Standard Set of Converters
  • Several Controls
  • BitlyHelper
  • TwitterHelper
  • PhoneLogger
  • ObservableObject
  • FadingMessage class

Exposing all the Phone Resources (e.g. PhoneTextSizeLarge) as staticly typed accessors

Current Version is 0.1.

Only the following features are included:

  • BitlyHelper
  • PhoneLogger
  • FadingMessage
  • ObservableObject
  • Phone Resources

Examples:

BitlyHelper class

Simple class for shortening URI's using your own Bit.ly API Key/username:

BitlyHelper.SetCredentials("MYBITLYAPIKEY", "MYBITLYUSERNAME");
BitlyHelper.Shorten("http://phoney.codeplex.com", (result, error) =>
  {
    if (error != null)
    {
      MessageBox.Show(string.Concat("Error Shortening Url: ", 
                                    error.Message));
    }
    else
    { 
      MessageBox.Show(result, 3000);
    }
  });

FadingMessage class

This class is to create messages that show up as a popup that fades in and fades out. For simple messages:

FadingMessage.ShowTextMessage("Saved...");

You can control the look and contents of the message by supplying your own UI objects:

FadingMessage msg = new FadingMessage()
{
  MessageToShow = theMessage,
  VerticalAlignment = VerticalAlignment.Top,
  HorizontalAlignment = HorizontalAlignment.Right
};
msg.Show(3000); // 3 seconds

PhoneLogger class

This class is to save a simple log file in Isolated Storage and can retrieve the contents of the log on demand:

PhoneLogger.LogError("Test Logging Message");

var log = PhoneLogger.LogContents;

ObservableObject class

This is an abstract class that supports the INotifyPropertyChanged interface for ease of hand-building objects that need observation.

public class MyObject : ObservableObject
{
}

Phone Resources

All of the known phone resources have accessors to give you strongly-typed access to the phone-based resources. Static Classes include:

 

  • PhoneColors
  • PhoneBrushes
  • PhoneFontSizes
  • PhoneFontFamilies
  • PhoneTextStyles
  • PhoneThicknesses

 

var theContainer = new Border()
{
  Background = PhoneBrushes.PhoneContrastBackgroundBrush,
  BorderBrush = PhoneBrushes.PhoneBorderBrush,
  BorderThickness = PhoneThicknesses.PhoneBorderThickness,
  CornerRadius = new CornerRadius(5)
};

theContainer.Child = new TextBlock()
{
  Margin = PhoneThicknesses.PhoneMargin,
  TextWrapping = TextWrapping.Wrap,
  Style = PhoneTextStyles.PhoneTextNormalStyle,
  Foreground = PhoneBrushes.PhoneAccentBrush,
  Text = message
};

In addition a PhoneTheme class that gives you a simple way to test for which theme (light or dark) the phone is using:

if (PhoneTheme.IsDarkTheme)
{
  // Change something because it's dark
}
else
{
  // Change it because it's light
}

 

What do you think?

 
 

Announcing: GiveAQuiz.com!

Url: http://giveaquiz.com

GiveAQuiz.com

So my blog has been pretty quiet lately and I thought I'd let you know why. With a small team, I've been building GiveAQuiz.com

Several months ago I was working with a client who wanted me to put together a short quiz on Silverlight to help determine which of their developers got to join their Silverlight team. So I did what I always do, I searched the Internet for some small startup site that let's me accomplish the task at hand. Unfortunately all I found were logs of 'survey' sites that would let me put together some questions but only receive summary results. The one site I found that would let me build a quiz, only would let me print a PDF of the quiz to give to people by hand. This got me thinking about how a site that let people give quizzes might not only be helpful to people like me, but also to teachers of all kinds. I was determined to create the site...when I had free time (yeah, I know).

As I had chances, I would do some small part of the planning.  When I wrote a SketchFlow article, I used the opportunity to prototype some of the screens for the article.  But to get the site really built, I needed help. To the rescue came Microsoft and Chris Sells. Chris and I decided we wanted to build the site in the same spirit as NerdDinner.com. Microsoft would help fund the development of the site and I would write a whitepaper and do some videos on how we built the site.

I put together a small team consisting of Chris Rauber (ASP.NET MVC dev extraordinaire), Dennis Estanislao (designer savant) and myself to build this site. The site is now live, but is in a private beta mode (where you can e-mail me to get an account for a limited number of users) until we get the bugs out. 

Building the site was a lot of fun and we got to mix a lot of technologies inlcuding:

  • .NET 4.0
  • ASP.NET MVC 2
  • jQuery
  • Silverlight 4
  • Entity Framework 4
  • WCF Data Services 4
  • Visual Studio 2010
  • SQL Server Project Type (e.g. Data Dude)
  • SQL Server 2008 R2
  • SQL Server Reporting Services

From the beginning the expectation was to have the source code available under MS-PL so that it could be an exemplar for other developers to see how a site with the latest Microsoft stack.  You can find the current version of the source code on CodePlex at http://giveaquiz.codeplex.com. We are accepting new members to help implement new features after launch so if you're interested in helping, feel free to apply on the CodePlex site. We we do a formal release of code once the private beta is complete. We also used AgileZen.com (who graciously granted us a free license since we were working on an open source project) and using it for workflow between disconnected members turned out really well.  Love the product!

So now its your turn, I want to ask you my readers to check out GiveAQuiz.com and ask for a private beta account.  The first twenty-five people who contact me at "shawn at giveaquiz dot com" will get into the private beta.  Help us find the bugs please!

 

 
 

My Favorite Silverlight Extensions APIs - Part 1

Url: http://slextensions.codeplex.com

SilverlightAs some of you may know, I am a contributor to the SilverlightContrib open source project. Recently this project and the Silverlight Extensions open source project (also know as SLExtensions) decided to merge to create a single place for a lot of interesting functionality.

I want to highlight some of the pieces that I didn't contribute as I've seen a lot of really great functionality for those of you who are building Silverlight Applications.  I honestly have no idea how many parts this blog series will be, as long as I have parts that are interesting, I'll continue to post about them.

First up is SLExtension's Bootstrapper functionality. If you are currently using Prism or a related technology to compose your application at runtime, this functionality is lost on you. The Bootstrapper functionality is for that middle-ground where you want to break up your project into a small number of .xap files that are loaded when the project loads up but don't need a full composition engine with MEF or Prism.

The Bootstrapper functionality is in a separately assembly in the SLExtensions project (SLExtensions.Bootstrapping.dll). This is a small assembly (so that your main project loads fast). The way it works is to have you change the derived class for the App.xaml to a BootstrapApplication:

public partial class App : BootstrapApplication
{

Since its the App.xaml class, you'll need to change the XAML as well:

<bs:BootstrapApplication 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="FunWithBootstrapper.App"
  xmlns:bs="clr-namespace:SLExtensions.Bootstrapping;
            assembly=SLExtensions.Bootstrapping">
  <bs:BootstrapApplication.Resources>

  </bs:BootstrapApplication.Resources>
</bs:BootstrapApplication>

Once you have the application changed, you will need to override the Xaps property to supply the list of XAP files to load:

protected override IEnumerable<Uri> Xaps
{
  get
  {
    // Must be absolute Uris so we steal it from the host
    return new Uri[] { 
      new Uri(new Uri(Host.Source.AbsoluteUri), "SecondApp.xap"),
      new Uri(new Uri(Host.Source.AbsoluteUri), "ThirdApp.xap"),
    };
  }
}

At this point it will load up the other .xap files but we won't be able to do anything with them. So let's look at the other projects briefly.

The other Silverlight Projects

The other Silverlight projects are actually full Silverlight Applications (not Client Library projects). The Bootstrapper is usually used to create a 'splash screen' xap file that loads the other parts of the applications.  Again, not real composition like Prism, but something less than that.

Project Reference Dialog

In the main project, you will make a reference to the other application projects. That's how you'll be able to reference the code from the other xap files (though only once they've been loaded).

To help you know when its updated, the Bootstrapper application has two facilities:

  • Progress event
  • OnApplicationReady overridable method

Now that you have a bootstrapping application, you want to be able to work with it. The first thing I usually do (because I want to use the Bootstrapping API's from anywhere without casting) is create a new static property on the Application class:

// Better access to the bootstrapping app
public static App MyApp
{
  get { return Current as App; }
}

Then I can use the Progress event to show the user some progress like so:

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
  App.MyApp.Progress += 
    new EventHandler<BootstrapEventArgs>(Bootstrap_Progress);
}

void Bootstrap_Progress(object sender, BootstrapEventArgs e)
{
  thePartProgress.Value = e.StepProgress;
  theFullProgress.Value = e.OverallProgress;
}

I'd like to be able to know when the application is completely loaded too. Unfortunately the Progress event tends to not return 100% at any time.  I haven't figured out why yet, but to get around that you can use the OnApplicationReady overridable method:

public partial class App : BootstrapApplication
{
  ...
  
  protected override void OnApplicationReady(StartupEventArgs e)
  {
    // Do startup behavior
  }
  
  ...
}

While this works, I often don't want to do this work in the App class, but instead in other parts of my application (e.g. MainForm.xaml.cs). So For my use, I usually expose an event as well:

public event EventHandler<StartupEventArgs> StartupComplete;

protected override void OnApplicationReady(StartupEventArgs e)
{
  if (StartupComplete != null)
  {
    StartupComplete(this, e);
  }
}

By throwing an event when the application is ready, I can register for this event and do the startup once I know all the code is available:

// MainPage.xaml.cs
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
  App.MyApp.Progress += 
    new EventHandler<BootstrapEventArgs>(Bootstrap_Progress);

  App.MyApp.StartupComplete += 
    new EventHandler<StartupEventArgs>(Bootstrap_StartupComplete);
}

void Bootstrap_StartupComplete(object sender, StartupEventArgs e)
{
  // Use the loaded types 
  // (SecondApp.MainPage and ThirdApp.MainPage)
  theSecondApp.Children.Add(new SecondApp.MainPage());
  theThirdApp.Children.Add(new ThirdApp.MainPage());
}

Note that once the bootstrapping has completed you can use the assemblies in the other .xap projects. If you attempt to use them before, you'll get an exception that it couldn't load the type.

Just to prove the point, here is a list of the .xap files.  Notice that the 2nd and 3rd .xap file are pretty big but even with the bootstrapping assembly, our code is only 10K which means it should load very fast:

Relative XAP Sizes

Neat?  What do you think?

You can get the source to my example here:

http://wildermuth.com/downloads/FunWithBootstrapper.zip  

 

 
 

Introducing Project Niagara

Url: http://niagara.codeplex.com

The NiagaraThe goal of Project Niagara is to democratize the validation support. The project wants to help developers add validation support to ADO.NET Data Services as well as Web Services in Silverlight. In addition, it has the goal of allowing multiple ways to supply the validation metadata to the different data access strategies. As it is my opinion that there are scenarios where attributes are not the best idea.

The deliverables for this project will include:

  • ValidatingDataSvcUtil: Produce Validating Data Service Proxies.
  • ValidatingProxy Library: Supply external metadata for generation of Proxies.
  • MValidation: DSL for defining Validation outside of attributes.
  • Oslo Integration: to store/retrieve validation out of the Oslo Repository.
  • Alignment: RIA Services' and ADO.NET Data Services' Validation Logic

At this point the project is very young (version 0.1) and a lot of the pieces are not ready but I am looking for help!  I can't write it all. Please visit the CodePlex site and take a look at what I want to accomplish and send me a message if you want to help out:

http://niagara.codeplex.com

Current State of Niagara

Currently, I have built up some infrastructure to allow the whole project. This inlcudes a first pass at the DSL.  The one working pieces is the ValidatingDataServiceUtil which allows you to manually generate (via the command-line) an ADO.NET Data Service proxy that includes support for validation attributes and calling validation during two-way binding.

The current version does not have a release yet, but if you're brave and willing to report bugs, you can get the source and build it yourself.

To use the ValidatingDataServiceUtil, you can call it from the command-line:

NiagaraDataServiceUtil.exe http://localhost:14000/GameService.svc 
  ..\Niagara.Sample.Web\bin\Niagara.Sample.Web.dll 
  .\GameService.cs 
  Niagara.Sample.Data /v /b /c:V2

While more complex than the original DataSvcUtil, the arguments are pretty straightforward:

  • URI to the ADO.NET Data Service endpoint.
  • Path to the assembly that holds the types and metadata (so we can read the metadata with reflection).
  • The output file.
  • The namespace to use.
  • Options to specify what version of the data service library to use, bindability and validation.

This is an alternative to using a service reference. We hope to move this to be a project item instead of a command-line for the project.

NOTE: It requires the ADO.NET Data Services CTP2 to work. 

Let me know what you think!

 
 

Implementing IUpdatable (Part 2)

Silverlight Logo

If you haven't read Part 1 yet, you can read it here.

After spending time creating my own caches of reflection data I found the NHibernate type information to be more complete and faster. Go figure.  At this point I am using the SessionFactory's GetClassMetadata and GetCollectionMetadata to return IClassMetadata and ICollectionMetadata interfaces. So far this has given me every piece of runtime information I need and means that I don't need to do any nasty (and potentially fragile) walking through the property interface of the context object. Whew...

So to refactor my GetResource and CreateResource calls. GetResource is easy.  GetResource passes in the query and the full type name (though the full type name may be missing in some cases). The query it passes it must resolve to a single result.  That means I can simply execute the the query and if it returns more or less than one result, return an error.  Once I have the result I can just check it against the full type name (if it was passed in) and return the value.

CreateResource is a bit more complicated. The IClassMetadata allows me to call their Instantiate method to create a new instance of the class but the new instance is not initialized with any data.  Most notably, the missing detail is a key. In the case of many entities, this is fine (e.g. if zero ID is a valid "new" entity).  But in others the key needs to be specified. (Customer in the Northwind database is an example of this.) The problem is that we have to keep a reference to the new objects so that when ADO.NET Data Services asks us to set properties, get properties and save, we have to have the object in the Session.  But we can't add it to the Session with an invalid key.  What to do?  My solution for now is a local cache of objects that are not ready to be saved (only really happens with newly created objects). When we are ready to save, we'll just add it to the Session then (when its either valid or we'll throw an exception because its invalid).

Now a quick mention of GetProperty and SetProperty. These are both pretty easy as the IClassMetadata includes a similar method to set and get properties. The only wrinkle is that if you try and set a key using the GetProperty/SetProperty, the keys are not in the list of properties.  Because of this I just checked to see if the property is part of the key and set the key instead, if its not part of the key we can just set or get the property.  Now that we have the basic part of the interface complete  its down to the hard parts.   But that's for the next part!

 

 
 
Total Results: 11
Page 1 > >>