예제 #1
0
 private void HandleError(Foundation.NSError error)
 {
     if (error != null)
     {
         throw new Exception($"Can't change Icon. Error: {error.Description}.");
     }
 }
        /// <summary>
        /// Save UIImage into directory
        /// </summary>
        /// <param name="image"></param>
        void Save(UIKit.UIImage image)
        {
            var documentsDirectory = Environment.GetFolderPath
                                         (Environment.SpecialFolder.Personal);
            var directoryname = Path.Combine(documentsDirectory, "FolderName");

            Directory.CreateDirectory(directoryname);

            string jpgFile = System.IO.Path.Combine(directoryname, "image.jpg");

            Foundation.NSData  imgData = image.AsJPEG();
            Foundation.NSError err     = null;
            if (imgData.Save(jpgFile, false, out err))
            {
                Console.WriteLine("saved as" + jpgFile);
            }
            else
            {
                Console.WriteLine("not saved as " + jpgFile + "because" + err.LocalizedDescription);
            }
            var alert = UIAlertController.Create("Saved Location", jpgFile, UIAlertControllerStyle.Alert);

            alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
            ShowViewController(alert, null);
        }
예제 #3
0
 public override void DidFail(ARSession session, Foundation.NSError error)
 {
     if (arkit.TryGetTarget(out var ap) && ap.Application.IsActive)
     {
         Urho.Application.InvokeOnMain(() => ap.OnDidFail(error));
     }
 }
예제 #4
0
 public void ProcessNSError(Foundation.NSError error)
 {
     if (error != null)
     {
         WriteLine("NSError : domain = " + error.Domain + " code = " + error.Code.ToString());
     }
 }
예제 #5
0
        public async Task AuthWithGoogleTokenAsync(SignIn signIn, GoogleUser user, Foundation.NSError error)
        {
            try {
                if (error == null)
                {
                    IsAuthenticating = true;
                    var token       = user.Authentication.AccessToken;
                    var authManager = ServiceContainer.Resolve <AuthManager> ();
                    var authRes     = await authManager.AuthenticateWithGoogleAsync(token);

                    // No need to keep the users Google account access around anymore
                    signIn.DisconnectUser();
                    if (authRes != AuthResult.Success)
                    {
                        var email = user.Profile.Email;
                        AuthErrorAlert.Show(this, email, authRes, AuthErrorAlert.Mode.Login, true);
                    }
                    else
                    {
                        // Start the initial sync for the user
                        ServiceContainer.Resolve <ISyncManager> ().Run();
                    }
                }
                else if (error.Code != -5)     // Cancel error code.
                {
                    new UIAlertView("WelcomeGoogleErrorTitle".Tr(), "WelcomeGoogleErrorMessage".Tr(), null, "WelcomeGoogleErrorOk".Tr(), null).Show();
                }
            } catch (InvalidOperationException ex) {
                var log = ServiceContainer.Resolve <ILogger> ();
                log.Info(Tag, ex, "Failed to authenticate (G+) the user.");
            } finally {
                IsAuthenticating = false;
            }
        }
예제 #6
0
        public void OnCollectorError(int errorCode, Foundation.NSError error)
        {
            String errorReason   = String.Empty;
            String errorCodeName = errorCode.ToString();

            WriteLine(errorCodeName + " - " + errorReason);
            ProcessNSError(error);
            InvokeOnMainThread(() => sendDeviceInformation.Enabled = true);
            InvokeOnMainThread(() => generateSessionButton.Enabled = true);
        }
 void HandleRegisterResultHandler(Firebase.Auth.User user, Foundation.NSError error)
 {
     if (user != null)
     {
         ToastIOS.Toast.MakeText("Registration Successful").Show();
     }
     else
     {
         ToastIOS.Toast.MakeText("Registration Failed").Show();
     }
 }
