Here are my notes on WPF, which are from this MSDN article by Tim Sneath:

INTRODUCTION

There has traditionally been competition in the world of application development between stand-alone applications and web-based applications, each having somewhat opposite strengths and weaknesses.  There is a need for a client application model for both standalone and browser-based applications that offers ease of deployment, tools support, and deep platform integration. 

Modern video cards have come a long way in the last few years and most of today’s mainstream applications don’t take full advantage of their powerful abilities.

WPF is the new strategic Windows graphics subsystem that harmonizes user interface, 2D and 3D graphics, documents, and media.  It takes full advantage of modern graphics hardware and supports both stand-alone and web-based applications.  It is built on the .NET framework.  It allows designers to be more involved in the development process via declarative programming models (see XAML below).

DESIGN PRINCIPLES:

Integration: Seamless integration between base services, media services, document services, and UI services

Vector graphics: WPF takes full advantage of the powerful new Graphical Processing Units (GPUs) with vector graphics, a large pixel system, and extensive color support.  It offers resolution independence.  It also has great support for layout, which adapts to content and manages the position of controls and items within a window.

Declarative programming: WPF uses XAML (eXtensible Application Markup Language) for defining and building the UI.  Allows designers and developers to work more closely

Easy deployment: Supports both stand-alone apps and web-browser apps

Document lifecycle: Supports new document and print technologies

XAML

XAML is not required for WPF; it is merely a conventient shorthand for UI programming.  Anything written in XAML can also be written in C# or VB. 
It is intended to be used alongside a traditional programming language.

I have been watching a series of webcasts created by Microsoft MVPs that introduce various features of SharePoint to .NET developers.  The entire series can be found here.  These are my notes from the third webcast, on SharePoint and Silverlight.

PRESENTER:
Andrew Connell
MVP Office SP Server
www.andrewconnell.com/blog

SILVERLIGHT OVERVIEW

Silverlight develops a rich user experience with zero postback

Some types of data Silverlight can provide:

  • images, sounds, videos, rss
  • custom web service
  • existing intranet services
  • public internet mashup APIs

HISTORY OF SILVERLIGHT

Silverlight 1.0:

  • Silverlight 1.0 is the current production release (RTW) and was shipped in Q3 2007
  • It defines the render(design) part using XAML
  • Uses a WPF-based interface
  • A Silverlight application lives inside of a webpage
  • The webpage will include some custom JavaScript (AJAX) to talk to the Silverlight app and to the various web services.  I.E., the code-behind is 100% JavaScript-driven

Silverlight 2.0:

  • Today: Silverlight 2.0 is in beta.  It doesn’t need JavaScript to talk to Silverlight
  • The Silverlight plugin deploys a tiny version into the .NET Framework, and now I can write C# or VB code and then complie the code into an asembly, and now the assembly will be part of the Silverlight file (control) and the assembly will be running on the client machine.  I.E., the code-behind uses managed code
  • Some of Silverlight 2.0 runtime features include 2-D, graphics, audio, video, animations, text, controls, layout, styles/templates, data binding, networking, .NET Support, LIN1, XML API’s, generics, HTML integrtions, local storage, Crypto APIs, and threading

Silverlight 2.0 SDK libraries include:

  • Full support for dynamic languages
  • Addition controls like sliders, grid controls
  • LINQ for XML
  • XML Serialization
  • RSS feeds

SHAREPOINT AND SILVERLIGHT

Environment needed:

  • WSS 3.0 SP1
  • Config of IIS Web app

