Quick Cards Uri Mapper problem

I'm trying to set up Search Extensibility on my app, but I keep getting an error message "QuickCardUriMapper.MapUri(System.Uri)': not all code paths return a value"
using System;
using System.Windows.Navigation;
using System.Net;
namespace Malaccaguide
public class QuickCardUriMapper : UriMapperBase
private static string TargetPageName = "LocationsPage.xaml";
private string tempUri;
public override Uri MapUri(Uri uri)
tempUri = uri.ToString();
// Parse URI when launched by from a quick card.
if (tempUri.Contains("/SearchExtras"))
// Decode all characters in the URI.
tempUri = HttpUtility.UrlDecode(tempUri);
// Create a new URI for place cards.
if (tempUri.Contains("Bing_Places"))
return GetPlaceCardUri(tempUri);
// Immediately return the URI when it isn’t related to Search extensibility.
return uri;
// Return a parsed Place Card URI.
private Uri GetPlaceCardUri(string uri)
// Extract parameter values from URI.
string PlaceNameValue = GetURIParameterValue("PlaceName=", uri);
string PlaceLatitudeValue = GetURIParameterValue("PlaceLatitude=", uri);
string PlaceLongitudeValue = GetURIParameterValue("PlaceLongitude=", uri);
string PlaceAddressValue = GetURIParameterValue("PlaceAddress=", uri);
string CategoryValue = GetURIParameterValue("Category=", uri);
// Create new URI.
string NewURI = String.Format("/{0}?PlaceName={1}&PlaceLatitude={2}&PlaceLongitude={3}&PlaceAddress={4}&Category={5}",
TargetPageName, PlaceNameValue, PlaceLatitudeValue, PlaceLongitudeValue, PlaceAddressValue, CategoryValue);
return new Uri(NewURI, UriKind.Relative);
// This method extracts the string values that correspond to URI parameters from a quick card.
private string GetURIParameterValue(string parameteridentifier, string uri)
string tempValue = "";
// If the parameter exists in the string, extract the corresponding parameter value.
if (uri.Contains(parameteridentifier))
string subUri;
// Extract the characters that contain and follow the parameter identifier.
subUri = uri.Substring(uri.LastIndexOf(parameteridentifier));
// Remove the parameter identifier from the substring.
subUri = subUri.Replace(parameteridentifier, "");
// Obtain the position of the next parameter in the substring.
int nextParameterPosition = FindNextParameter(subUri);
if (nextParameterPosition < int.MaxValue)
// Remove the characters that contain and follow the next parameter.
tempValue = subUri.Substring(0, nextParameterPosition);
else
// No more parameters follow in the string.
tempValue = subUri;
// Encode the parameter values to help prevent issues in the URI.
tempValue = HttpUtility.UrlEncode(tempValue);
return tempValue;
// Returns the string position of the next URI parameter, if applicable.
private int FindNextParameter(string subUri)
int lowestPosition = int.MaxValue;
int tempPosition;
tempPosition = subUri.IndexOf("&ProductName");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("&Category");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("&PlaceName");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("?PlaceName");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("&PlaceLatitude");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("&PlaceLongitude");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("&PlaceAddress");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
tempPosition = subUri.IndexOf("&MovieName");
if ((tempPosition > -1) && (tempPosition < lowestPosition)) lowestPosition = tempPosition;
return lowestPosition;