예제 #8
0
 public void DidFailNavigation(WKWebView webView, WKNavigation navigation, Foundation.NSError error)
 {
     if (navigation == _navigation)
     {
         Fail(() =>
         {
             var localError = new NSError(Enums.ErrorCode.NetworkFailure, error);
             _delegate?.RequestDidFail(this, error);
         });
     }
 }
 void HandleLoginHandler(Firebase.Auth.User user, Foundation.NSError error)
 {
     if (user != null)
     {
         ToastIOS.Toast.MakeText("Login Successful").Show();
     }
     else
     {
         ToastIOS.Toast.MakeText("Login Failed").Show();
     }
     UpdateView(user);
 }
 public void HandleBITAuthenticatorIdentifyCallback(bool identified, Foundation.NSError error)
 {
     if (authorized != null)
     {
         // Execute operation in UI thread
         BeginInvokeOnMainThread(() =>
         {
             authorized.Value = String.Format("{0} ({1})", hockey.Authenticator.Identified, hockey.Authenticator.IdentificationType);
             authorized.GetContainerTableView().ReloadData();
         });
     }
 }
        internal override NativeElementData ToNative()
        {
            NativeBarcodeData native = null;

#if __ANDROID__
            native = new NativeBarcodeData(ElementId, BarcodeValue, BarcodeType.ToNative());
#elif __IOS__
            Foundation.NSError error = null;
            native = NativeBarcodeData.Create((ushort)ElementId, BarcodeType.ToNative(), BarcodeValue, out error);
#elif WINDOWS_PHONE_APP
            native = new NativeBarcodeData(BarcodeType.ToNative(), ElementId, BarcodeValue);
#endif
            return(native);
        }
 public void PostNotificationFailureHandler(Foundation.NSError error)
 {
     if (error.UserInfo != null && error.UserInfo["returned"] != null)
     {
         var dict = JsonConvert.DeserializeObject <Dictionary <string, object> >(error.UserInfo.ToString());
         _builder?.OnPostNotificationFailedCallback(dict);
     }
     else
     {
         _builder?.OnPostNotificationFailedCallback(new Dictionary <string, object> {
             { "error", "HTTP no response error" }
         });
     }
 }
예제 #13
0
 public void PostNotificationFailureHandler(Foundation.NSError error)
 {
     if (error.UserInfo != null && error.UserInfo ["returned"] != null)
     {
         Dictionary <string, object> dict = NSDictToPureDict(error.UserInfo);
         Com.OneSignal.OneSignal.onPostNotificationFailureDelegate(dict);
     }
     else
     {
         Com.OneSignal.OneSignal.onPostNotificationFailureDelegate(new Dictionary <string, object> {
             { "error", "HTTP no response error" }
         });
     }
 }
예제 #14
0
        /// <summary>
        /// We need to invoke this on the main thread as it access UI components.  We get the root view controller and present an alert
        /// informing the user that they need to go into settings and change their access to grant this application access to the contacts.
        /// We set the call back of the message to force the user to the No Access Display as th app does not want to allow the user to continue
        /// until they have granted contact access.
        /// </summary>
        /// <param name="error">Error.</param>
        private void showMessage(Foundation.NSError error)
        {
            InvokeOnMainThread(() => {
                var rvc             = UIApplication.SharedApplication.KeyWindow.RootViewController;
                var errorMsg        = error.LocalizedDescription + "\n\nPlease allow the app to access your contacts through settings";
                var alertController = UIAlertController.Create("Contact Picker", errorMsg, UIAlertControllerStyle.Alert);
                var dismiss         = UIAlertAction.Create("OK", UIAlertActionStyle.Default, reDirectToNoAccess);


                alertController.AddAction(dismiss);

                if (rvc != null)
                {
                    rvc.PresentViewController(alertController, true, null);
                }
            });
        }
예제 #15
0
 partial void OnReadBtnClick(UIButton sender)
 {
     if (haveRead)
     {
         label.Text = "";
         haveRead   = false;
         readBtn.SetTitle("Read", UIControlState.Normal);
     }
     else
     {
         Foundation.NSError     error         = new Foundation.NSError();
         DynamsoftBarcodeReader barcodeReader = new DynamsoftBarcodeReader("");
         iTextResult[]          result        = barcodeReader.DecodeImage(qrimage.Image, "", out error);
         label.Text = result[0].BarcodeText;
         readBtn.SetTitle("Reset", UIControlState.Normal);
     }
 }
