Development With A Dot

Blog on development in general, and specifically on .NET

Sponsors

News

My Friends

My Links

Permanent Posts

Portuguese Communities

November 2012 - Posts

Win a Free Copy of Windows Presentation Foundation 4.5 Cookbook

Win A free copy of the 'Windows Presentation Foundation 4.5 Cookbook', just by commenting!

For the contest, Packt Publishing has two eBook copies of Windows Presentation Foundation 4.5 Cookbookto be given away to two lucky winners.

How you can win:

To win your copy of this book, all you need to do is come up with a comment below highlighting the reason "why you would like to win this book”.

Duration of the contest & selection of winners:

The contest is valid for 14 days (until December 3), and is open to everyone. Winners will be selected on the basis of their comment posted.

clip_image002

Windows Presentation Foundation 4.5 Cookbookis written by Pavel Yosifovich, the CTO of CodeValue (http://www.codevalue.net), a software development, consulting, and training company, based in Israel.

This book is written in an easy-to-read style, with a strong emphasis on real-world, practical examples. Step-by-step explanations are provided for performing important tasks. This book is the best guide for C# developer who is looking forward to increase understanding and knowledge of WPF.

Using this book, readers will learn to build complex and flexible user interfaces using XAML, perform lengthy operations asynchronously while keeping the UI responsive, get well-versed with WPF features such as data binding, layout, resources, templates, and styles and also customize a control’s template to alter appearance but preserve behavior.

In the next days I will post my review on this book. In the meantime, here’s the table of contents:

Preface
Chapter 1: Foundations
Chapter 2: Resources
Chapter 3: Layout and Panels
Chapter 4: Using Standard Controls
Chapter 5: Application and Windows
Chapter 6: Data Binding
Chapter 7: Commands and MVVM
Chapter 8: Styles, Triggers, and Control Templates
Chapter 9: Graphics and Animation
Chapter 10: Custom Elements
Chapter 11: Threading
Index

I’m waiting for your comments! Winking smile

Adding Suggestions to the SharePoint 2010 Search Programatically

There are numerous pages that show how to do this with PowerShell, but I found none on how to do it with plain old C#, so here it goes!

To abbreviate, I wanted to have SharePoint suggest the site collection user’s names after the first letters are filled in a search site’s search box. Here’s how I did it:

   1: //get the Search Service Application (replace with your own name)
   2: SearchServiceApplication searchApp = farm.Services.GetValue<SearchQueryAndSiteSettingsService>().Applications.GetValue<SearchServiceApplication>("Search Service Application") as SearchServiceApplication;
   3:   
   4: Ranking ranking = new Ranking(searchApp);
   5:  
   6: //replace EN-US with your language of choice
   7: LanguageResourcePhraseList suggestions = ranking.LanguageResources["EN-US"].QuerySuggestionsAlwaysSuggestList;
   8:  
   9: foreach (SPUser user in rootWeb.Users)
  10: {
  11:     suggestions.AddPhrase(user.Name, String.Empty);
  12: }
  13:  
  14: //get the job that processes suggestions and run it 
  15: SPJobDefinition job = SPFarm.Local.Services.OfType<SearchService>().SelectMany(x => x.JobDefinitions).Where(x => x.Name == "Prepare query suggestions").Single();
  16: job.RunNow();

You may do this, for example, on a feature. Of course, feel free to change users for something else, all suggestions are treated as pure text.

More Posts