iPad rientation is not working with SDK 6.1 - ios6

i have iPad app which develop using monodevelop
Now i have problem with orientation with SDK 6.1
the orientation is not working with SDK 6.1 or on device /simulator 6.1
i tried to call ShouldAutoRotate function which return true but it not work
also function willrotate is not call at all !
i think there is another way to enable orientation with SDK 6
any help ?

In iOS6, auto rotate and orientation changes have changed , so i solved the problem using the following steps
1) You will need to assign a root view controller to your main application window on FinishedLaunching.
So if previously like me you have this in your FinishedLaunching(UIApplication app) method in main.cs:
window.AddSubview(mainVC.View);
Replace it with this:
window.RootViewController = mainVC;
2) Replace this:
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
With these two functions:
public override bool ShouldAutorotate()
{
return true;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return UIInterfaceOrientationMask.All;
}
3- you can fire the rotation action using WillRotate function

Related

Prism Library Dialog Service

The following sample never worked for me:
https://prismlibrary.com/docs/wpf/dialog-service.html
Where the dialogService comming from?
public MainWindowViewModel(IDialogService dialogService)
{
_dialogService = dialogService;
}
How can I add the dialog service?
protected override Window CreateShell()
{
var w = Container.Resolve<MainWindow>();
return w;
}
It's have to go within the RegisterTypes?
Where the dialogService comming from?
From the container. When resolving, the container also resolves all dependencies.
How can I add the dialog service?
You don't have to and normally should shouldn't either. Most of the time, the default implementation provided by the prism framework suffices.
It's have to go within the RegisterTypes?
If you use Unity, every non-concrete type has to be registered to be able to be resolved. That means, prism's dialog service implementation is registered somewhere. Have a look at the code of your application's base class as a starting point.

Using Shiny with UNO Platform

Looking for a way to use shinyorg/shiny nuget packages in cross-platform projects built on the UNO platform.
Facing some challenges beyond my (limited) skills for iOS development, I'm specifically looking for how to integrate Shiny.Core into the solution iOS project.
More precisely, I'm looking for where to put this initialization override:
public override void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
=> this.ShinyPerformFetch(completionHandler);
Since when I try adding this in the Main.cs (Application class) of the iOS project, I can't find where to start...
The Main.cs class from the iOS project contains a static Main method (which is the main entry point of the app) in which a call to UIApplication.Main(args, null, typeof(App)); is made.
UIApplication being in fact UIKit.UIApplication
Following this guide https://github.com/shinyorg/shiny/tree/master/src/Shiny.Core where it's said:
* Add the following as the first line in your AppDelegate.cs - FinishedLaunching method
using Shiny;
this.ShinyFinishedLaunching(new YourStartup());
** IOS JOBS **
If you plan to use jobs in iOS, please do the following:
1. Add this to your AppDelegate.cs
public override void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
=> this.ShinyPerformFetch(completionHandler);
On iOS, the AppDelegate is actually the App class in your app, created from the default Uno Platform templates.
Windows.UI.Xaml.Application inherits from UIApplicationDelegate and provides a way declare this:
#if __IOS__
public override void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> completionHandler)
=> this.ShinyPerformFetch(completionHandler);
#endif
in order for the code for the other platforms to ignore this iOS-specific code

Context switching issue in appium mobile automation

Hi I tried switching from native to hybrid pages in mobile automation . it throws an error chrome driver is already in use. How to fix it in mobile automation.
If you need to automate android app using java, you can switch between contexts using the below method.
public final String WEBVIEW = "WEBVIEW_com.maxsoft.testextractor";
public final String NATIVE_APP = "NATIVE_APP";
public void switchContextTo(String context){
if (context.toLowerCase().equals(WEBVIEW.toLowerCase())) {
androidDriver.context(WEBVIEW); // set context to WEBVIEW_1
} else {
androidDriver.context(NATIVE_APP); // set context to NATIVE_APP
}
}

WPF WebBrowser - How to Zoom Content?

