Visual Studio 2015 won't display local web page (ms-appx ?) - visual-studio

I'm converting an app to run as a Universal Windows App using VS 2015 Community. If I create a webview using the toolbox, I can enter "http://www.google.com" into the Source property, and it will display google.
If I use the drop down on the Source property to reference (say) Help.htm as a local resource, the source windows displays "ms-appx:///Help.htm". Similarly if it is in Assets, it displays "ms-appx:///Assets/Help.htm". When I run the program, where the webview should appear it displays "You will need a new app to display this ms-appx" and invites me to search the store.
I can display a local image in an image box with very similar syntax, with Source being "ms-appx:///Assets/StoreLogo.png". The Source property in this case is in the "common" group, not "miscellaneous", but apart from that appears virtually identical.
Nor can I specify a local path in a URI (although again I can display Google). Behaviour is identical on two different machines. I have spent several days trying to work out what is going on; any suggestions?

Can you please try to load file through code and share results?
public MainPage()
{
this.InitializeComponent();
mywebview.Source = newUri("ms-appx-web:///Help.htm");
}
also try this
mywebview.Navigate(newUri("ms-appx-web:///Help.htm"));
If both above options doesn't work. Please change to below and share results
mywebview.NavigateToString("<Html><Body><h1>Eureka!!!!<h1><Body></Html>");

If you are using it from a Library project, you must also add the name of the library, like that:
ms-appx-web:///[Library]/Help.htm

Related

Windows Phone 7 Development - Image Source Issue

While developing a project for Windows Phone 7, I'm adding an image control onto the Grid and using the following code in C# to set the image source:-
Uri nUri = new Uri("/TestImage.png", UriKind.Relative);
BitmapImage nBitmapImage = new BitmapImage(nUri);
FacebookImage.Source = nBitmapImage;
The problem is that whenever I use custom images, they do not show up when I build and run the app on the emulator. Whereas, if I change the image file name in the above code to one of the images that are included in the project by default (ApplicationIcon.png), the image shows up upon running. I would like to know if this is a problem with the code or with the custom image files I'm using. I'm ensuring that the images I'm creating are proper and have the same attributes as the images included by default.
Could someone please help me out with this.
Thanks.
Click on your custom picture in Visual Studio's Solution Explorer. Then, look at the property window (press F4 if it's closed), and at the "Build Action" line. It basically tells the compiler how to embed your file in the application. The build action of ApplicationIcon.png should be "Content", just set the same one for your custom pictures.

Use ApplicationBar Icons from other assemblies?

I have a Page in a Windows Phone class library. This page has an appbar. I would prefer everything this page needs to be included within the class library so the setup list for consumers of this page / assembly is minimal.
However, When I set ApplicationBar icons, they get added to the class library project under the folder 'icons' just like normal, they show up fine in Blend, but at runtime they are no where to be found!
When I put the icons in the Windows Phone Application project all is well. However this is not my desired scenario as it is additional configuration / setup by the application author to use my pages.
I tried using the resource pathing using /{AssemblyName};component/icons/{IconName} but of course the AppBar needs them to be of type "Content" not "Resource". So I am thinking this is impossible but I wanted to know if anybody out there figured out how to do this.
Sorry guys. I just figured it out. I changed the newly added icons from "Resource" to "Content" but I forgot to set "Copy if newer" so they weren't getting outputted to the Bin\Debug\icons folder of the windows Phone Application. something to keep an eye on I guess.

Phonegap on WP7 does not load images