Hello,you method MapUri does not return a value in every case:
This is your code:
tempUri = uri.ToString();
// Parse URI when launched by from a quick card.
if (tempUri.Contains("/SearchExtras"))
// Decode all characters in the URI.
tempUri = HttpUtility.UrlDecode(tempUri);
// Create a new URI for place cards.
if (tempUri.Contains("Bing_Places"))
return GetPlaceCardUri(tempUri);
// Immediately return the URI when it isn’t related to Search extensibility.
return uri;
} //END IF
And this is a better way to do it:
tempUri = uri.ToString();
// Parse URI when launched by from a quick card.
if (tempUri.Contains("/SearchExtras"))
// Decode all characters in the URI.
tempUri = HttpUtility.UrlDecode(tempUri);
// Create a new URI for place cards.
if (tempUri.Contains("Bing_Places"))
return GetPlaceCardUri(tempUri);
// Immediately return the URI when it isn’t related to Search extensibility.
return uri;
} //END IF
return null; //Return null or an empty uri when tempUri does not contain "/SearchExtras".
Note: You error is shown because you check for an string ("/SearchExtras") and than you return a value: "return uri". But what is when your string does not contains this string? Right, than the if-cluase will be ignored and the code reaches
its end (after "END IF"). And there it would not return a value.
I hope i was able to help you :)
© 2015 Thomas Roskop
Germany // Deutschland