Trying to test basic browser concepts in a WPF (C#/XAML, .NET 4.0) WebBrowser application. So far, the only problem is programatically zooming. Has anyone had any experience with this?
MSDN lists nothing: http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx
Additionally, I have tried various things such as RenderTransform options to no avail. Either this is not possible or not documented. I'm hoping for the latter. Note that a WinForm solution isn't acceptable.
Thanks in advance for any help,
Beems
Maybe you can execute a javascript like this.
document.body.style.zoom = 1.5;
In WPF we can manipulate the document. I Created a Extension Method for you, so you can set the Zoom:
// www.tonysistemas.com.br
public static partial class MyExtensions
{
public static void SetZoom(this System.Windows.Controls.WebBrowser WebBrowser1, double Zoom)
{
// For this code to work: add the Microsoft.mshtml .NET reference
mshtml.IHTMLDocument2 doc = WebBrowser1.Document as mshtml.IHTMLDocument2;
doc.parentWindow.execScript("document.body.style.zoom=" + Zoom.ToString().Replace(",", ".") + ";");
}
}
Usage:
WebBrowser1.SetZoom(0.5);
I used bits and pieces from this answer https://stackoverflow.com/a/7326179/17822 to assist with the zoom issue. The key here is the ExecWB method. The zoom on the Windows Desktop is not 1-1 to the zoom on the WebBrowser Control. You will have to play with it. The pseudo-code for the equation looks like this:
zoomLevel = (winDesktopZoom - 100) + _winDesktopZoom + 10
Note that you will need a reference to SHDocVw.dll which can be found in the C:\Windows\SysWOW64 for x64 machines and in C:\Windows\System32 for x86 machines.
This is not pretty, but it is the only thing that I have found, short of upgrading to http://awesomium.com that actually matches IE default zoom settings (which default to the Windows Desktop zoom) to WebBrowser Control. Also note that the Windows Desktop Zoom only exists for Vista, Win 7 and probably 2k8 as well in the Control Panel --> Display, but I didn't check Vista or 2k8. It is not there for XP (any service pack).
To get the Windows Desktop Zoom (this does work on XP for some reason) I did:
var presentSource = PresentationSource.FromVisual(this);
if (presentSource != null && presentSource.CompositionTarget != null
&& presentSource.CompositionTarget.TransformToDevice != null)
{
_zoomPercentage = Convert.ToInt32(100 * presentSource.CompositionTarget.TransformToDevice.M11);
}
This logic is placed in the OnSourceInitialized override for that XAML Window.
You can see this:
http://chriscavanagh.wordpress.com/2010/10/04/a-real-net-4-0-webbrowser/

Silverlight 3 - Out of browser HtmlPage.Window.Navigate

Silverlight 3 allows you to run your application out of the browser, which installs a link on your desktop/start menu.
The problem is we are currently using
System.Windows.Browser.HtmlPage.
Window.Navigate(new Uri("http://<server>/<resource>"), "_blank")
to load a URL into a new browser window (it's to provide a 'print friendly' page for users to print). This works in the normal SL in-browser version, but outside the browser we get 'The DOM/scripting bridge is disabled.' exception thrown when issuing the call.
Is there an alternative which works out of the browser?
I've seen Open page in silverlight out of browser but I need to do this entirely in code, so I don't want to add a (hidden) hyperlink button and then programmatically 'click' it (unless I absolutely have to...).
you can try inheriting from HyperlinkButton and exposing public Click() method (which you can then instantiate and call from code instead of declaring it in xaml).
Details here: http://mokosh.co.uk/post/2009/10/08/silverlight-oob-open-new-browser-window/
I wrote an Extension method based on the idea to inherit from the HyperlinkButton.
public static class UriExtensions {
class Clicker : HyperlinkButton {
public void DoClick() {
base.OnClick();
}
}
static readonly Clicker clicker = new Clicker();
public static void Navigate(this Uri uri) {
Navigate(uri, "_self");
}
public static void Navigate(this Uri uri, string targetName) {
clicker.NavigateUri = uri;
clicker.TargetName = targetName;
clicker.DoClick();
}
}
Then use can use it simple, like
new Uri("http://www.google.com").Navigate("_blank");

Resources