Server config needed:

  • .NET Framework 3.5 if using Silverlight 2.0, or .NET 2.0 for Silverlight 1.0
  • Deploy System.Web.Silverlight.dll in GAC
  • Extend web.config if ISS web app with ASP.NET extensions and SL 2.0 config elements
  • MIME type registration of the .XAP file extension for IIS web app (format: application/x-silverlight-2-b1

Dev environment needed:

  • Visual Studio 2008 extended with tools for Silverlight 2.0
  • Microsoft Expression Blend
  • Silverlight 2.0 SDK (which would be included in VS 2008 tools)

Client prerequisites: Silverlight 2.0 plug-in must be installed

Scenarios for using Silverlight:

  • Complex and dynamic interaction with dashboard data (visually impressive reports, etc)
  • Visualize multimedia data stored in SP
  • Rich navigation controls
  • Interactive field types, Web parts, and pages
  • Off-load more work to the clients (browsers)

SILVERLIGHT 2.0 AND SHAREPOINT

Host containers that can be used to trigger a Silverlight control:

  • Web Parts
  • App pages and site pages
  • Custom field types
  • Navigation control

Data can be passed in both directions:

  • InitParameters – passes data into Silverlight (like if you were calling a method)
  • Hidden Fields or XML Data Islands
  • Web Services
  • WPF

App config updates

August 28, 2008

I’ve cleaned up the code a little from one of my previous posts, Sample code: App configuration settings for .NET 2.0, and added some comments for when you’re developing a web app.

Implementing a custom installer

This is an example class, which would need to be created in the same assembly as the application needing to be installed:

[System.ComponentModel.RunInstaller(true)]
class NewInstaller : Installer
{
    public NewInstaller() : base()
    {
        this.Committing += new InstallEventHandler
            (NewInstaller_Committing);
        this.Committed += new InstallEventHandler
            (NewInstaller_Committed);
    }

    private void NewInstaller_Committing(object sender,
        InstallEventArgs e)
    {
        // Whatever needs to be done before installation
    }
    private void NewInstaller_Committed(object sender,
        InstallEventArgs e)
    {
        // Whatever needs to be done after installation
    }
    public override void Install(IDictionary savedState)
    {
        base.Install(savedState);
    }
    public override void Commit(IDictionary savedState)
    {
        base.Commit(savedState);
    }
    public override void Rollback(IDictionary savedState)
    {
        base.Rollback(savedState);
    }
    public override void Uninstall(IDictionary savedState)
    {
        base.Uninstall(savedState);
    }
}

Launching a custom installer programmatically

static void Main(string[] args)
{
    IDictionary actions = new Hashtable();
    try
    {
        AssemblyInstaller aInstaller = new AssemblyInstaller
            ("ExampleInstaller.dll", args);
            // or you could use the ComponentInstaller
            // object instead
        aInstaller.UseNewContext = true;
        aInstaller.Install(actions);
        aInstaller.Commit(actions);
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

Uninstalling or Rolling Back an Installation

Replace the Install() method from the previous example with one of the following methods:

aInstaller.Uninstall(actions);

aInstaller.Rollback(actions);

In continuation of the Intro to SharePoint webcasts that I’ve been watching, here are my notes from the second one, which introduces Data Lists.  The entire collection of webcasts can be found here

Speaker:

Robert Bogue

Microsoft MVP for MOSS

Thor Projects LLC

www.thorprojects.com/blog

 

 

SharePoint is a virtual file system, which is stored in a content database. 

 

SHAREPOINT LISTS 

A SharePoint list is essentially a table in Sql Server.  They can have their own form pages and multiple SharePoint views (with grouping, etc).  They are created from templates (Example: Creating a list of type “Contacts”), which can then be modified.  Lists can contain one or more Content Types, which are a way to encapsulate the metadata and processes about something.  (Content Types are one or the most powerful tools in SharePoint).  Lists can have attachments. 

 

DOCUMENT LIBRARIES

A document library is a special type of list, that has one and only one attachment all the time.

 

PROGRAMMING WITH LISTS

The Object model is located in namespace Microsoft.SharePoint.dll (there are several more subsets).  You can access the OM from any server in the farm (the Web front-end or the application server).  The OM can only touch other sites and apps in the same web farm.

 

SERVER AND SITE ARCHITECTURE

  1. Top level object: SP Farm – lets you know what servers are in the farm, what web apps are being hosted by the farm
  2. SPServer: Web front-end, index server, etc
  3. SPWebApplication: Usually you have web application on multiple servers, or you can have more than one web app on each server
  4. SPSite: Site collections, a boundary for backup, queries.  This is an important object.  This is normally the highest level you go to during development
  5. SPWeb: A collection of these are in the SPSite.  In these, you have a List property (used to access Lists and Document libraries)
  6. SPList/SPDocumentLibarary
  7. SPListItem and SPField

CREATING LIST ITEMS

Use the SPListItem object.  Be sure to use internal names (SharePoint gives an internal name when it is first created.  It is the name of the field minus any special characters.)

 

IMPORTING DATA

There is a generally accepted rule (soft rule) of including up to 2000 rows to comfortably keep performance up.  However, in one of Rob’s examples, he uploads 18,000 records, which SharePoint can handle, usually under 3 minutes.

 

RETRIEVING LIST ITEMS

Use SPListItemCollection/SPListItem.  There are three main ways to handle this:

  • Loop over all objects in SPList.Items collection
  • Use databinding with GetDataTable method
  • Execute a query against the list (in CAML-Collaborative Application Markup Language)

QUERYING DATA IN CAML

CAML queries can be executed against one or more list instances.  When executing a CAML query, use either SPQuery, SPSiteDataQuery, or Lists.asmx.  There are some tools out there that help you build CAML queries

 

WORKING WITH DOCUMENTS

There are a few things that a document library can do that a List cannot:

  • SPFile.CopyTo – makes a copy of the document in another document library in the same site
  • SPFolder.Files.Add – adds a document
  • SPFile.MoveTo – moves document, metadata, and versions from one document library to another

SUMMARY

Microsoft.SharePoint.dll is a powerful API for creating and managing the containers and all of its content.
Possible hosts for your code are WinForms apps running on the machine of SharePoint products and technologies, and SharePoint solution components like Web Parts, application, and site pages.

Follow

Get every new post delivered to your Inbox.