Exemplo n.º 1
0
        public UIView NewButtonClicked()
        {
            UIButton btn = new UIButton();

            btn.Frame = new CoreGraphics.CGRect(0, 0, 30f, 30f);
            btn.SetBackgroundImage(UIImage.FromFile("Images/BrowseImage.png"), UIControlState.Normal);
            btn.TouchUpInside += (sender, e) =>
            {
                // NSObject CallSender = new NSObject();
                //this.PerformSegue("kannan", CallSender);

                UINavigationController ctrl = new UINavigationController();
                ctrl.NavigationBar.BarTintColor = UIColor.FromRGB(17, 62, 105);
                ctrl.NavigationBar.TintColor    = UIColor.White;
                UIStoryboard       Storyboard1        = UIStoryboard.FromName("Main", null);
                MainViewController MainViewController = Storyboard1.InstantiateViewController("MainViewController") as MainViewController;
                this.PresentViewController(MainViewController, true, () => { });
            };

            UIView view = new UIView();

            view.Frame  = new CoreGraphics.CGRect(0, 0, btn.Frame.Size.Width, btn.Frame.Size.Width);
            view.Bounds = new CoreGraphics.CGRect(view.Bounds.X, view.Bounds.Y, view.Bounds.Width, view.Bounds.Height);
            view.AddSubview(btn);
            view.BackgroundColor = UIColor.Clear;
            return(view);
        }
Exemplo n.º 2
0
        partial void LoginButton_TouchUpInside(UIButton sender)
        {
            //Registration code here. Build your user details.
            ALUser user = new ALUser();

            user.ApplicationId = ALChatManager.application_id;
            user.UserId        = userIdTextField.Text;
            user.Password      = passwordTextField.Text;
            ALUserDefaultsHandler.SetPassword(user.Password);
            ALUserDefaultsHandler.SetUserAuthenticationTypeId((short)AuthenticationType.Applozic);

            //Applozic registartion code.
            ALRegisterUserClientService userClientService = new ALRegisterUserClientService();

            userClientService.InitWithCompletion(user, (ALRegistrationResponse response, NSError error) =>
            {
                if (error == null && response.DeviceKey != null)
                {
                    //Check for APNS deviceToken. If not done already, ask for registartion token.
                    if (String.IsNullOrEmpty(ALUserDefaultsHandler.ApnDeviceToken))
                    {
                        ALChatManager.registerNotification();
                    }

                    UIStoryboard Storyboard = UIStoryboard.FromName("Main", null);
                    MainViewController MainViewController = Storyboard.InstantiateViewController("MainViewController") as MainViewController;
                    this.PresentViewController(MainViewController, true, () => { });
                }
                else
                {
                    String description = error != null ? error.LocalizedDescription : response.Message;
                    new UIAlertView("Opps!!!", description, null, "OK", null).Show();
                }
            });
        }
Exemplo n.º 3
0
        //Preaper Your view
        public UIView GetButtonView(UIViewController controllerReference)
        {
            UIImageView imageView = new UIImageView();

            imageView.Frame           = new CoreGraphics.CGRect(0, 0, 20f, 20f);
            imageView.TintColor       = UIColor.White;
            imageView.BackgroundColor = UIColor.Red;

            UIView view = new UIView();

            view.Frame  = new CoreGraphics.CGRect(0, 0, imageView.Frame.Size.Width, imageView.Frame.Size.Width);
            view.Bounds = new CoreGraphics.CGRect(view.Bounds.X, view.Bounds.Y, view.Bounds.Width, view.Bounds.Height);
            view.AddSubview(imageView);
            view.BackgroundColor = UIColor.Clear;

            // Report touch
            Action action = () =>
            {
                //Presenting View controller with navigation
                Console.WriteLine("Custom Button selector selected");
                UIStoryboard       Storyboard1        = UIStoryboard.FromName("Main", null);
                MainViewController MainViewController = Storyboard1.InstantiateViewController("MainViewController") as MainViewController;

                ALChatViewController chatControllers = (ALChatViewController)controllerReference;

                Console.WriteLine("chatControllers #### : " + chatControllers.ContactIds);

                UINavigationController ctrl = new UINavigationController(MainViewController);
                ctrl.NavigationBar.BarTintColor = UIColor.FromRGB(17, 62, 105);
                ctrl.NavigationBar.TintColor    = UIColor.White;

                ctrl.NavigationItem.SetLeftBarButtonItem(
                    new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, (sender, e) => { }), true);

                controllerReference.PresentViewController(ctrl, true, () => { });

                ALMessageServiceWrapper messaageService = new ALMessageServiceWrapper();
                messaageService.sendMessageTextWithCompletion("Msg Text", chatControllers.ContactIds, (NSString response, NSError error) =>
                {
                    Console.WriteLine("response :" + response);
                });
            };

            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer(action);

            tapGesture.NumberOfTapsRequired = 1;
            view.AddGestureRecognizer(tapGesture);
            return(view);
        }
Exemplo n.º 4
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method


            if (ALUserDefaultsHandler.IsLoggedIn)
            {
                ALPushNotificationService.UserSync();
                // Get login screen from storyboard and present it
                UIStoryboard       Storyboard         = UIStoryboard.FromName("Main", null);
                MainViewController MainViewController = Storyboard.InstantiateViewController("MainViewController") as MainViewController;
                this.Window.MakeKeyAndVisible();
                this.Window.RootViewController.PresentViewController(MainViewController, true, () => { });
            }

            ALAppLocalNotifications localNotification = ALAppLocalNotifications.AppLocalNotificationHandler;

            localNotification.DataConnectionNotificationHandler();

            if (launchOptions != null)
            {
                NSDictionary dictionary = (Foundation.NSDictionary)launchOptions.ObjectForKey(UIApplication.LaunchOptionsRemoteNotificationKey);

                if (dictionary != null)
                {
                    Console.WriteLine(@"Launched from push notification: {0} ", dictionary);
                    ALPushNotificationService pushNotificationService = new ALPushNotificationService();
                    Boolean applozicProcessed = pushNotificationService.ProcessPushNotification(dictionary, 0);

                    if (!applozicProcessed)
                    {
                        //Note: notification for app
                    }
                }
            }

            ALChatManager.registerNotification();

            return(true);
        }