miercuri, 21 decembrie 2011

Microsoft Sketchflow


Microsoft Sketchflow

  • Microsoft SketchFlow is a UI mockup feature that ships with Expression Blend
  • It lets you quickly design a mockup of the user interface and add some minimal interaction between the sketches.
  • The users can interact with them, adding notes and drawings to capture feedback

luni, 12 decembrie 2011

WPF: Hardware vs. Software Acceleration


WPF: Hardware vs. Software Acceleration





WPF

  • It uses hardware optimizations where possible, but it has a software fallback for everything
  • WPF offers some sort of hardware acceleration to all WDDM drivers and to XPDM drivers that were created after November 2004
  • When WPF infrastructure first starts up, it evaluates your video card and assigns it a rating from 0 to 2
    • RenderCapability.Tier property: provides level of hardware acceleration that’s available in the client
      • in System.Windows.Media namespace
      • int renderingTier = (RenderCapability.Tier >> 16);
  • The goal of WPF is to off-load as much of the work as possible on the video card so that complex graphics routines are render-bound (limited by the GPU) rather than  processor-bound (limited by your computer’s CPU).
  • WPF recognizes three rendering tiers (<WPF 4):
    • Rendering Tier 0. The video card will not provide any hardware acceleration. This corresponds to a DirectX version level of less than 7.0.
    • Rendering Tier 1. The video card can provide partial hardware acceleration. This corresponds to a DirectX version level greater than 7.0 but less than 9.0.
    • Rendering Tier 2. All features that can be hardware accelerated will be. This corresponds to a DirectX version level greater than or equal to 9.0.
    • Starting in the .NET Framework 4, rendering tier 1 has been redefined to only include graphics hardware that supports DirectX 9.0 or greater. Graphics hardware that supports DirectX 7 or 8 is now defined as rendering tier 0.
  • Factors:
    • The amount of RAM on the video card
    • Support for pixel shaders (built-in routines that calculate per-pixel effects such as transparency)
    • Support for vertex shaders (built-in routines that calculate values at the vertexes of a triangle, such as the shading of a 3-D object).
    • Multitexture Support:  Multitexture support refers to the ability to apply two or more distinct textures during a blending operation on a 3D graphics object




FeatureTier 1Tier 2
DirectX versionMust be greater than or equal to 9.0.Must be greater than or equal to 9.0.
Video RAMMust be greater than or equal to 60MB.Must be greater than or equal to 120MB.
Pixel shaderVersion level must greater than or equal to 2.0.Version level must greater than or equal to 2.0.
Vertex shaderNo requirement.Version level must greater than or equal to 2.0.
Multitexture unitsNo requirement.Number of units must greater than or equal to 4.



Graphics Rendering Registry Settings

WPF provides four registry settings for controlling WPF rendering:

SettingDescription
Disable Hardware Acceleration OptionSpecifies whether hardware acceleration should be enabled.
Maximum Multisample ValueSpecifies the degree of multisampling for antialiasing 3-D content.
Required Video Driver Date SettingSpecifies whether the system disables hardware acceleration for drivers released before November 2004.
Use Reference Rasterizer OptionSpecifies whether WPF should use the reference rasterizer.


Guidelines for troubleshooting graphic issues in WPF applications

  • http://support.microsoft.com/kb/963021
  • Graphic issues in WPF applications can include any of the following symptoms:
    • A WPF window that fails to refresh.
    • A WPF window that contains distorted and corrupted visuals.
    • On Windows Vista, the screen flickers.
    • On Windows XP, a blue screen crash sometimes occurs.
    • The occurrence of a Timeout Detection and Recovery (TDR).
  • Steps to resolve graphic issues in WPF applications
    • The first step is to install the most recent version of the .NET Framework.
    • The next step is to obtain and install the most recent drivers for your graphics card.
    • If the issue persists, try launching your application on another computer with a different model/brand of graphics card and the most up-to-date drivers. This will indicate whether the issue is due to bugs in the display drivers. Occasionally, the most recent display drivers may not contain a fix for graphic issues.
    • If updating the display driver does not resolve the issue, and if you do not have a second computer to debug the issue, try disabling hardware acceleration and forcing your WPF application to use software rendering.
    • If the issue is resolved by using software rendering and it is not possible for you to upgrade the physical graphics card or its drivers, then it is recommended that you disable hardware acceleration and force your WPF application to use software rendering as a workaround for your application.
    • If none of the previous steps resolves the issue, then send the DirectX Diagnostics log from your computer to Microsoft so that it can be further analyzed.