Similar Messages

  • I just rented a film using my apple TV and was then asked to enter a code - which I haven't been asked for in long time. I have forgotten the code. Any quick solutions to the problem?

    I just rented a film using my apple TV and was then asked to enter a code - which I haven't been asked for in long time. I have forgotten the code. Any quick solutions to the problem?

    Hello anetsa
    It sounds like you have restrictions setup on your Apple TV. If you do not know your passcode to unlock it, then you will need to restore your Apple TV. Check out the articles below for more information about Restrictions as well as restoring your Apple TV.
    Apple TV: Understanding Restrictions (parental controls)
    http://support.apple.com/kb/HT200198
    Apple TV (2nd and 3rd generation): Restoring your Apple TV
    http://support.apple.com/kb/HT4367
    Regards,
    -Norm G.

  • Can´t access my files on Creative Cloud. "Page temporarily unavailable. We will return soon." "We are working quickly to resolve the problem and apologize for the delay. Check back later or visit our website for status updates. In addition, you can get he

    Hello,
    For a few days I have been trying to access my files on Creative Cloud web without success. I´ve got this message only:
    "Page temporarily unavailable. We will return soon."
    "We are working quickly to resolve the problem and apologize for the delay.
    Check back later or visit our website for status updates.
    In addition, you can get help in the forums of the Creative Cloud.
    Thank you for understanding!"
    (I used Google Translate)
    Somebody help?

    You do not need ?&promoid=KRUVP at the end of the url but it should not matter.
    One thing to check is if your hosts file is modified. Open the Command Prompt and type: notepad %systemroot%\system32\drivers\etc\hosts
    This will open a read-only copy of your host file in Notepad. Are there any entries in this file regarding adobe.com?
    The other thing you can do is open the Developer Tools in the Chrome browser. On Windows press Ctrl + Shift to open them. Switch to the Network tab. Reload the page by pressing Ctrl + r. Check for any 4xx or 5xx errors which should be colored red.
    Post screenshots of your results or send me a private forum message with the information.

  • Saving after editing in elements 8 - this is painfully slow, including waiting through the "not responding" message, though after quick editing in organiser saving is very quick - what is the problem?

    saving after editing in elements 8 - this is painfully slow, including waiting through the "not responding" message, though after quick editing in organiser saving is very quick - what is the problem?

    None of my pictures that I uploaded into iPhoto are in my Finder under Pictures.  Should I copy and paste my folders from iPhoto into here, in case something happens to my iPhoto program (in addition to backing them up onto an external hard drive like I already do)?
    No, that's just wasting space.  A back up needs to be on a different disk.
    Your photos are within the iPhoto Library.

  • I'm playing clash of clan game now,why I can't purchase gem?The bank staff told me my credit card is no problem,he ask me contact apple iTunes support.

    I'm playing clash of clan game now,why I can't purchase gem?The bank staff told me my credit card is no problem,he ask me contact apple iTunes support.

    If you are getting a message to contact iTunes Support when you try to buy them then you can do so via this link and ask them for help (we are fellow users here on these forums, we won't know why the message is appearing) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
    If it's a different problem when you try to buy them ... ?

  • Did all the updates that Apple requested in my 64 GB IPOD and the battery continues discharging very quickly. When this problem will be solved, because before these updates were downloading not the battery so quickly. Did we revive the Steve Jobs to resol

    Did all the updates that Apple requested in my 64 GB IPOD and the battery continues discharging very quickly. When this problem will be solved, because before these updates were downloading not the battery so quickly. Did we revive the Steve Jobs to resolve the problem, because each update only worsens the operation. I look forward to a quick, effective and definitive solution. Thank You. Ester

    Did all the updates that Apple requested in my 64 GB IPOD and the battery continues discharging very quickly. When this problem will be solved, because before these updates were downloading not the battery so quickly. Did we revive the Steve Jobs to resolve the problem, because each update only worsens the operation. I look forward to a quick, effective and definitive solution. Thank You. Ester

  • Quick view and preview problems

    After upgrading to Mountain Lion, I've experienced consistent problems with quick view and the preview image on column view. I always browse the Finder in column view, so for instance, if I were to browse through a folder of photos, instead of seeing a thumbnail image in the far right column, there is blank white space. If I resize the window, the thumbnail appears. Also, if I were to hit the space bar for quick view, only a white image will appear. Closing it and reopening it will correct the problem. This happens every time. The problem started when upgrading to OS X 10.8 from 10.6.8, and it persists after the 10.8.1 update. Computer is an early 2009 iMac, 2.93 GHz, GT 120 video card. Anyone seen something similar? I haven't been able to find anyone else with the problem.

    I have the exact same problem and it's frustrating. I thought it was only when I double-clicked an attachment jpeg from Entourage, but it happens with all images from any source.
    I've removed the plist on several occasions too, and it works fine for a while. I can't pin down when it decides to stop working again, but it does after a few image views.
    It's only happened since the Snow Leopard installation. I'm up to date with all Apple updates.

  • Video card or driver problems with an N200, please help!

    I have a lenovo 3000 N200, it is really cool, runs even games quite well, including newer ones.
    But, is it normal to for the display driver program to freeze out in Warcraft 3? It always does that, when accessing the list of maps in the game and after 3-5 mins during an actual game. It sets the resolution down to 640X480 (from 1280X800) and in 16 color. I have to reset it in order to make it work. Also it does the same in Spore - though after having the driver written for Spore installed, ( which I downloaded from lenovo's site ) I haven't encountered that problem so far. Also Second Life shuts down - thankfully it does not freeze the drivers. I understand that the model I have is not meant for gaming but if it can run Warhammer 40k: Soulstorm at meduim graphic settings (on widescreen) without a lagg I can't understand why it wouldn't be able to handle warcraft 3 - that even an ATi m200 express can handle. I mean an X3100 from Intel must be far more powerful. (Said ATi card laggs with older games like Unreal Tournament)
    I have the latest driver - official - and a Win Xp pro Sp2. I always keep my system up to date - save for opsys but so far driver did not need sp3 - and virus clean.
    Please help me? 
    Solved!
    Go to Solution.

    Well, Unreal Tournament 2004 runs flawlessly on max graphics - though simple Unreal Tournament laggs like hell with all possible settings - also, as I said Dawn Of War and it's expansions run well on med graphics. The Suffering Ties That Bind runs also good on highest settings - though there is a bit of degradation compared to my tabletop pc's performance. Disciples 2 ran - of course - well, there were some texture problems with it but Heroes 5 ran quite well even on higher settings (as I mentioned it sometimes blunted down the textures but not always and it ran without a lagg). Alien Versus Predator 2 ran on max graphics, and there was no trouble, save for the aliens' special vision (that white thing that looks as if inverted colors) didn't work - aka was only a black screen - and that the crosshair of the smartgun was only a blank red/green block on the middle of the screen.Oh, and Command & Conquer: Generals Zero Hour works on highest settings without a lagg, along with Quake 3, and Jedi knight : Academy. It even runs Perfect World on high settings and only laggs in bigger towns - but that also might be because of the tremendous bandwidth usage that occurs. Even Red Alert 3 was able to run, but I would only advise that for RA fanatics, on low settings it was playable. Also, C & C: Tiberium Wars runs better than RA 3 , if you like that it is quite playable and worth a try. As you can see I have put it to it's limits to see what it can endure. Unreal Tournament 3 ran, though was gruesomely degraded and then it gave me the blue screen of death; so I quickly uninstalled that. Other than the forementioned program I had no real problems with the card, but the existing problems are a pain in the ... well we all know how bothering it can be when one is unable to play his/her favourite game (that should really run flawlessly).
     Doesn't vista eat up too much of the system resources? A friend of mine was complaining about his n200 that vista is too slow on it and it eats up too much processor/memory.
    Also, still no new on videocard front... Asked around if anyone knows, but I am guessing that maybe even Blizzard - referring to my Warcraft problem - shows more compassion to their forums and users than Lenovo, so I'll ask around there too. 

  • G3 Wallstreet--USB card and printer problem

    I have a G3 Wallstreet edition and have recently been using a USB card to connect to my Brother HL 1440 printer. Everything was fine until yesterday, when the chooser no longer allowed me to select this printer, and therefore wouldn't recognize the printer at all. I am saving up for a new Mac, but this is what I have to work with now and I really need to have the ability to print--any suggestions?
    Thanks.
    G3 Wallstreet   Mac OS 9.2.x  

    Vintage,
    A few quick suggestions and questions...
    - Have you made any changes to the computer since the time you printed?
    - Did you just update to OS 9.2.2? If so, this could be the problem.
    - Have you installed or removed any software?
    - Did you make any changes in the Extensions Manager?
    If you have not done so, restart the computer...this can often correct problems.
    If none of the above applies, have you tried the troubleshooting steps in the printer's manual?

  • Graphics card and CD problems

    Hello,
    I recently partitioned my hard drive into two primary partitions and installed Solaris 9 x86 on one of them.
    The first problem I had was kdmconfig. I have an nVidia GeForce4 graphics card, and it was not listed - only up to geforce3 was listed. I tried that, but the test did not work. I got an error (something about InitScreen and SUNWnvidia). I eventually chose the topmost option (16 colors at 640x480) and that one tested fine, but obviously, its a horrible display. How would I get a Solaris driver for my GeForce4? I believe I would need it on a floppy (or a series of floppies) so that I can choose Add Driver and use the floppies. However, I do not know where to find these drivers.
    Secondly, after it prompted me to insert CD2, it gave me an error saying CD2 could not be read. I burned the CD2 image at 20x (rather than the normal 40x) and it still gave me this error. How do I get past it?
    Finally, Solaris has blocked my entrance to Windows XP. When I start up my computer, I get a SunOS blue-background with two choices: the Solaris partition and my Windows partition. Choosing my windows partition gives me an error (saying some sig file could not be found) and choosing the Solaris partition starts the device configuration manager which eventually leads me to the desktop login screen (black and white, horrible resolution). How do I get to Windows XP?
    Thanks a lot for your help.

    I am having a similar issue. Let me know if you find a solution.

  • XSLT Mapper problem

    Hi gurus,
    I am facing a peculiar problem with my transformation mapper. I am trying to map my source database(AS400) to the destination database(Oracle) by using DB Adapter. My source table column names contain $ signs like P$id,P$name
    Now when I am trying to open the mapper window to map the source with destination, its displaying message:
    Failed to open the source schema: Invalid value for 'P$id' for attribute:'name'
    Failed to open the source schema: Invalid value for 'P$name' for attribute:'name'
    Please help me out.
    Thanks in advance,
    Abhishek

    Hi,
    is it possible to create a view with renamed columns in your source database?

  • E72_SIM Card register fail problem

    Dear All
      I just buy nokia E73 about 1 week. It has a problem with my phone ,It push a message to notify that SIM card register fail. Since I use my phone 1 week , it notify every day that I solve it by turn off phone and turn on again after that it has a network. I can call out , if sim card register fail which I can not phone. If you have a solution to solve this problem,please help me too. I am not sure that it cause from SIM CARD or phone. It will update firmware again or not. I must go to Nokia shop to change phone or solve it ?????
    Veenut

    I suggest you bring your device in for service and info.
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • HT1918 Credit Card and Paypal problem

    Im having a problem selecting my payment method. If I choose my credicard(MasterCard) apple say this creditcard was declined (and the card is perfect). If I choose the Paypal Apple ask me to contact the support. What am I suppose to do ??

    The credit card then is registered to exactly the same name and address (including format and spacing etc) that you have on your iTunes account, and it was issued by a bank in the country where you and your iTunes account are ? If it is then you could check with the card issuer to see if it's them that are declining it, and if not then try contacting iTunes Support and see if they know why it's being declined : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page
    For the PayPal, have you contacted iTunes Support to ask them why you are getting the message to contact them ? If not then you can use the above link to do so (these are user-to-user forums).

  • Question: Quick Look in Finder; problems with alpha channels

    Hi
    "Quick look" in Finder is great for quick presentations of a folders selected contents but it only works with images that contains no alpha channels or masks. Is there any way to work around this to display say PhotoShop documents with alpha channels? Or any plug-ins/applications that can help?
    thanks.

    This has been broken forever in OS X, and I don't know why, because it used to work just fine. I suspect the engineers did something to QuickTime that causes this problem, but it has been borked for so long I don't remember when the ability to correctly display files went wrong. I just remember that once upon a time all sorts of things from Apple worked correctly in displaying such files, but pretty much nothing does now. This includes the Finder, Preview, QuickLook, and various third-party image browsers that use Apple's own system level image handling abilities, such as VitaminSee or CocoaViewX. When I need to actually see what's there, I browse with Adobe's Bridge.
    Francine
    Francine
    Schwieder

  • Linksys PCI cards and WLC problems

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:Standardowy;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;
    mso-fareast-language:EN-US;}
    Hi,
    I have Linksys
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:Standardowy;
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:11.0pt;
    font-family:"Calibri","sans-serif";
    mso-ascii-font-family:Calibri;
    mso-ascii-theme-font:minor-latin;
    mso-hansi-font-family:Calibri;
    mso-hansi-theme-font:minor-latin;
    mso-bidi-font-family:"Times New Roman";
    mso-bidi-theme-font:minor-bidi;
    mso-fareast-language:EN-US;}
    WMP200 and WMP54G Wi-Fi PCI cards  installed on PC.
    My infrastructure is WLC 2106 and two APs 1231G and one 1242G.
    The problem is that the cards have problem with connection to WLAN.
    The broadcast SSID must be enable then the cards connect to WLAN otherwise is a problem with connection.
    When the card is connected but connection is unstable and poor.
    The cards have the newest firmware installed.
    Has anyone encountered a similar problem?
    Kamil

    Hi Kamil,
    Have you associated other types of clients with these AP's?  If so, do they perform better?
    You might want to start by checking the status of the poorly performing client on the controller while it's connected:
    monitor -> clients
    You'll primarily be interested in the RSSI and SNR. The other counters such as 'excessive retries' should be observed as well.
    Also check the AP's radio interface stats.  Check for excessive interference or channel utilization.
    This is a very helpful doc that you may want to check out:
    Unified Wireless Network: Troubleshoot Client  Issues
    http://www.cisco.com/en/US/products/ps6366/products_tech_note09186a00809d45a2.shtml
    Let us know if any of this helps.

Maybe you are looking for