예제 #16
0
        static int emailPort    = 25;                      //587;//Convert.ToInt32(DynaClassLibrary.DynaClasses.LoginContainer.User.DynaConfig.EmailPort);//ConfigurationManager.AppSettings.Get("emailPort"));

        public static void sendNSErrorEmail(Foundation.NSError exception)
        {
            try
            {
                string subject      = "DynaPad Error - on " + DateTime.Now.ToShortDateString();
                string errorMessage = "CODE:<br/><br/>" + exception.Code + "<br/><br/><br/>DOMAIN:<br/><br/>" + exception.Domain + "<br/><br/><br/>USER INFO:<br/><br/>" + exception.UserInfo + "<br/><br/><br/>LOCAL DESC:<br/><br/>" + exception.LocalizedDescription + "<br/><br/><br/>LOCAL FAIL REASON:<br/><br/>" + exception.LocalizedFailureReason + "<br/><br/><br/>LOCAL RECOVER SUGGESTION:<br/><br/>" + exception.LocalizedRecoverySuggestion;

                var message = new MimeMessage();
                message.From.Add(new MailboxAddress("DynaPad App", emailFrom));
                message.To.Add(new MailboxAddress("DynaDox Support", emailTo));
                message.Subject = subject;

                message.Body = new TextPart("html")
                {
                    Text = errorMessage
                };

                using (var client = new SmtpClient())
                {
                    // For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
                    //client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                    client.Connect(emailSMTP, emailPort);

                    // Note: since we don't have an OAuth2 token, disable
                    // the XOAUTH2 authentication mechanism.
                    client.AuthenticationMechanisms.Remove("XOAUTH2");

                    // Note: only needed if the SMTP server requires authentication
                    client.Authenticate(emailUser, emailPass);

                    client.Send(message);
                    client.Disconnect(true);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #17
0
        async void HandleAuthDataResultHandler(AuthDataResult authResult, Foundation.NSError error)
        {
            if (error != null)
            {
                //Console.WriteLine(error.UserInfo["error_name"].Description);

                if (error.UserInfo["error_name"].ToString() == "ERROR_EMAIL_ALREADY_IN_USE")
                {
                    //Console.WriteLine("DUPLICATE_EMAIL_ERROR");
                    MessagingCenter.Send <IFirebaseAuthenticator>(this, "Go");
                }
                if (error.UserInfo["error_name"].Description == "ERROR_INVALID_EMAIL")
                {
                    MessagingCenter.Send <IFirebaseAuthenticator, int>(this, "MainPageError", 0);
                }
                if (error.UserInfo["error_name"].Description == "ERROR_USER_NOT_FOUND")
                {
                    MessagingCenter.Send <IFirebaseAuthenticator, int>(this, "MainPageError", 1);
                }
                if (error.UserInfo["error_name"].Description == "ERROR_WRONG_PASSWORD")
                {
                    MessagingCenter.Send <IFirebaseAuthenticator, int>(this, "MainPageError", 2);
                }
            }

            else
            {
                if (isCreateUser == true)
                {
                    localUserData.Add("firebaseID", authResult.User.Uid);

                    newClient.UploadValues("http://www.cvx4u.com/web_service/create_user.php", localUserData);
                }
                await App.currentUser.SetUserInfo(authResult.User.Uid);

                await Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(new CandidateDashboard());
            }
        }
예제 #18
0
 internal void OnDidFail(Foundation.NSError error)
 => DidFail?.Invoke(error);
예제 #19
0
 public void DidSignIn(SignIn signIn, GoogleUser user, Foundation.NSError error)
 {
     InvokeOnMainThread(async delegate {
         await AuthWithGoogleTokenAsync(signIn, user, error);
     });
 }
 public virtual override Foundation.NSError WillPresentError(Foundation.NSError error)
 {
     throw new NotImplementedException();
 }
예제 #21
0
 public virtual override Foundation.NSError WillPresentError(AppKit.NSApplication application, Foundation.NSError error)
 {
     throw new NotImplementedException();
 }
예제 #22
0
 public override void ConversationEnded(TWCConversation conversation, Foundation.NSError error)
 {
     Console.WriteLine($"Conversation ended with error: {error}");
     OnConversationEnded?.Invoke();
 }
예제 #23
0
 public override void ConversationDidFailToConnectParticipant(TWCConversation conversation, TWCParticipant participant, Foundation.NSError error)
 {
     Console.WriteLine("Participant failed to connect: {0} with error: {1}", participant.Identity, error.Description);
     conversation.Disconnect();
 }
예제 #24
0
        void HandleBTDropInControllerHandler(BTDropInController controller, BTDropInResult result, Foundation.NSError error)
        {
            if (error != null)
            {
                System.Diagnostics.Debug.WriteLine("ERROR");
            }
            else if (result != null && result.Cancelled == true)
            {
                System.Diagnostics.Debug.WriteLine("CANCELLED");
            }
            else
            {
                Button.SetTitle(result.PaymentDescription, UIControlState.Normal);

                var selectedPaymentOptionType        = result.PaymentOptionType;
                var selectedPaymentMethod            = result.PaymentMethod;
                var selectedPaymentMethodIcon        = result.PaymentIcon;
                var selectedPaymentMethodDescription = result.PaymentDescription;
            }
            controller.DismissViewController(true, null);
        }
예제 #25
0
 public virtual override void FailedToContinueUserActivity(AppKit.NSApplication application, string userActivityType, Foundation.NSError error)
 {
 }
예제 #26
0
 public override void SignInWillDispatch(GIDSignIn signIn, Foundation.NSError error)
 {
     //base.SignInWillDispatch(signIn, error);
 }
예제 #27
0
 public override void Failed(CLLocationManager manager, Foundation.NSError error)
 {
 }
예제 #28
0
 public virtual override void FailedToRegisterForRemoteNotifications(AppKit.NSApplication application, Foundation.NSError error)
 {
 }
예제 #29
0
 public override void DidFail(ARSession session, Foundation.NSError error)
 {
     Console.WriteLine("DidFail");
 }
예제 #30
0
 public static override AppKit.NSAlert WithError(Foundation.NSError error)
 {
     throw new NotImplementedException();
 }