Root, Software, UI

WikiSearch – a quick and dirty Windows 8 Metro App

I’ve been playing around with Windows 8 Metro development the last months and one day I did a quick Wikipedia App that integrates into the Search. The first version took me – no joke – less than 20 minutes, cause it’s just so easy!

All you have to do to integrate into the search is to add this method to your App.xaml.cs:

protected override void OnSearchActivated(SearchActivatedEventArgs args)
        {
            base.OnSearchActivated(args);
            if (mainPage == null) mainPage = new MainPage();
            Window.Current.Content = mainPage;
            mainPage.OpenWiki(args.QueryText);
            Window.Current.Activate();
        }

After that go into Package.appxmanifest, switch to the Declarations tab and add a ‘Search’ declaration.
mainPage.OpenWiki() would be a method that composes a Wikipedia-Search-URL from the queryText and tells a WebView to navigate to it. (webView.Source = new Uri(“http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=” + “queryString”);)
I won’t go into any more detail at this point, but that is all the magic you have to do.
Today I added multiple-language support to the App and did some minor improvements. I you like you can download the zip package of it and use it youself. To install it run ‘Add-AppxDevPackage.bat’ with administrator privileges (note: you machine has to be development-enabled).

Have fun and tell me what you think^!

Leave a Reply

Your email address will not be published. Required fields are marked *