I'm starting my first PhoneGap project and am developing using Visual Studio and Windows Phone 7, although I intend on ultimately deploying to iOS and Symbian as well.
However, I'm stuck at Step 1. I have added an image to the www/images folder, and put the following code:
<img src="images/login-btn.png" width="103" height="42" style="margin-left:90px;" />
And I get:
It works fine when I preview it in IE9, but I don't have a Mac to test it on iOS yet.
It's worth noting that the JS files and CSS have loaded fine, it's just any image (whether referenced in CSS or an <img> tag) always comes up broken.
My guess would be the Build Action of your image file is incorrect.
According to http://wiki.phonegap.com/w/page/48672055/Getting%20Started%20with%20PhoneGap%20Windows%20Phone%207#4Reviewtheprojectstructure section 4. You should be setting the Build Action of your images etc to Content which simply copies them into the output project when it is built. They are probably currently set to Resource or None.
To change the Build Action right click a file and choose properties to go to the properties window if you do not already have it open. It is probably then the first property. Just click and choose the correct one.
I'm posting this to questions that I found while trying to find my answer to the same problem. The JS framework I use adds a url query to each image when in a debugging mode (in order to force browsers to reload image, instead of using cached). So, my image "image/background.jpg" would be accessed as "image/background.jpg?d=34342233". But, when running on PhoneGAP for Windows Phone, it won't recognize the image, and thus it shows up as broken. So, I had to turn off debugging for the framework I use, and suddenly the images showed up (still, don't forget to set the Build Action to "Content" as mentioned earlier).

Why is Configuration message appearing on jpeg images exported from DICOM file?

I am trying to make a web based dicom image viewer. I am using c# and asp.net. I am using Clear Canvas libraries found on www.clearcanvas.ca. The problem here is that when I try to export the jpeg images from dicom files the following message appears on them:
"The current configuration system does not support user-scoped setting"
On other forums I have found that this error can be removed by the application scope settings. I have tried that and still the message appears on the images. I have even shifted the user settings in app.config file to applicationsettings sections. Since web based solutions do not support user settings because the website has to run on the server. If some one has done this and removed this message from the images, then please share it here. I would really appreciate some help on removing this error. Thanks.
The ClearCanvas ImageViewer components were written to using several User settings. IIS based applications do not support user settings. An exception is occurring within the assembly due to the lack of support for user settings and placing it on the image.
There's a couple of solutions. You could go and modify the code by changing all of the settings to be application settings instead of user settings. You could also create a new .NET settings provider that supports user settings that could be used within IIS.

what is the correct build action for windows phone 7 image files?

I've been working on a Windows Phone 7 app, and after a bit of Googling it seems that for images that I have added to the Visual Studio project, I need to set the build action to "Content" in order to be able to reference the images in my app.
However, the Windows Phone List Application project template includes an image (ArrowImg.png) that has its Build Action set to "Resource", and is still available to be referenced from the application.
I was wondering if anyone could confirm that we should definitely be using the Content build action, or whether there is some way to access images added to a project with the Resource Build Action as shown in the project sample, which we should be using instead?
If you set the action to "Content" the image is included "as-is" in the XAP.
If you set the action to "Resource" the image is embedded into a shared DLL.
In a lot of situations you can use either. There may be a performance, or other, issue with using one rather than another but I'm not aware of and have never noticed any.
For what it's worth, unless I need to specifically make it a resource, I use content.
With the current (Beta) tools, I have seen VS complain that images directly referenced in XAML should be set to "Resource" (if set to "Content") but the app works fine with either. Hopefully this is an issue which will be addressed in the RTM tools.
For more information see the discussion in What are the various "Build action" settings in Visual Studio project properties and what do they do?
Either build action is correct.
Also worth looking at when resolving issues relating to build action is the pathing you use.
I've seen a fair few people running into trouble with this because they assume they've set their build action inappropriately.
You can set the build action either way to suit your requirements of when to incur the load time cost, you just need to adjust the pathing to suit.
Some more info on the topic from this post.
Set source to image in C#
You can liken content to the lazy
loading version of resources.
The difference is you will incur the
performance hit of all resources when
the assemblies are loaded to start
your app.
Content, on the other hand, the
performance hit is deferred to when
you use it.
Which is more suitable will vary on a
case by case basis.
Note also that the pathing to
reference resources and content is
different as can see here.
//Uri uri = new Uri("/Resources/Images/MyImage.jpg", UriKind.Relative); // Content
Uri uri = new Uri("/PhoneApp;component/Resources/Images/MyImage.jpg", UriKind.Relative); // Resource
BitmapImage imgSource = new BitmapImage(uri);
image1.Source = imgSource;

Resources