本文整理汇总了C#中JniHandleOwnership类的典型用法代码示例。如果您正苦于以下问题:C# JniHandleOwnership类的具体用法?C# JniHandleOwnership怎么用?C# JniHandleOwnership使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JniHandleOwnership类属于命名空间,在下文中一共展示了JniHandleOwnership类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainApp
public MainApp(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
// Catch unhandled exceptions
// Found at http://xandroid4net.blogspot.de/2013/11/how-to-capture-unhandled-exceptions.html
// Add an exception handler for all uncaught exceptions.
AndroidEnvironment.UnhandledExceptionRaiser += AndroidUnhandledExceptionHandler;
AppDomain.CurrentDomain.UnhandledException += ApplicationUnhandledExceptionHandler;
// Save prefernces instance
Main.Prefs = new PreferenceValues(PreferenceManager.GetDefaultSharedPreferences(this));
// Get path from preferences or default path
string path = Main.Prefs.GetString("filepath", Path.Combine(global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "WF.Player"));
try {
if (!Directory.Exists (path))
Directory.CreateDirectory (path);
}
catch {
}
if (!Directory.Exists (path))
{
AlertDialog.Builder builder = new AlertDialog.Builder (this);
builder.SetTitle (GetString (Resource.String.main_error));
builder.SetMessage(String.Format(GetString(Resource.String.main_error_directory_not_found), path));
builder.SetCancelable (true);
builder.SetNeutralButton(Resource.String.ok,(obj,arg) => { });
builder.Show ();
} else {
Main.Path = path;
Main.Prefs.SetString("filepath", path);
}
}
示例2: D3Calc
public D3Calc(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
RegisterPcl.Register();
D3Api.ApiKey = ApiKey;
}
示例3: MainApplication
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
var builder = new ContainerBuilder();
builder.Register(x => this).As<IApplicationLifecycle>();
builder.Update(ViewLocator.Instance.Container);
RegisterReceiver(new NetworkInformation(), new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
}
示例4: CreateLoginUserApplication
public CreateLoginUserApplication(IntPtr intPtr, JniHandleOwnership jho)
: base(intPtr, jho)
{
// TODO: Go to http://dev.buddyplatform.com to get an app ID and app key.
Buddy.Init ("\Your App ID", "\Your App Key");
CreateLoginUserLibrary.ActivtyBase.HomeActivityType = typeof(CreateLoginUserSample.ViewUserActivity);
}
示例5: Application
public Application(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer) {
//TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
示例6: CustomApplication
public CustomApplication(IntPtr handle, JniHandleOwnership ownerShip)
: base(handle, ownerShip)
{
Iconics.RegisterFont(new Meteoconcs());
Iconics.RegisterFont(new Octicons());
Iconics.RegisterFont(new CommunityMaterial());
Iconics.RegisterFont(new CustomFont());
}
示例7: AlbumsApplication
public AlbumsApplication(IntPtr intPtr, JniHandleOwnership jho)
: base(intPtr, jho)
{
// TODO: Go to http://dev.buddyplatform.com to get an app ID and app password.
Buddy.Init ("", "");
CreateLoginUserLibrary.ActivtyBase.HomeActivityType = typeof(AlbumsSample.AlbumsActivity);
}
示例8: Application
/// <summary>
/// The constructor of the application class.
/// </summary>
/// <param name="javaReference"></param>
/// <param name="transfer"></param>
public Application(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
if (Default != null)
{
Default = this;
}
}
示例9: ZXingSurfaceView
protected ZXingSurfaceView(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
lastPreviewAnalysis = DateTime.Now.AddMilliseconds(options.InitialDelayBeforeAnalyzingFrames);
this.surface_holder = Holder;
this.surface_holder.AddCallback(this);
this.surface_holder.SetType(SurfaceType.PushBuffers);
this.tokenSource = new System.Threading.CancellationTokenSource();
}
示例10: MainApplication
public MainApplication (IntPtr handle, JniHandleOwnership transfer)
: base (handle, transfer)
{
BaseAppContext.Init();
//platform specific mappings
DI.MapClassToInterface<GetContactsDelegate, IGetContactsDelegate> ();
GetContactsDelegate.ABook = new Xamarin.Contacts.AddressBook (this.ApplicationContext);
}
示例11: FromJniHandle
public static ICollection FromJniHandle(IntPtr handle, JniHandleOwnership transfer)
{
if (handle == IntPtr.Zero)
return null;
IJavaObject inst = Java.Lang.Object.PeekObject (handle);
if (inst == null)
inst = new JavaCollection (handle, transfer);
else
JNIEnv.DeleteRef (handle, transfer);
return (ICollection) inst;
}
示例12: FromNative
internal static Stream FromNative(IntPtr handle, JniHandleOwnership transfer)
{
if (handle == IntPtr.Zero)
return null;
IJavaObject inst = Java.Lang.Object.PeekObject (handle);
if (inst == null)
inst = Java.Interop.TypeManager.CreateInstance (handle, transfer);
else
JNIEnv.DeleteRef (handle, transfer);
return new OutputStreamInvoker ((Java.IO.OutputStream)inst);
}
示例13: QmunicateApplication
public QmunicateApplication (IntPtr handle, JniHandleOwnership transfer)
: base (handle, transfer)
{
App.Version = AppVersionNumber (this);
// Create the broadcast receiver and bind the event handler
// so that the app gets updates of the network connectivity status
var _broadcastReceiver = new NetworkStatusBroadcastReceiver();
_broadcastReceiver.ConnectionStatusChanged += OnNetworkStatusChanged;
// Register the broadcast receiver
global::Android.App.Application.Context.RegisterReceiver(_broadcastReceiver,
new IntentFilter(ConnectivityManager.ConnectivityAction));
}
示例14: Throwable
public Throwable (IntPtr handle, JniHandleOwnership transfer)
: base (_GetMessage (handle), _GetInnerException (handle))
{
if (GetType () == typeof (Throwable))
is_generated = true;
// Check if handle was preset by our java activation mechanism
if (this.handle != IntPtr.Zero) {
needsActivation = true;
handle = this.handle;
if (handle_type != 0)
return;
transfer = JniHandleOwnership.DoNotTransfer;
}
SetHandle (handle, transfer);
}
示例15: MainApplication
public MainApplication(IntPtr handle, JniHandleOwnership transfer)
: base(handle, transfer)
{
_logger = new Logger();
Insights.Initialize(Settings.XamarinInsightsApiKey, ApplicationContext);
AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
{
args.Handled = false;
_logger.Log(args.Exception as Exception, LogType.ERROR);
};
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
{
_logger.Log(e.ExceptionObject as Exception, LogType.ERROR);
};
}