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?


Ready to Learn Vue with ASP.NET Core?

My new Wilder Minds' course is available as an Early Access for only $79. It will be released on a weekly basis. The first module is now available:

Enroll Today


Shawn
Shawn Wildermuth
Author, Teacher, and Coach




My Courses

Wilder Minds Training
Vue.js by Example (Now Available)
Bootstrap 4 by Example
Intro to Font Awesome 5 (Free Course)
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.1)
Using Visual Studio Code for ASP.NET Core Projects
Implementing ASP.NET Web API
Web API Design
JavaScript for C# Developers

Application Name WilderBlog Environment Name Production
Application Ver v4.0.30319 Runtime Framework x86
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.26814.03
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86