Friday, January 25, 2008
IList is not serializable in combination with XmlSerializer
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105767
Friday, January 4, 2008
Implementing a custom Dispose for a form or usercontrol
Mark Seemann wrote an intersting approach for dealing with this situation in his blog. It makes use of an Disposer component. A new instance will be created with a reference to a method implementing the custom dispose functionality. This instance is being added to the components collection. When the components get disposed, the this Disposer calls the delegate function with custom dispose logic. That's it.
Thanks Mark for this article.
Wednesday, August 15, 2007
Error: Validation of viewstate MAC failed. in ASP.NET page
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that
same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
This error may occur when one hosts an ASP.NET webpage on a web-garden.
Simple solution (for ASP.NET 2.0 and up): Generate a new machinekey and add it to the web.config.
Full explanation can be found in the blog of Jody.
Friday, June 8, 2007
Programmatic databinding between classes and controls
myLabel.DataBindings.Add("Text", myObject, "Name");
However there are some specific controls that have trouble using databinding. Some should use another property, like Value or SelectedItem, while others need a specific
DataSourceUpdateMode. From my experience here's a list of controls and possible databindings:
- Label
myLabel.DataBindings.Add("Text", myObject, "Name"); - TextBox
myLabel.DataBindings.Add("Text", myObject, "Name"); - NumericUpDown
myNumericUpDown.DataBindings.Add("Text", myObject, "Age"); - ComboBox
mycomboBox.DataBindings.Add("SelectedItem", myObject, "Option", false, DataSourceUpdateMode.OnPropertyChanged);
Wednesday, May 16, 2007
Help not always on top!
Create a new Form (once for an application). Call CreateControl() on it in order to create a handle to it, but it will not show up. See the following code-example:
public class MyApp
{
// Create a form as the parent for the Help window.
private Form m_HelpFormParent = new Form();
public MyApp()
{
// Enforce creation of a handle to the form
m_HelpFormParent.CreateControl();
}
public ShowHelp(string url, HelpNavigator command, object parameter)
{
// Call ShowHelp with the form created for this purpose as parent
Help.ShowHelp(HelpFormParent, url , command , parameter );
}
}
Sunday, April 22, 2007
Issue tracking with Gemini
After some searching on the internet I found Gemini (2.0.5 at the time), whose features look very attracting. Among the latetst version (2.1.1.) the following feature are available:
- ASP.NET (2.0) web application running on IIS (v5, v6 or v7)
- SQL Server database back-end (SQL Server 7, 2000, 2005 or MSDE)
- Time-tracking (when you really want to ...)
- Source control integration (Visual SourceSafe works perfectly, CVSNT integration and SubVersion adapter are available also)
- Configurable email alert templates
- Custom fields support (i.e. define additional fields for issues)
- Personal issue filters (create your own view on the issue list trough a filter and save it the filter for later usage)
- Gemini API – event/listener model (create your own extensions, we did not need them!)
- Automatic project road map and change logs
- Customisable issue type and priority (we extended the default types with ToBeTested)
- Controlled anonymous user access
- Flexible reporting – based upon XML/XSL
- Export to Microsoft Excel
- Issue linking across projects
- Unicode support
- Windows and web forms authentication (no need to log in when used on intranet)
One of the best things I liked was the ability to test with the free version for a reasonble amount of time (like forever) with a only few limitations. In the meanwhile our team has grown over the 10 user limit restriction and we have bought the product since it serves it's purpose very well. And that for only € 440, which gives you the abaility to use Gemini with unlimited users and on an internet-facing server!
These features combined with the financial aspect, convinced me to give it a try. Therefore I grabbed an old machine with a clean Windows XP installation. The machine specifications where not typically high end, with it's Intel Pentium III running at 800 MHz and 512 MB of RAM. Only installing takes a lot of time, but using the Gemini application has no noticable delays running on this hardware!
How to get up and running with Gemini on this machine (quickly may not be the right word, since 800 MHz is not lightning fast ...):
- Install Windows XP, including IIS and with all the latest SP's and windows updates
- Install Microsoft .NET Framework 2.0
- Install SQL Server 2005 Express edition
- Create a dedicated user account for Gemini which is allowed access to Gemini database within SQL Server.
- Install Gemini
- Adjust the web.config for customizing the following settings:
- Database connection string
- SMTP configuration
- Set the Gemini URL, needed for emails being sent so that they implement the correct URL.
- Set the DateFormat to EU
- Set the authentication mode to Windows (instead of Forms) when using on an intranet.
- Optional registration information
Additional (optional) steps:
- In case you want to create the database and tables yourself, this is possible. See the documentation.Run IIS lockdown tool
- Enable port 80 (HTTP WebServer) within the windows firewall.
WSE to be installed on your web server in order to operate.
Last thing that I should really mention is the Gemini ScreenCapture application. This application allows a tester to quickly take a screenshot of the screen/window/user defined region and attach it to an existing issue. Before submitting it, the tester can something on the screenshot annotate with a pencil. This is really a cool feature that our testes use a lot.
Sunday, April 1, 2007
VSLive, Day 5, All about WPF
WPF is officially released. The tooling however to create i.e. XAML pages is in a very early state. The tools available at the time of writing can be found at the bottom of this page under resources. Therefore the amount of time it needs to write a WPF enabled application takes roughly 3 times longer than it should take, because of minimal tooling support. However it can still make sense to develop a WPF application, i.e. when the requirements of the app can be far more easily covered by an application using WPF.
Why is WPF such a revolution in UI design? The last transistion of the UI was 20 year ago. Every UI up until now was based upon GDI, invented in 1984. WPF is build on top of DirectX, which is capable of using all the power of graphic cards that are available to those stunning games also.
Furtermore it is vector based, making it possible to zoom without loss of detail.
In an attempt to fill in the gap between the rich UI experience on with Windows Forms on the web, a subset of WPF will be created by Microsoft, which is currently known as WPF/e (the e stands for everywhere). Some features are missing, like i.e. 3D. But WPF/e does not require .NET 3.0. It's even platform independent. It therefore supports MAC and Linux also. WPF/e will be introduced before the end of 2007. It will be a serious competitor for the nowadays widely used Flash.
User interfaces can be specified by XAML files (pronounced "Zammel"). XAML is an XML file, that describes the user interface as an hierarchy of (visual) elements. XAML is a big step towards declarative programming- Decalre what you want, not how it happens.
WPF Application Model:
- System.Windows
- Application objects as entry point
- StartingUp, ShuttingDown events
- Run method, MainWindow property, etc. - Visual elements
- Page, Window
Sampleviewer (installed with "Visual Studio 2005 extensions for .NET Framework 3.0", currenlty a CTP) takes you around all the features of WPF one by one.
Differences between WPF and Windows Forms
- No MDI in WPF
- No build-in data grid in
- WPF has "container/control" distinction
- No Controls collection"Visible" > "Visiblity" in WPF
- "Hidden" takes up space
- "Collapsed" doesn't take up space - Absolute position in WPF is the exception, not the rule
- Sizing and positioning are in device independent units (1/96 inch) in WPF
- Scrolling is external to controls
- ScrollViewer element - Non-containers can only hold one element
- Called the controls "content"
- Set with the Content property - Content can be any visual element
- Content can itself be a container
Databinding:
- Create a collection of stuff
- Bind it to the context of the window
- Bind controls to the item properties
- Add navigation, filtering, sorting, and so forth
XAML Based Application (XBAP) are WPF enabled applications which can be used within a browser.
- Act a lot like HTML pages
- Non-installed, served from a web server
- Browser hosted on the client (take over the whole browser surface)
- Run in a security sandbox - Have their own project type under Visual Studio
- Caution - March CTP bug on Vista - Published to Virtual Directory on web server
- "NavigateURI" attributed used on links to navigate pages
- App has read permissions to its original web directory
- Can use IsolatedStorage for caching and state management.
Animation can consist of:
- 2D and 3D Transforms
- ...
Styles can be applied on the fly trough code or to triggers (i.e. hovering a button).
Ink is enabled in WPF (on Windows XP, after installing appropriate libaries).
3D Rendering of surfaces
- Use full 3D capabilities underneath
- Compose surfaces out of triangles
- Triangle is the only primitive
- Created as of MeshGeometry3D - Viewport3D is visual element to render 3D objects on screen in 2D
- Apply camera angle, for example, to this viewport - Exporter for Autodesk 2DS Max is not (yet) official available
Types of events within the tree hierarchy of an WPF application
- Direct (only on element)
- Bubbling (move up the tree)
- Tunneling events (from outside into the tree and down to the elements)
Tools for XAML:
- XamlPad from Microsoft, part of the Windows SDK.
- Expression Blend from Microsoft. Tool for desiging user interface targetted at integrators between developers and professional designer.
- WPF CTP November 2006 from Microsoft.
- WPF/e CTP feb. 2007.
Other resources:
- http://www.wpfwiki.com/
- http://wpfwonderland.wordpress.com/
- http://channel9.msdn.com/wiki/default.aspx/WPF.ApplicationPortfolio, WPF samples in action
- http://robrelyea.com/events/pdc2005/
- http://wpf.netfx3.com
- http://www.airknow.com/
Other blogs:
- Windows Presentation Foundation SDK
- Tim Sneath, Microsoft
- Scott Gu, Microsoft
- Rob Relyea
- Erno de Weerd, Infosupport
Examples of XAML Based Applications:
- British Library, using WPF and thus requires Windows and .NET 3.0 installed at the client PC.