Xamarin Sport App - Unknown Identifier - visual-studio

I am looking at their sample application for sports leagues found here: https://github.com/xamarin/Sport
I put a breakpoint here:
But when I hover/do a quick watch on athleteId and/or registraitonComplete, I get
Unknown identifier: Settings
The thing is, I can step into Settings so I know it can find it – heck it shouldn’t compile without it…

No answers yet, here is the solution for those who are still looking for
Settings is a static class, somehow Visual studio(Xamarin) does not recognize the static class whose actual path and namespace does not match. So, to access Settings whose namespace is like below, you need to use Sport.Mobile.Shared.Settings.
namespace Sport.Mobile.Shared {
public static class Settings
This applies to any static class you use in your project.

Related

Background Audio in Xamarin Forms

I've got a Xamarin.Forms app. at one time, I had this working, but alas, something has happened and now it no longer works. In my Android project, I have a dependency service as shown below. I am just trying to play a sound on the local system in the background. Now, out of the blue, I am getting an error on compile saying that 'Resource' does not contain a definition for 'Raw'. I have no idea where this error came from or how to fix it. There is a directory in Resource folder called raw. In it, there is a file named flushing.mp3. the VS intellisense does indicate the file is there. Any ideas are appreciated. TIA
Here is my code for my dependency service:
[assembly: Dependency(typeof(Audio))]
namespace PooperAppMobile.Droid.DependencyServices
{
public class Audio : IAudio
{
private MediaPlayer _mediaPlayer;
public bool PlayFlush()
{
_mediaPlayer = MediaPlayer.Create(global::Android.App.Application.Context, Resource.Raw.flushing);
_mediaPlayer.Start();
return true;
}
}
}
Well to be quite honest this error was giving me quite a pain when I saw this solution on a GITHUB discussion now all you have to do is add this line in your project file i.e. the .csproj, in your debug property group something like this :
<PropertyGroup.......
<AndroidUseManagedDesignTimeResourceGenerator>False</AndroidUseManagedDesignTimeResourceGenerator>
....
</PropertyGroup>
And It will start working as expected,
Good luck!
In case of queries do revert.

Xamarin Android Binding Library Custom Namespace Not Recognized

I am creating a Xamarin Android binding library for an existing JAR that contains a single class and following the Xamarin binding library documentation, I am able to successfully rename the namespace using:
<attr path="/api/package[#name='com.company.blah']" name="managedName">Company.Blah</attr>
I also confirmed the namespace is changed in the generated class in the 'obj/Debug' folder:
namespace Company.Blah {
// Metadata.xml XPath class reference: path="/api/package[#name='com.company.blah']/class[#name='NativeClass']"
[global::Android.Runtime.Register ("com/sprylab/android/widget/TextureVideoView", DoNotGenerateAcw=true)]
public partial class NativeClass
{
...
}
}
I face two problems:
I am unable to reference NativeClass from a sample Android project. It's like to doesn't see the namespace at all. The binding project built successfully without errors.
If I remove the package namespace rename setting, it also builds successfully and I am then able to reference it in my sample project but it requires that I fully qualify the class name anywhere it is used:
private com.company.blah.NativeClass nativeClass;
I'm hoping if I can fix #1, then #2 will not show up again. If so, I'm also curious how you prevent fully qualified class names from showing up?
Going into the project settings of the binding library project and clearing the box to the right of the assembly name seemed to do the trick. Looking inside the csproj directly, it is the root namespace.

Still unknown class in Interface Builder file, have checked other answers

I know this question has been asked a few times before, and I have checked all the solutions offered.
- My storyboard viewcontroller is linked to a custom class. This seems to work since you can click the little arrow, and it opens up the correct class file.
- The custom class is included in the project.
- The storyboard source file shows the correct name for the class.
I still get the error "Unknown class KnorkMans in Interface Builder file"
This screenshot shows all the steps I have taken:
You also have to manually select module VerwijderMij.

How to add method to MFC-ActiveX

The question seems to be stupid since there are many explanations in internet, that describe how to add a new method that can be called by users of the resulting OCX later. Unfortunately it does not work for me.
I have a MFC-based ActiveX-control project that was created with Visual Studio 6 and was imported to VS2010. There I have NO class view where I could use the Wizard with to add a method (the class view tab pane is there but it is empty). The existing code also does not provide any callable methods until now so that I simply could copy them.
So: how can I enable/invoke the class view generation in VS2010 to use the Wizard?
And as soon as it works: What type should such a method be to be externally visible? From what I learned the Wizard asks for some type...
To add a method to your ActiveX control you have to follow the folliwng steps:
1. Declare the function in the header file.
e.g.
public:
int Connect(int timeout);
2. Add the definition in the CPP file.
int CSLWebLinkCtrl::Connect(int timeout)
// Your logic here.
return 0;
}
3. Expose your methods in the .idl file
[id(4), helpstring("method Connect")] int Connect(int timeout);
Hope it will help you. :)
Maybe the SDF file is corrupt?
If you right-click the Class View dialog bar, you should see a context menu option for Class Wizard. From there, you should be able to work with your project's classes.

How can I change the name of my project and have it reflect everywhere?

I created a project in Visual Studio 2010 but I mispelled the name well into development.
If I right click, and rename the project, it seems the changes aren't cascaded to folders and classes.
For example, if my project was named Foa and I added a class, the namespace would be:
namespace Foa
{
public class Bar
If I renamed the project to Foo, the class stays:
namespace Foa
{
public class bar
Is there a way to cascade that change?
Change the namespace in one spot and then Ctrl+. on it and choose the refactor option. This will change the namespace throughout.
Change the default namespace in the project properties, then use a refactor tool to change the namespaces. Resharper has a fix inconsistent namespaces tool that will do it but you can just use the visual studio refactor to do it manually.

Resources