private UIView GetDefaultSessionIndicator(UIView container) { var indicator = new UILabel(); indicator.BackgroundColor = new UIColor(red: 1.0f, green: 0.0f, blue: 0.0f, alpha: 0.7f); indicator.Text = "End Session"; indicator.UserInteractionEnabled = true; indicator.TextAlignment = UITextAlignment.Center; indicator.Font.WithSize(UIFont.SmallSystemFontSize); indicator.TextColor = UIColor.White; indicator.Layer.CornerRadius = 10; indicator.ClipsToBounds = true; indicator.TranslatesAutoresizingMaskIntoConstraints = false; container.AddSubview(indicator); indicator.WidthAnchor.ConstraintEqualTo(200f).Active = true; indicator.HeightAnchor.ConstraintEqualTo(40f).Active = true; indicator.CenterXAnchor.ConstraintEqualTo(container.CenterXAnchor).Active = true; indicator.BottomAnchor.ConstraintEqualTo(container.BottomAnchor, constant: -20f).Active = true; var tapRecognizer = new UITapGestureRecognizer(() => { CobrowseIO.Instance().CurrentSession?.End(null); }); tapRecognizer.NumberOfTapsRequired = 1; indicator.AddGestureRecognizer(tapRecognizer); return(indicator); }
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { CobrowseIO.Instance().License = "trial"; Console.WriteLine($"Cobrowse device id: {CobrowseIO.Instance().DeviceId}"); CobrowseIO.Instance().Delegate = new CustomCobrowseDelegate(); CobrowseIO.Instance().CustomData = new NSDictionary <NSString, NSObject>( keys: new NSString[] { CBIO.UserIdKey, CBIO.UserNameKey, CBIO.UserEmailKey, CBIO.DeviceIdKey, CBIO.DeviceNameKey, }, values: new NSObject[] { new NSString("<your_user_id>"), new NSString("<your_user_name>"), new NSString("<your_user_email>"), new NSString("<your_device_id>"), new NSString("<your_device_name>"), } ); CobrowseIO.Instance().Start(); // Override point for customization after application launch. // If not required for your application you can safely delete this method return(true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { CobrowseIO.Instance().License = "trial"; Console.WriteLine($"Cobrowse device id: {CobrowseIO.Instance().DeviceId}"); CobrowseIO.Instance().Delegate = new CustomCobrowseDelegate(); CobrowseIO.Instance().CustomData = new NSDictionary <NSString, NSObject>( keys: new NSString[] { CBIO.UserIdKey, CBIO.UserNameKey, CBIO.UserEmailKey, CBIO.DeviceIdKey, CBIO.DeviceNameKey, }, values: new NSObject[] { new NSString("<your_user_id>"), new NSString("<your_user_name>"), new NSString("<your_user_email>"), new NSString("<your_device_id>"), new NSString("<your_device_name>"), } ); CobrowseIO.Instance().Start(); global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
private void OnShowDeviceIdClick(object sender, EventArgs e) { new AlertDialog.Builder(this) .SetTitle("Cobrowse.io ") .SetMessage($"Cobrowse.io DeviceId: {CobrowseIO.Instance().DeviceId(this.Application)}") .SetPositiveButton(global::Android.Resource.String.Yes, (sender, args) => { }) .Show(); }
private void ButtonDeviceId_TouchUpInside(object sender, EventArgs e) { var alert = new UIAlertView { Title = "Cobrowse.io", Message = $"Cobrowse.io DeviceId: {CobrowseIO.Instance().DeviceId}" }; alert.AddButton("OK"); alert.Show(); }
public override void OnCreate() { base.OnCreate(); CobrowseIO.Instance().License("trial"); Debug.WriteLine("Cobrowse device id: " + CobrowseIO.Instance().DeviceId(this)); var customData = new Dictionary <string, Java.Lang.Object>() { { CobrowseIO.UserIdKey, "<your_user_id>" }, { CobrowseIO.UserNameKey, "<your_user_name>" }, { CobrowseIO.UserEmailKey, "<your_user_email>" }, { CobrowseIO.DeviceIdKey, "<your_device_id>" }, { CobrowseIO.DeviceNameKey, "<your_device_name>" }, }; CobrowseIO.Instance().CustomData(customData); CobrowseIO.Instance().SetDelegate(new CustomCobrowseDelegate()); CobrowseIO.Instance().Start(this); }
public void EndCurrentSession() { CobrowseIO.Instance().CurrentSession()?.End(null); }