Force mobile screen orientation - c#

I'm beginner developer of cordova/phonegap.
I created a simple app and added wp8 platform. This created a Visual Studio project.
Opening this project, I can change orientation for all screens of the app (on MainPage.xaml file). Then, I changed this line, portrait only:
SupportedOrientations="Portrait" Orientation="Portrait"
Works fine, but I need force landscape orientation for a specific page. Before import to Visual Studio, I tried all imaginable plugins (phonegap), but don't work for me.
The question is: how force screen orientation (only specific page)?

Unfortunately, there is currently no way to do it dynamically without writing the plugin by yourself. There is though quite a ready plugin by GitHub user yoik which you can extend to include the Windows Phone 8. The code to include support for WP8 isn't probably that difficult to code and here seems to instructions for that.
Just to conclude this case
To use static locking for certain orientation, you can add
SupportedOrientations="Landscape" Orientation="Landscape"
to mainPage.xaml in case you are using CLI and if you are using PhoneGap Build you need to add
<preference name="orientation" value="landscape" />
To dynamically lock certain orientation, you need to have a plugin to do that. This plugin already exists for iOS and Android but it is missing port for Windows Phone 8 for some reason.
Even though this doesn't solve your problem exactly, it is the best answer you probably can get to this problem.
Update
As I already told in my monolog on comments, I decided to try to port it for WP8. I forked it on GitHub and it now compiles successfully. Unfortunately I don't have the opportunity to test it's correct functioning instantly but I'll do that ASAP. The fork can be found here.
Update 2
After spending few days on this topic. I finally got to test the implementation and it seemed somewhat promising. I created a pull request for the original project. Until it is merged, feel free to use the forked version. In case you find any problems, don't hesitate to contact me!

Related

Enable Back/Forward & Refresh Gestures in Universal Windows App (XAML)

I'm building a set of small internal apps for our business. A majority are web based tools. To provide easy access to all of the tools to all our staff. Previously I built small windows applications which are used currently. However, I'm looking to upgrade these to Universal Apps as we can better distribute future applications through our Microsoft Business Store.
Currently when placing a WebView into the UWP app, the app loads and functions as expected in terms of loading the WebView. However I cannot seem to find a means to implement Back / Forward navigation (previously this was a toggled option in the properties group) if a user navigates using Back/Forward on their mouse etc. Any pointers would be greatly appreciated. No doubt it's something quite obvious I haven't spotted.
I was expecting the basic back / forward navigation to work out of the box (as is the case I have experienced previously when developing for other platforms)
The app I'm currently working on is using the UWP with XAML and C# and currently has the WebViews implemented using:
<WebView x:Name="webView" Source="https://app.domain.com"/>
within MainPage.xaml and no further modifications made to this app as it stands.
I regularly use SO as a guest to find answers to questions but I couldn't see a direct answer to this scenario.
Thanks
The WebView class has built-in APIs that could Go Back/Forward. You could add some buttons and call them in the click event.

Tooling issues in the portable XAML files of Xamarin mobile project (2017)

So, I'm a C++ developer poking around into C#/Xamarin (did some Silverlight back a while ago.) I'm using VS 2017, the released version. I think that the preview is acting the same.
If I try to make changes to the main (porable) project versions the XAML files, I don't get a functional form previewer, it wants to use the live viewer simulating either Android or iOS. That's a lot slower and less convenient that just previewing the layout as I go, with alignment bars and all that. I do get the form previewer if I make changes in the UWP sub-project, but of course those then don't show up.
Also, if I edit the portable XAML I get no error checking. If I edit the UWP XAML I get error checking, but that's useless for the same reason.
So that all just doesn't make sense to me. Am I missing something? Why pre-generate the dups to begin with since we shouldn't need them other than for platform specific stuff, and why do the tools not work on the ones that we have to actually use?
These issues were taken care of, as best I can tell, in preview 5, though with some fiddling about. I get intellisense and error reporting in the portable (Xamarin specific I guess) Xaml files. The new live viewer isn't as nice as the UWP/Forms one that was in the tab and provided alignment and all that. Hopefully they will get that applied to the Xamarin specific XAML files.

Xamarin.Forms layout not being loaded after updating

Edit: Maps was not the problem, it's the forms itself as well.
In our app we are using Xamarin.Forms, and we used to use version 2.3.4.270 which was working fine. However, after updating to the current latest version 2.4.0.18342 and cleaning the solution, we just see a white screen without any exception. Note that not even a part of the actual layout is rendered at all. No code is changed.
This problem is on an Android device, iOS is working properly.
According to the release notes, there is nothing actually changed a lot in the Forms itself:
https://developer.xamarin.com/releases/xamarin-forms/xamarin-forms-2.4/2.4.0-stable/
Did Xamarin change something important in their switch from 2.3 to 2.4 that I am missing out here?
The white screen appears if you did not provide an API key, or if it not valid. Since your iOS project is working fine, my suggestion will be to check your declaration of API key for android.
https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/#Android
Well the problem was that we were using MvvmCross, this caused several problems in our project so we decided to switch to another framework.

Robotium in C# project

I am looking for a mobile automated testing tool and have found robotium. Will it work with C# android app? Can I add the robotium jar file to a .Net project?
While it is likely that, with some amount of work, Robotium could be made to work with Xamarin.Android, it is an amount of relatively complicated work that the Robotium project is unlikely to do. (the killer item probably being good IDE integration)
However, it appears that Xamarin has acquired a testing framework for mobile applications called Calabash. They have devoted a page to explaining it on their main site: http://developer.xamarin.com/guides/testcloud/calabash/introduction-to-calabash/. My instinct here (without having tried it) would be to try and make it work, as it is pretty likely that Calabash will be supported by Xamarin in the future.

How to make a start tile reference the desktop AND modern mode of an app?

I've made an app for the Windows desktop and also created it for the modern (metro) interface in Windows 8.1. I wanted to group them under the same start tile and have a setting that allowed the user to open the app in the chosen mode by clicking the start tile. I got this idea from Chrome, which has both modes referenced by the same tile in the start menu or the link on the taskbar. I thought that maybe when the setting was changed I would delete the current one and replace it with one that referenced the other mode, but positioning is a problem, as a new tile always appears at the far right of the start screen. How would I resize the tile correctly and how would I delete and replace a link on the taskbar? I am using VB right now, but I can write C# and C++ so feel free to post code or links to code that are written in these languages.
If you have any suggestions, please post a reply or a ask a question in the comments.
I also should note that I prefer to use native libraries only and do not like using third-party dlls.
Thanks in advance for the help.
P.S. I've already tried Google.
I've figured it out!
The best way to do this is to create two registry keys referencing the two interfaces but make both the desktop and modern version not have a start tile! Then create a third app that has a tile and make it open the files, check for the active interface, and send the data to that interface with the file as a param.
Thanks for everyone's help, though :)

Categories