Adobe Illustrator to XAML Export

 

 

 

What is the XAMLExport plug-in?

If you use Adobe Illustrator and would like to get your artwork into a WPF or Silverlight application using XAML, you need to use XAMLExport plug-in which works with both the PC and the Mac.
While the plug-in is capable of exporting very complex illustrations, in practice, it is mostly used to convert individual icons or user interface elements. Once assets have been exported from Illustrator, they can be used in a tool like Expression Blend to build a finished application.
The PC version of the plug-in requires Adobe Illustrator CS, CS2, CS3, or CS4. Once you have a compatible version of Illustrator installed:
Download XAMLExport_0.19_PC.zip from the following link: XAML Export  then Copy XAMLExport.aip from the zip file to your Illustrator plug-in folder. For a default installation of Adobe Illustrator CS4, this should be something like C:\Program Files\Adobe\Adobe Illustrator CS4\Plug-ins.
The next time you start Illustrator, you should be able to pull down the File menu, select Export…, and see both XAML for Silverlight (*.XAML) and XAML for WPF (*.XAML) as available selections under Save as type. There are no other options to configure or runtimes to install.

Compare Floating Point Numbers in C#

Can Floating Point Numbers be Compared to Each Other Precisely in C#?

Floating point numbers have limited precision. This can lead to small approximation errors in calculations which, in turn, can cause unexpected results when comparing calculation results. For example, consider the following C# code, which multiples a number by its multiplicative inverse and then compares the calculated result with the expected result of one.

double a = 99.0;

double b = 1 / a;

double calculatedResult = a * b;

double expectedResult = 1.0;

bool areSame =  calculatedResult == expectedResult;

We would expect areSame to be true, because the product of a number and its multiplicative inverse should always equal one.  However, areSame will be false in the above code. The problem is that 1/99 cannot be represented exactly using the double data type. This introduces a small approximation error in y which in turn introduces a small approximation error in calculatedResult. This example demonstrates why it is unwise to perform an “exactly equals” comparison of floating point numbers.
To allow for small approximation errors in calculations, it is better to perform an “almost equals” comparison of floating point numbers which checks whether the numbers are close to each other. This involves checking whether the difference between the numbers is less than some epsilon.
The problem then becomes choosing an epsilon. Any fixed epsilon would likely be too small when comparing large numbers, or too large when comparing small numbers. Thus, it is desirable to choose a relative epsilon that is relative in magnitude to the numbers being compared. Note that the double data type uses 64 bits, with 1 bit for sign, 11 bits for exponent, and 52 bits for mantissa. If we choose epsilon by dividing one of the numbers by 2^n, a difference of less than epsilon will indicate that the numbers being compared agree about the first n bits of the mantissa. For example, consider an AlmostEqual method that compares the difference of the two numbers to the first number divided by 2^48.

public static bool  AlmostEqual(double a, double  b)
{
    if (a == b)
   {
        return true;
   }
        return Math.Abs(a  - b) < Math.Abs(a) / 281474976710656.0;
}

This method will return true when the two numbers match to about the first 48 bits of the mantissa (i.e., only disagree in about the last 4 bits of the mantissa). Note that the method has code to handle the special case when the two numbers are exactly equal.  We can then rewrite our original code example using the AlmostEqual method in place of the == operator.

bool areSame =  AlmostEqual(calculatedResult, expectedResult);

Now areSame will be true, indicating that caluclatedResult is close enough to expectedResult that any difference could easily be an approximation error due to limitations of the double data type. Note that the above AlmostEqual method is not perfect. Zero will only compare almost equal to zero. Thus, the above AlmostEqual method doesn’t account for approximation errors when one of the numbers being compared is zero.

Wiring Up Events with Lambda Expressions in C#

Lambda expressions can be used to tie event handling code to an event. Lambda expressions assume implicit data typing which means you do not have to figure out the data type of the event’s e parameter—the compiler will do it for you.

Example 1. Adding event handler using lambda expression:

public Form1()

{

InitializeComponent();

// Use a lambda expression to define an event handler.

this.Click += (s,e) => { MessageBox.Show(((MouseEventArgs)e).Location.ToString());};

}

Example 2.

this.Load += (s, ev) =>

HtmlMeta hma = new HtmlMeta();

hma.Name = “viewport”;

hma.Content = “width=device-width”;

this.Header.Controls.Add(hma);

};

Example 3. Handling the AfterExpand method of a WinForms TreeView in C# 2.0:

treeView.AfterExpand += new TreeViewEventHandler(

delegate(object o, TreeViewEventArgs t)

{

t.Node.ImageIndex = (int)FolderIconEnum.open;

t.Node.SelectedImageIndex = (int)FolderIconEnum.open;

}

);

