Appverse.Platform.IPhone.IPhoneScanner.HandleQRCode C# (CSharp) Метод

HandleQRCode() публичный Метод

public HandleQRCode ( MediaQRContent mediaQRContent ) : QRType
mediaQRContent MediaQRContent
Результат QRType
		public override QRType HandleQRCode (MediaQRContent mediaQRContent)
		{
			if (mediaQRContent != null) {
				try {
					NSUrl param = new NSUrl (mediaQRContent.Text);

					UIApplication.SharedApplication.InvokeOnMainThread (delegate {
						// UIApplication.SharedApplication.OpenUrl method must be called from UI main thread [AMOB-14]
						switch (mediaQRContent.QRType) {
						case QRType.EMAIL_ADDRESS:
							SystemLogger.Log (SystemLogger.Module.PLATFORM, "HandleQRCode - EMAIL_ADDRESS type");
							if ((UIApplication.SharedApplication.CanOpenUrl (param)) && (MFMailComposeViewController.CanSendMail)) {
								UIApplication.SharedApplication.OpenUrl (param);
							} else {
								StartNotifyAlert ("Mail Alert", "Sending of mail messages is not enabled or supported on this device.", "OK");
							}
							break;
						case QRType.TEL:

								SystemLogger.Log (SystemLogger.Module.PLATFORM, "HandleQRCode - TEL type");
								if (UIApplication.SharedApplication.CanOpenUrl (param)) {
									UIApplication.SharedApplication.OpenUrl (param);
								} else {
									StartNotifyAlert ("Phone Alert", "Establishing voice calls is not enabled or supported on this device.", "OK");
								}
							
							break;
						case QRType.URI:
							SystemLogger.Log (SystemLogger.Module.PLATFORM, "HandleQRCode - URI type");
							if (UIApplication.SharedApplication.CanOpenUrl (param)) {
								UIApplication.SharedApplication.OpenUrl (param);
							} else {
								StartNotifyAlert ("Browser Alert", "The requested URL could not be automatically opened.", "OK");
							}
							break;
						default:
							SystemLogger.Log (SystemLogger.Module.PLATFORM, "HandleQRCode - not maanged type");
							StartNotifyAlert ("QR Alert", "The QR Code " + mediaQRContent.QRType.ToString() + " cannot be processed automatically.", "OK");
							break;
						}

					});
				} catch (Exception ex) {
					SystemLogger.Log (SystemLogger.Module.PLATFORM, "HandleQRCode - exception: " + ex.Message);
					StartNotifyAlert ("QR Alert", "The QR Code cannot be handled due to an unhandled exception (see log).", "OK");
				}
				return mediaQRContent.QRType;
			}

			return QRType.TEXT;
		}