References

http://msdn.microsoft.com/en-us/library/ms742196(VS.100).aspx
http://msdn.microsoft.com/en-us/library/aa970912.aspx
http://support.microsoft.com/kb/963021
Matthew MacDonald, Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4.0

How to Get a Performance Counter in C#?


How to Get a Performance Counter in C#?

namespace PerformanceCounters
{
    class Program
    {
        static void Main(string[] args)
        {
            Timer _timer = new Timer(OnTick, null, 0, 2000);
            Console.ReadLine();
        }

        public static TimeSpan UpTime
        {
            get
            {
                using (var uptime = new PerformanceCounter("System", "System Up Time"))
                {
                    //Call this an extra time before reading its value
                    uptime.NextValue();
                    return TimeSpan.FromSeconds(uptime.NextValue());
                }
            }
        }

        private static void OnTick(object i_state)
        {
            Console.WriteLine("System Uptime:\t" + UpTime);
        }
    }
}


joi, 3 februarie 2011

Internal Training

Internal Training 


Type of internal training

Peer Training1

  • Short session
  • Small groups (1-3 persons)
  • A piece of technology (language feature, code owner, pattern, good/bad practice) people are using
  • Presented by people that alike some things / work a lot with / find a hobby in a new technology
  • Impromptu training session around a computer / scheduled training over an agreed period
  • For new personal it may be a must


Presentations2

  • Larger groups
  • It is voluntary
  • Those that present have some knowledge -> spread throughout the organization
  • A way to help people improve their presentation skills (people are becoming more confident, better demos, better preparation)
  • Problems and challenges that participants encounter every day at work



Buddy System3

  • Set up for new employees
  • Should be structures (new employee): New Hire/ Transfer document
  • Use templates


Documentation4

  • Document the code / update the FS / DS / dev tests / documentation
  • "How-To" documents


Wikis5 

  • It is about sharing the information / knowledge exchange
  • Share-point / forums
  • Easy way to search on the web


Demonstration

  • Excellent way of training employees who are required to learn practical skills
  • Not only demo of how it is working a feature, but only some demos of how that feature has been done


Video registration


Steps for a training session

  • Set the aims and objectives of the intended training. 
    • who presents the training,
    • how the training is presented, and
    • participants
    • the role you expect from participants.
  • Produce a training/lesson plan
  • Break the identified training into ‘Bite Sized Chunks’ and tie in with the lesson plan. 
  • Prepare yourself - Know your subject
  • Check understanding
  • Gather feedback
    • Gather information about the course from the trainees. Find out as much as possible on:
      • the content and material. 
      • the presentation and delivery of the trainer. 
      • was the course/training too long/short. 
      • did they feel that the aims and objectives of the course had been me



Advantages


  • Empower people
  • People are more responsible
  • New, higher level responsibilities
  • Provide more opportunity to establish goals, priorities, and measurements.
  • Improve presentation skills
  • Consolidate organization's culture
  • Spread out at the company level good practices / processes / procedures
  • The programme, training content, workshops, exercises and methodology can be adapted to suit the specific needs of your company


Managers


  • Provide information about new features / enhancement 
  • Link new feature with the need of new trainings
  • Provide books for the trainer
  • Schedule time for learning / preparation / training

How should work

  • Questionnaires with:
    • area of interest
    • area in which that person is confident to provide a training
    • type of the required training
  • Search for volunteers 

Ideas

  • Move all documents on the web (Google docs)
  • Find a mentor, friend or colleague who will talk it through with you


Plan

  • Elect forms of training that we want to develop
  • Managers tasks (Managers__37753850733861327)
  • Presentation:
    • Publish a spreadsheet in public location (P4/ Google Docs) where to let the people complete the questionnaire
    • Elect trainings / trainer for each one
    • Let people choose training that they want to participate
    • Train-the-trainer6
    • Develop training course7
Schedule time

    • Provide feedback
  • Web documentation
    • Find right place to publish the documents
    • ...

References





Modal Dialogs

Model-View-ViewModel (MVVM)

WPF: How to set the parent control of a modal window?

WPF: How to set the parent control of a modal window?

Use the Owner  property of the Window class.

Sample:

ParentWindow _parentWindow;
...
ViewSetManagerWin _viewSetManagerCtrl = new ViewSetManagerWin();

viewSetManagerCtrl.Owner = _parentWindow;
 _viewSetManagerCtrl.ShowDialog();