예제 #1
0
            private readonly UseBoardViewController useBoardViewController; // Context this was create from to access it's member variables

            ///
            ///
            ///     Constructor assigns Context this was called from to a variable
            ///         and chains all handlers to corresponding event
            ///
            ///
            public SetupBoardAndSfkanban(UseBoardViewController _useboardActivity)
            {
                useBoardViewController = _useboardActivity;

                setupBoardAndSfKanban += GetRefToSfKanbanFromResource;
                setupBoardAndSfKanban += GetRefToBoardFromAssetsManager;
                setupBoardAndSfKanban += InitSfKanbanWorkflow;
                setupBoardAndSfKanban += InitSfKanbanColorKey;
                setupBoardAndSfKanban += InitSfKanbanGestures;
                // Initializing our kanbanModels to new collection each time we run this activity
                setupBoardAndSfKanban += delegate { UseBoardViewController.kanbanModels = new List <KanbanModel>(); };
                // If we have board data to load... load it, otherwise skip
                setupBoardAndSfKanban += delegate { loadPreExistingBoardData?.Invoke(); };
            }
예제 #2
0
        public static UIView MakeDialog(string _type, UIViewController _callerInstance, CreateSolitiareType createSolitiareType)
        {
            callerInstance = _callerInstance;

            dialogContainer = new UIView(callerInstance.View.Bounds);
            dialogContainer.UserInteractionEnabled = true;
            dialogContainer.BackgroundColor        = UIColor.Clear;

            var backgroundBtn = new UIButton()
            {
                Frame           = callerInstance.View.Bounds,
                BackgroundColor = UIColor.Gray
            };

            backgroundBtn.BackgroundColor = UIColor.FromWhiteAlpha(0.1f, 0.9f);
            backgroundBtn.TouchUpInside  += delegate {
                dialogContainer.RemoveFromSuperview();
            };
            var dialogContent = new UIView()
            {
                Frame = MakeDialogContentFrame()
            };
            var nameField = new UITextField()
            {
                Frame                  = new CGRect(dialogContent.Bounds.Width / 2 - 150, 50, 300, 40),
                BorderStyle            = UITextBorderStyle.RoundedRect,
                Placeholder            = _type + " Name",
                UserInteractionEnabled = true
            };
            var descriptionField = new UITextField()
            {
                Frame       = new CGRect(dialogContent.Bounds.Width / 2 - 150, 110, 300, 40),
                BorderStyle = UITextBorderStyle.RoundedRect,
                Placeholder = _type + " Description"
            };
            var cancelBtn = new UIButton(dialogContent.Bounds)
            {
                Frame = new CGRect(descriptionField.Frame.X + 10, descriptionField.Frame.Y + 60, 70, 40)
            };

            cancelBtn.SetTitleColor(UIColor.White, UIControlState.Normal);
            cancelBtn.SetTitle("Cancel", UIControlState.Normal);
            cancelBtn.TouchUpInside += delegate {
                dialogContainer.RemoveFromSuperview();
            };
            var addBtn = new UIButton()
            {
                Frame = new CGRect(descriptionField.Frame.Width - 70, descriptionField.Frame.Y + 60, 70, 40)
            };

            addBtn.SetTitleColor(UIColor.White, UIControlState.Normal);
            addBtn.SetTitle("Add", UIControlState.Normal);
            addBtn.TouchUpInside += delegate {
                switch (createSolitiareType)
                {
                case CreateSolitiareType.CreateBoard:
                    CreateBoard(nameField.Text.Trim(), descriptionField.Text);
                    break;

                case CreateSolitiareType.CreateDeck:
                    CreateDeck(nameField.Text.Trim(), descriptionField.Text);
                    break;

                case CreateSolitiareType.CreateCard:



                    //CreateCard(nameField.Text.Trim(), descriptionField.Text.Trim(), );
                    break;
                }
            };

            if (createSolitiareType == CreateSolitiareType.CreateCard)
            {
                //Label to show what deck is selected
                UILabel deckLabel = new UILabel(
                    new CGRect(dialogContent.Bounds.Width / 2 - 150, descriptionField.Frame.Y + 60, 300, 40)

                    );
                deckLabel.Text = "testing one two three";
                deckLabel.Layer.MasksToBounds = true;
                deckLabel.Layer.CornerRadius  = 4;
                deckLabel.BackgroundColor     = UIColor.White;
                //Makes the picker view
                UIPickerView deckPicker = new UIPickerView(
                    new CGRect(
                        dialogContent.Bounds.Width / 2 - 150, 170, 300, 40
                        )
                    );
                //Has to get where its being called from and what board to view to look at
                //decks assigned to the board
                UseBoardViewController useboard = (UseBoardViewController)callerInstance;
                deckPicker.Model = new DeckPickerModel(deckLabel, useboard.thisBoard.Decks);

                //Add new views to the dialog content.
                dialogContent.AddSubviews(deckLabel, deckPicker);


                //Moves the buttons down due to deckLabel taking their previous place.
                addBtn.Frame    = new CGRect(descriptionField.Frame.Width - 70, deckLabel.Frame.Y + 60, 70, 40);
                cancelBtn.Frame = new CGRect(descriptionField.Frame.X + 10, deckLabel.Frame.Y + 60, 70, 40);
            }

            var dialogLabel = new UILabel()
            {
                Frame     = new CGRect(nameField.Frame.X, nameField.Frame.Y - 50, 100, 40),
                Text      = "Add " + _type,
                TextColor = UIColor.White
            };

            dialogContent.AddSubviews(dialogLabel, nameField, descriptionField, cancelBtn, addBtn);
            dialogContainer.AddSubviews(backgroundBtn, dialogContent);

            return(dialogContainer);
        }