Exemple #1
0
        public static Task <bool> InitLoggingAsync()
        {
            return(Task.Run(
                       () => {
                var tcs = new TaskCompletionSource <bool>();
                InitLoggingCb cb2 = null;
                cb2 = (ptr, result) => {
                    if (result.ErrorCode != 0)
                    {
                        tcs.SetException(result.ToException());
                        CallbackManager.Unregister(cb2);
                        return;
                    }

                    tcs.SetResult(true);
                    CallbackManager.Unregister(cb2);
                };
                CallbackManager.Register(cb2);

                AppOutputLogPathCallback cb1 = null;
                cb1 = async(ptr, result, path) => {
                    if (result.ErrorCode != 0)
                    {
                        tcs.SetException(result.ToException());
                        CallbackManager.Unregister(cb1);
                        CallbackManager.Unregister(cb2);
                        return;
                    }

                    var appPath = Path.GetDirectoryName(path);
                    var fileList = new List <Tuple <string, string> > {
                        Tuple.Create("log.toml", Path.Combine(appPath, "log.toml"))
                    };

                    var fileOps = DependencyService.Get <IFileOps>();
                    await fileOps.TransferAssetsAsync(fileList);

                    Debug.WriteLine("Assets Transferred");
                    NativeBindings.AppInitLogging(null, UserData, cb2);
                    CallbackManager.Unregister(cb1);
                };

                CallbackManager.Register(cb1);
                NativeBindings.AppOutputLogPath("test_file", UserData, cb1);
                return tcs.Task;
            }));
        }
Exemple #2
0
 public static extern void AppInitLoggingNative(string fileName, IntPtr userDataPtr, InitLoggingCb callback);
Exemple #3
0
 public void AppInitLogging(string fileName, IntPtr userDataPtr, InitLoggingCb callback)
 {
     AppInitLoggingNative(fileName, userDataPtr, callback);
 }
 public void AuthInitLogging(string fileName, InitLoggingCb callback)
 {
     AuthInitLoggingNative(fileName, callback.ToHandlePtr(), OnInitLoggingCb);
 }