DCSIMG
C# - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

Browse by Tags

A UniformGrid for Silverlight/Windows Phone
07 February 12 10:00 PM | pavely | with no comments
The UniformGrid panel in WPF has some useful features, especially as an items panel in an ItemsControl . I blogged about the usefulness of the UniformGrid here . But what about Silverlight? It has no UniformGrid , but we can create one as a custom panel. This would be usable in Silverlight for the desktop and for Windows Phone, and would be a simple enough example to show in one post. The layout process In WPF/Silverlight, layout is a two step process. The first step is Measure: the panel asks each...
WPF Tip: Displaying Images in different Pixel formats
30 January 12 12:25 AM | pavely | 1 comment(s)
If we want to show an image in WPF, we typically use an Image element and connect its Source property to some image resource within our project: < Image Source ="Penguins.jpg" /> The Source property is not a string, it’s an ImageSource – an abstract type with several concrete implementations that provide a “real” image source. The above markup works thanks to the help of a type converter, that makes the source a BitmapImage – one of the simplest sources, that presents the image as...
From Enumerable to Observable
18 January 12 12:56 PM | pavely | with no comments
The IEnumerable<T> interface represents a collection of objects of type T, and is used heavily thanks to the C# foreach construct. Better yet, in the LINQ world, this is the interface that is “extended” via extension methods by the System.Linq.Enumerable class. This makes IEnumerable<T> both easy to use as well as powerful. But is it the best interface for getting data out of a possible collection? Recap: what is IEnumerable<T> ? IEnumerable<T> has only one method: GetEnumerator...
Calculating PI in .NET
30 December 11 10:31 PM | pavely | 2 comment(s)
I always loved mathematics. Although I’m certainly not a mathematician by profession, I’m always intrigued and inspired by math’s pureness and cleverness. One of the simplest and fascinating aspects of math is the number PI . Described simply as the ratio of a circle’s circumference to its diameter, it’s a constant with infinite digits after the decimal point and most importantly, non repeating (at least as far as I know). There are many ways to calculate PI, as evident within the PI Wikipedia link...
Parallel Programming Open House Session
01 December 11 05:34 PM | pavely | with no comments
Today I presented a half-day session on Multithreading & Parallel Programming at John Bryce center in Tel Aviv. Thank you all for attending! I certainly enjoyed presenting these fascinating topics. I’ve attached the demos I showed. The presentation will be sent to those who attended by email. Thank you! ParallelDemos
My C# 5.0 Async Session at Microsoft
22 November 11 03:36 PM | pavely | with no comments
Today I presented a session on C# 5.0 asynchronous programming. Thank you all for coming, it was a pleasure to present this interesting stuff. The presentation and demos are attached to this post. The NetFlix and RSS aggregator demos are part of the Async CTP installation. Any questions or comments are very welcome! OpenHouseAsyncProgC#5.NET4.5.zip OpenHouseAsyncProgC#5.NET4.5.zip
Mandelbrot Set with C# 5.0 Async support
21 November 11 07:09 PM | pavely | 1 comment(s)
I’ve always been fascinated by the Mandelbrot set . It’s an intriguing set, and the fractals created are truly mind boggling. (for more information on the Mandelbrot, and other such sets, you can start with the above Wikipedia link). As part of my preparation for tomorrow’s session on C# 5.0 asynchronous programming, I’ve decided to create a WPF application to view and explore the Mandelbrot set, while taking advantage of those new asynchronous features. This turned out to be rather fun. Here’s the...
The Future of Silverlight
14 November 11 06:33 PM | pavely | with no comments
There’s been a lot of talk lately about Silverlight. Will Silverlight 5 (to be released this month) be the last major version of Silverlight? I don’t know, but here are my thoughts on the subject. Silverlight will stay in the context of Windows Phone, that’s seems pretty sure, but what about the web at large? Is Silverlight (and its rival, Adobe Flash) doomed? In recent years, there has been gravitation towards standards – that is, world wide standards, not Microsoft’s or anyone else’s for that matter...
Event: Asynchronous Programming with C# 5.0 & .NET 4.5
31 October 11 09:35 AM | pavely | 1 comment(s)
On November 22nd, I’ll be presenting a half-day session on asynchronous programming with C# 5.0 and .NET 4.5. If C# is your thing, this should be interesting. All details and registration is in this link: http://isrmsdn-async-nov11.eventbrite.com/
תגים:, , , ,
Windows Phone: Combining Silverlight & XNA in a Single Page
26 October 11 09:30 PM | pavely | with no comments
There are two very distinct ways to program on Windows Phone 7.x: Silverlight & XNA. Silverlight is about UI, retained graphics and is event driven. XNA is about immediate mode graphics, based on a timer and polling; Very different models indeed. Each has its strengths and weaknesses. One of the new features in WP7.1 (“mango”) is the ability to combine the two to get the best of both worlds. Here’s a typical scenario where this need may come up: suppose you’re developing an XNA game (2D or 3D...
The Roslyn Project CTP is Available for Download
19 October 11 11:54 PM | pavely | with no comments
The so called “Roslyn” project from Microsoft has been finally released with this early CTP. What is “Roslyn”? It’s an attempt to make the internals of a C# or VB compiler exposed. The usual way we think about a compiler is as a black box – some input goes in – some output comes out. During the compilation process, the compiler builds various tables and gathers a lot of information on the input. After the output is generated, the compiler throws everything away. That’s really too bad. In today’s...
WPF 4.5 New Feature: Live Shaping
02 October 11 08:39 PM | pavely | 1 comment(s)
The BUILD conference concentrated on the new Windows Runtime (WinRT) component of Windows 8, but .NET 4.5 was also introduced, providing enhancements and new features. WPF & Silverlight seemed to have suffered a blow (some would say a knockout), as the new Windows 8 “Metro” model is not built on the same types, but rather wraps new native C++/COM libraries (that’s WinRT for you). Still, line of business applications will not be “Metro” anytime soon, so I think saying goodbye to WPF is premature...
תגים:, , , ,
Dynamic Live Tiles in Windows Phone 7
30 September 11 03:22 AM | pavely | 1 comment(s)
One of the attractive features of Windows Phone 7 is the tiles in the start menu. It’s pretty easy to point the main application tile (and secondary tiles) to static URLs. It’s a bit more difficult to create a dynamic image for a live tile. Starting with tiles The easiest way to start is by tweaking the WM Manifest.xml file (or even easier, but less flexible) the Project Properties Application Tab: The title appears as text under the background image. Ideally, the image should be 173x173 pixels in...
תגים:, , ,
Encapsulation & Exposure
26 September 11 10:55 PM | pavely | 2 comment(s)
I like to keep a tight leash on my classes. No unnecessary exposure. Consider the following simple class: class PersonnelManager {     List < Person > _people = new List < Person >();     public void Add ( Person person ) {         // do some validation         _people . Add ( person );         // maybe some extras     } } I want to expose...
תגים:, ,
Porting an XNA game from Windows to Windows Phone (Part 2)
14 August 11 03:40 PM | pavely | 1 comment(s)
In the first part we got our introduction screen up and running, with the starfield scrolling by. However, we couldn’t actually start playing because the game was waiting for a key press… which is nowhere to be found on a Windows Phone device. We simply need a little touch. Adding Touch Support Touch is something the XNA version of Windows and XBOX 360 have no notion of. This is specific for Windows Phone. Touch input information is available as “raw” data (touch points, with positions, etc.) and...
More Posts Next page »