Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(239, 239, 244);

            InternetButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnterpriseButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);

            InternetButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            InternetButton.Layer.ShadowOffset  = new SizeF(0, 1);
            InternetButton.Layer.ShadowOpacity = 0.3f;

            EnterpriseButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            EnterpriseButton.Layer.ShadowOffset  = new SizeF(0, 1);
            EnterpriseButton.Layer.ShadowOpacity = 0.3f;

            var set = this.CreateBindingSet <NewAccountView, NewAccountViewModel>();

            set.Bind(EnterpriseButton).To(x => x.GoToEnterpriseLoginCommand);
            set.Bind(InternetButton).To(x => x.GoToDotComLoginCommand);
            set.Apply();

            ScrollView.ContentSize = new SizeF(View.Bounds.Width, EnterpriseButton.Frame.Bottom + 10f);
        }
Example #2
0
        public async Task EndGame()
        {
            gameRunning = false;

            ClearPlayerEntry();
            OnPropertyChanged("ActionText");
            OnPropertyChanged("ActionColor");
            await InternetButton.UnsubscribeToEventsWithIdAsync(gameCheckGuid);

            gameId = "";
        }
        public async Task StartGame()
        {
            playerEntry   = "";
            gameCheckGuid = await InternetButton.SubscribeToEventsWithPrefixAsync("SimonSays", GameHandler);

            //if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
            if (Device.OS != TargetPlatform.Windows)
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    var notificator = DependencyService.Get <IToastNotificator>();
                    notificator.Notify(ToastNotificationType.Success,
                                       $"{InternetButton.Name} Says:", "Better bring your A game!!", TimeSpan.FromSeconds(1));
                });
            }

            var success = await InternetButton.CallFunctionAsync("startSimon");

            if (success == "Timed out.")
            {
                //if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
                if (Device.OS != TargetPlatform.Windows)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        var notificator = DependencyService.Get <IToastNotificator>();
                        notificator.Notify(ToastNotificationType.Success,
                                           $"{InternetButton.Name} Died", "But I'll come back to life!!", TimeSpan.FromSeconds(1));
                    });
                }
            }
            gameRunning = true;

            await Task.Delay(500);

            var simonParticle = await InternetButton.GetVariableAsync("simon");

            simonMoves = simonParticle.Result.ToString();

            Random rand = new Random();

            for (var i = 0; i < 10; i++)
            {
                gameId += rand.Next(0, 9);
            }
        }
Example #4
0
        void ReleaseDesignerOutlets()
        {
            if (EnterpriseButton != null)
            {
                EnterpriseButton.Dispose();
                EnterpriseButton = null;
            }

            if (InternetButton != null)
            {
                InternetButton.Dispose();
                InternetButton = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }
        }
Example #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            InternetButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnterpriseButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);

            InternetButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            InternetButton.Layer.ShadowOffset  = new SizeF(0, 1);
            InternetButton.Layer.ShadowOpacity = 0.3f;

            EnterpriseButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            EnterpriseButton.Layer.ShadowOffset  = new SizeF(0, 1);
            EnterpriseButton.Layer.ShadowOpacity = 0.3f;

            InternetButton.TouchUpInside   += InternetButtonClicked;
            EnterpriseButton.TouchUpInside += EnterpriseButtonClicked;

            ScrollView.ContentSize = new SizeF(View.Bounds.Width, EnterpriseButton.Frame.Bottom + 10f);
        }
Example #6
0
        async Task PerformAction()
        {
            if (!gameRunning)
            {
                //Start game
                gameRunning = true;
                OnPropertyChanged("ActionText");
                OnPropertyChanged("ActionColor");
                await StartGame();
            }
            else
            {
                var result = await InternetButton.CallFunctionAsync("buttonPress", playerEntry);

                if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
                {
                    if (result == "1")
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            var notificator = DependencyService.Get <IToastNotificator>();
                            notificator.Notify(ToastNotificationType.Success,
                                               $"{InternetButton.Name} Says:", "You got that one right....", TimeSpan.FromSeconds(2));
                        });
                    }
                    else if (result == "-1")
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            var notificator = DependencyService.Get <IToastNotificator>();
                            notificator.Notify(ToastNotificationType.Warning,
                                               $"{InternetButton.Name} Says:", "Don't interrupt my masterpiece!!!", TimeSpan.FromSeconds(1));
                        });
                    }
                }

                ClearPlayerEntry();
            }
        }
Example #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(239, 239, 244);

            InternetButton.SetBackgroundImage(Images.Buttons.GreyButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);
            EnterpriseButton.SetBackgroundImage(Images.Buttons.BlackButton.CreateResizableImage(new UIEdgeInsets(18, 18, 18, 18)), UIControlState.Normal);

            InternetButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            InternetButton.Layer.ShadowOffset  = new SizeF(0, 1);
            InternetButton.Layer.ShadowOpacity = 0.3f;
            InternetButton.TouchUpInside      += (sender, e) => ViewModel.GoToDotComLoginCommand.ExecuteIfCan();

            EnterpriseButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            EnterpriseButton.Layer.ShadowOffset  = new SizeF(0, 1);
            EnterpriseButton.Layer.ShadowOpacity = 0.3f;

            EnterpriseButton.TouchUpInside += (sender, e) => GoToEnterprise();

            ScrollView.ContentSize = new SizeF(View.Bounds.Width, EnterpriseButton.Frame.Bottom + 10f);
        }