How to set Image Source to a picture from .dll or .winmd in windows phone 8.1? - windows-runtime

I am new to windows phone 8.1 developping and focus on library dev.
In the wp 8.0 era,I know if I want to create a Image instance.
I just write
amapLogo.Source = new BitmapImage(new Uri("/Com.AMap.Api.Maps" + ";component/Resources/ap2.data", UriKind.Relative));
need to point here is that "/Com.AMap.Api.Maps" is my library output dll
It works fine.
If I keep the same code in wp8.1 developping
exception appears
An exception of type 'System.ArgumentException' occurred in mscorlib.ni.dll but was not handled in user code
Additional information: The given System.Uri cannot be converted into a Windows.Foundation.Uri. Please see http://go.microsoft.com/fwlink/?LinkID=215849 for details.
I browse http://go.microsoft.com/fwlink/?LinkID=215849
and find that two ways to set the ImageSource correctly.
the ms-appx or ms-appx-web scheme to create an absolute URI.
but it is used for getting a resource in the app package
what I want is getting a resource from my dll
so
What can I do to create a Image instance using way of setting
ImageSource.
Or is there anther way to do what i want?
Thanks!

Just Solve it!
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh965322.aspx
To access files stored inside the same package, but from a class library, use the class library name:
<Image Source="/ClassLibraryName/images/logo.png" />

Related

Android Studio Gradle error: Missing project_info object

basically opening this question again because the answer is outdated, as the link now redirects to Firebase:
Gradle fails building with "Missing project_info object"
I want to attach the google-services.json file to my Android Studio project, and every time I try to download it from the developers API from Google, it gives me a json file with a large name that does't correspond to the tutorial's simple "google-services" and renaming it won't work because of this error.
Downloading it creating a new project doesn't seem possible for me now as it the page gives me another error when I click Configure a Project (I already did that before but left the project there without downloading the json file directly from there, which seems to be the problem).
Where can I safely get this file, and should I rename it or? Thanks in advance.
Apparently the solution is just following the link and creating the project with Firebase:
Then create or select a project and fill it with your app data that shoul look like this (the SHA-1 key should be found in your console log when clicking the button in the image:
Then add the lines of code that should be in your build.gradle(app level one and project level one), editing them with notepadd. Finally you need to sync these Gradle files, in Android Studio : File->Sync project with Gradle Files
The tutorial is very self explatanory, but for beginners like me, this could help.

Windows 8.1, Adding camera capture task not importing?

I'm trying to put a camera capturing task/event into my application I'm building. But everytime I try to do the import, "using Microsoft.Phone.Tasks;" It gives me an error and "phone" is highlighted in red. Can't seem to figure out what the bug is, can anyone help?
Here's an image of my problem.
![problem] file:///C:/Users/Qamar/Desktop/Problem.png
thanks!
Think you're using WP8.1 runtime, so that namespace is not available.
See microsoft-phone-tasks-namespace-is-not-available
In WP8.1 runtime you need to use Windows.Phone.Media.Capture namespace for most of your camera needs.

writeablebitmap in windows phone 8.1

I create universal project type in vs 2013 for 8.1.
In windows phone project i added reference to WriteableBitmapEx via nuget. In references i see WriteableBitmapEx.WinRT. I write code which creates WriteableBitmap from content (use image in project with Content and Dont copy properties). Next i create Image and set source to WriteableBitmap and add image in LayoutRoot grid. In emulator i see this image, thats ok!
Next i call DrawLine method from WriteableBitmap and call WriteableBitmap.Invalidate().
I dont see my line...why?
1) Why reference name ends with .WinRT, is this normal?
2) Why invalidate method not work?
NOTE: in windows phone 8 project (not universal) all works properly! And reference name not ends with .WinRT.
Help me please!
As already said in my comment, I had the same problem. After hours of confused searching, I finally found this trivial reason:
For universal apps, there are actually two projects: MyProject.Windows and MyProject.WindowsPhone. You need to add the nuget package for both of them (they have separate references) and everything will work.

System.Windows.Application.get_MainWinndow() exception Windows Phone

I have created a small app for Windows Phone 8. When I run it I get the following error:
((System.Windows.Application)(this)).MainWinndow threw an exception of type System.NotSupportedException at System.Windows.Application.get_MainWinndow()
I have searched for a solution to this but not much information out there.
My main page is called WelcomePage.xaml which is the first page that gets loaded and when exception is thrown during test on emmulator, but I'm not sure if that is the problem or even how to check if it is. My thinking being that I changed the name of MainPage.xaml to WelcomePage.xaml and this has maybe upset something.
Any ideas how I would go about solving the above problem, apologies I'm new to VS and Windows Phone C#?
J
Have you checked WMAppManifest.xml file in Properties path?
In the Application UI Tab, the Navigation Page should be changed to WelcomePage.xaml but not MainPage.xaml.

class not found in Actionscript error

I am trying to run the program from http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf61c8a-7ff4.html
I am using Adbobe builder version 4.6 i encounter this problem WAVwriter class not found
when i do import com.adobe.audio.format.WAVWriter;
Also var outputFile:File = File.desktopDirectory.resolvePath("recording.wav"); File type is not found..
How to resolve this error
Exactly as Adnan Doric said. And if you want to output your file using Flash Player runtime (instead of AIR), you should use flash.net.FileReference class. Calling its dowload() method will pop up an external dialog which can be used to save your file.
File is an AIR class, make sure your project is for desktop or mobile (AIR). If not, you can make new desktop project by going to File/New/Flex Project... and check in the Desktop checkbox (for mobile, choose Flex Mobile Project).
Regarding WAVWriter, make sure you linked the related sources.