Using Lambdas to make the code clean and easy to read:

treeView.AfterExpand += (o, t) =>

{

t.Node.ImageIndex = (int) FolderIconEnum.open;

t.Node.SelectedImageIndex = (int) FolderIconEnum.open;

};

WP User Interface Design by ComponentOne Controls

What is included in ComponentOne Studio for Windows Phone development?

ComponentOne Studio for Windows Phone includes over 20 UI controls for data visualization, rich text editing, data input, PDF viewing, layout and more. Designed to enhance the rich user experience of the Windows Phone 7.

 

 

Why Choose ComponentOne Studio for Windows Phone?

1- Consistent Metro UI Design

Studio for Windows Phone supports the Metro UI design and interaction guidelines specified by Microsoft. By default, each control supports a Metro look and automatically inherits the dark or light theme set by the user. Be confident that your apps will look consistent on your users’ phones.

2- Stunning Data Visualization

Your charting apps are just a few clicks away with Chart for Windows Phone offering over 30 chart types, user interaction, and a wide range of color palettes. Gauges for Windows Phone, with a variety of designs and shapes, give you dashboard-style visualization perfect for the mobile platform. If you need to visualize your data geographically, Maps for Windows Phone does the job.

3- Edit Tabular Data

Only with the legendary FlexGrid for Windows Phone can you get tabular data editing on the Windows Phone. Display data records across columns and down rows with this simple, yet powerful grid control. Plus, unlock advanced features such as sorting, cell merging, and even editing with a platform-specific UI.

4- Gesture Support

Touch gestures for zooming, panning, scrolling, and selection are included with Studio for Windows Phone. Touch gesture support ensures that you deliver compelling, interactive applications to your end users.

5- ClearStyle Technology for XAML Styling

ClearStyle Technology is our new paradigm to XAML control styling. ClearStyle allows developers to easily change control colors without having to modify control templates. By just setting a few brush properties in Visual Studio 2010 you can quickly give a unique look to the control without having to work in Expression Blend or hire a professional designer.

6- XAML or Code

Customize the controls in your preferred method: XAML, C# or VB.NET code-behind, or both. Studio for Windows Phone controls support complete XAML markup for most features and dependency properties for data-binding in MVVM (Model-View-ViewModel) designed applications.

Async CTP and Performance

Asynchify or Synchify?

Asynchronous methods are a powerful productivity tool, enabling you to write scalable and responsive libraries and applications. It should be considered that asynchronicity is not a performance optimization for an individual operation. Taking a synchronous operation and making it asynchronous will invariably degrade the performance of that one operation, as it still needs to accomplish everything that the synchronous operation did, but now with additional constraints and considerations.

How the Overall System Performs when Everything is Written Asynchronously?

The performance of your application will be increased by using asynchronicity in the aggregate because you can overlap I/O and achieve better system utilization by consuming valuable resources only when they are actually needed for execution.

Async CTP Optimization

The asynchronous method implementation provided by the .NET Framework is well-optimized, and often ends up providing as good or better performance than well-written asynchronous implementations using existing patterns and volumes more code. Any time you are planning to develop asynchronous code in the .NET Framework from now on, asynchronous methods should be your tool of choice. Still, it’s good for you as a developer to be aware of everything the Framework is doing on your behalf in these asynchronous methods, so you can ensure the end result is as good as it can possibly be.

CodeRush

DevExpress announced at the BUILD Windows Conference in Anaheim that its award-winning IDE Productivity and Refactoring Toolset “CodeRush” now supports Visual Studio 11. CodeRush helps developers create and maintain source code with extreme efficiency. Consume-first declaration, powerful templates, smart selection tools, intelligent code analysis, innovative navigation and an unrivalled collection of refactorings all work together to dramatically increase developer productivity.

1. Color Swatches in the Code
See the actual color of color references in the code. Change the color using CodeRush’s first class color picker. C#, VB, XAML, HTML and CSS are supported. 2. Preview Hinting
Preview Hinting shows that code that’s going to change so you can see the impact of a refactoring before you apply it.
3. Test Result Icons
CodeRush places test result icons next to each test method, so you can not only see the results of the last test run, but also quickly run the test after making changes.
4. Code Issues
CodeRush shows errors, warnings, hints, code smells, and duplicate code while you work. Fixes for many issues are a single click or keystroke away.
5. Duplicate Detection and Consolidation
Easily see duplicate code throughout your solution while you work. Increase the quality of your source code by consolidating duplicates into a single location.
6. Multi-Select
Select what you need from multiple locations and copy or cut that to the Clipboard.
7. Warp Speed
Navigate to the symbol, class or file you want with the fewest keystrokes. Efficiency is everywhere in CodeRush.

Copyright © All Rights Reserved - C# Learners