Example #1
0
        public void Init()
        {
            this.ListUIChildren = new List<UIComponent>();

            Ribbon.HEIGHT = (int)(0.2f * Render.ScreenHeight);
            Rec = new Rectangle(0, 0, (int)Render.ScreenWidth, Ribbon.HEIGHT);
            RecMenuBar = new Rectangle(Ribbon.MARGE + 100, 0, Rec.Width - 100 - Ribbon.MARGE * 2, 30);
            recBackground = new Rectangle(Rec.X, Rec.Y, Rec.Width, (int)((float)Rec.Height * 1.2f));
            vecTime = new Vector2(RecMenuBar.Left + MARGE * 4, RecMenuBar.Top + RecMenuBar.Height / 2 - Render.FontTextSmall.MeasureString("0").Y / 2);

            BPMMeter BPMMeter = new BPMMeter(this, this.UI, GetNewTimeSpan());
            BPMMeter.Init();
            this.ListUIChildren.Add(BPMMeter);

            Partition = new Partition(this, this.UI, GetNewTimeSpan());
            Partition.Init();
            this.ListUIChildren.Add(Partition);

            imgPlay = new ClickableImage(UI, this, GetNewTimeSpan(), "Play", Render.texPlay, Render.texPlay, new Vector2(BPMMeter.Rec.Right + MARGE * 2, Partition.Rec.Y + RecMenuBar.Height / 2 - Render.texPlay.Height / 2));
            imgPause = new ClickableImage(UI, this, GetNewTimeSpan(), "Pause", Render.texPause, Render.texPause, new Vector2(BPMMeter.Rec.Right + MARGE * 2, Partition.Rec.Y + RecMenuBar.Height / 2 - Render.texPause.Height / 2));
            imgPause.Visible = false;
            imgStop = new ClickableImage(UI, this, GetNewTimeSpan(), "Stop", Render.texStop, Render.texStop, new Vector2(BPMMeter.Rec.Right + MARGE * 3 + Render.texPlay.Width, Partition.Rec.Y + RecMenuBar.Height / 2 - Render.texStop.Height / 2));

            imgPlay.ClickImage += new ClickableImage.ClickImageHandler(imgPlay_ClickImage);
            imgPause.ClickImage += new ClickableImage.ClickImageHandler(imgPause_ClickImage);
            imgStop.ClickImage += new ClickableImage.ClickImageHandler(imgStop_ClickImage);

            this.ListUIChildren.Add(imgPlay);
            this.ListUIChildren.Add(imgPause);
            this.ListUIChildren.Add(imgStop);
        }
        internal ImagePicker(DiscordAsset[] assets)
        {
            this.InitializeComponent();

            for (Int32 i = 0; i < assets.Length; ++i)
            {
                ClickableImage image = new ClickableImage(assets[i]);
                image.MouseDoubleClick += this.OnImageDoubleClick;
                this.WrapPanel.Children.Add(image);
            }
        }
Example #3
0
 /// <summary>
 /// Handle tap on element and call ShowFullSizeImage() method from <see cref="ClickableImage" /> class.
 /// </summary>
 protected override void OnElementChanged(ElementChangedEventArgs <Image> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement != null)
     {
         _formsElement  = e.NewElement as ClickableImage;
         _nativeElement = Control as UIImageView;
         _nativeElement.UserInteractionEnabled = true;
         var clickGestureRecognizer = new UITapGestureRecognizer(ShowFullSizeImage);
         _nativeElement.AddGestureRecognizer(clickGestureRecognizer);
     }
 }
Example #4
0
        /// <summary>
        /// Set up our grid control for the packs we have to open
        /// </summary>
        protected override void AddInitialUI()
        {
            base.AddInitialUI();

            float gridHeight = ScreenDimensions.Y * 0.25f;

            PacksGridControl = AddScreenUIObject(new GridControl(8, new Vector2(ScreenDimensions.X, gridHeight), new Vector2(ScreenCentre.X, ScreenDimensions.Y - gridHeight * 0.5f)));
            for (int i = 0; i < PlayerDataRegistry.Instance.PlayerData.AvailablePacksToOpen; i++)
            {
                ClickableImage cardPack = PacksGridControl.AddChild(new ClickableImage(new Vector2(gridHeight * 0.8f), Vector2.Zero, Card.CardBackTextureAsset));
                cardPack.ClickableModule.OnLeftClicked += OnPackLeftClicked;
            }
        }
Example #5
0
        internal DetailContextManager(StandardLevelDetailViewController standardLevelDetailViewController)
        {
            _standardLevelDetailViewController = standardLevelDetailViewController;

            var detailView = Accessors.DetailView(ref standardLevelDetailViewController);
            var levelBar   = Accessors.LevelBar(ref detailView);
            var artwork    = Accessors.Artwork(ref levelBar);

            // Upgrade the ImageView
            var clickable = artwork.Upgrade <ImageView, ClickableImage>();

            Accessors.Artwork(ref levelBar) = clickable;
            _artworkImage = clickable;
        }
Example #6
0
    /// <summary>
    /// Method called on application start
    /// </summary>
    private void Awake()
    {
        ARCanvas._actualARCanvas = this;

        this._placementController = PlacementControllerGO.GetComponent <PlacementController>();

        this._dialogWindow                = this.GetComponentInChildren <DialogWindow>(true);
        this._circleController            = this.GetComponentInChildren <CircleController>(true);
        this._precisePoistioningComponent = this.GetComponentInChildren <PrecisePositioningComponent>(true);

        var waitingForSurfaceLabelGO = this.transform.Find("WaitingForSurfaceLabel").gameObject;

        var backButtonGO                   = this.transform.Find("BackButton").gameObject;
        var pickUpButtonGO                 = this.transform.Find("PickUpModelButton").gameObject;
        var showDoorsButtonGO              = this.transform.Find("ShowDoorsButton").gameObject;
        var hideDoorButtonGO               = this.transform.Find("HideDoorsButton").gameObject;
        var showCoversButtonGO             = this.transform.Find("ShowCoversButton").gameObject;
        var hideCoversButtonGO             = this.transform.Find("HideCoversButton").gameObject;
        var showPrecisePositioningButtonGO = this.transform.Find("ShowPreciseButton").gameObject;
        var hidePrecisePositioningButtonGO = this.transform.Find("HidePreciseButton").gameObject;

        var loadingPageGO = this.transform.Find("LoadingPage").gameObject;

        this._scaleLabelGO = this.transform.Find("ScaleLabel").gameObject;
        var scaleLabelTextGO = _scaleLabelGO.transform.Find("Label").gameObject;

        this._waitingForSurfaceLabel = waitingForSurfaceLabelGO.GetComponent <TextMeshProUGUI>();

        this._goBackButton                 = backButtonGO.GetComponent <ClickableImage>();
        this._pickUpModelButton            = pickUpButtonGO.GetComponent <ClickableImage>();
        this._showDoorsButton              = showDoorsButtonGO.GetComponent <ClickableImage>();
        this._hideDoorsButton              = hideDoorButtonGO.GetComponent <ClickableImage>();
        this._showCoversButton             = showCoversButtonGO.GetComponent <ClickableImage>();
        this._hideCoversButton             = hideCoversButtonGO.GetComponent <ClickableImage>();
        this._showPrecisePositioningButton = showPrecisePositioningButtonGO.GetComponent <ClickableImage>();
        this._hidePrecisePositioningButton = hidePrecisePositioningButtonGO.GetComponent <ClickableImage>();

        this._loadingPage = loadingPageGO.GetComponent <LoadingPage>();

        this._waitingForSurfaceLabel.text = Translator.GetTranslation("WaitingForSurfaceLabel.ContentText");

        this._scaleLabelText = scaleLabelTextGO.GetComponent <TextMeshProUGUI>();

        this._scaleLabelText.text = _getScaleLabelTranslationText();

        //Disable screen dimming
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
    }
Example #7
0
    void Awake()
    {
        this._hidePageButtonGO = this.transform.Find("HidePageButton").gameObject;
        this._labelGO          = this.transform.Find("Label").gameObject;
        this._separatorGO      = this.transform.Find("Separator").gameObject;

        this._hidePageButtonRectTrans = _hidePageButtonGO.GetComponent <RectTransform>();
        this._labelRectTrans          = _labelGO.GetComponent <RectTransform>();
        this._separatorRectTrans      = _separatorGO.GetComponent <RectTransform>();

        this._hidePageButton = _hidePageButtonGO.GetComponent <ClickableImage>();
        this._label          = _labelGO.GetComponent <TextMeshProUGUI>();
        this._separator      = _separatorGO.GetComponent <Image>();

        this._hidePageButton.OnClick.AddListener(_handleHidePageButtonClicked);
    }
        /// <summary>
        /// Add our final deck images - do this here so that all the sizes are calculated
        /// </summary>
        public override void Begin()
        {
            foreach (Deck deck in Array.FindAll(PlayerDataRegistry.Instance.Decks, x => x.IsCreated))
            {
                ClickableImage deckUI = AddChild(new ClickableImage(Vector2.Zero, Card.CardBackTextureAsset), true, true);
                deckUI.StoredObject = deck;

                // A lot of these will be unused but it will avoid bugs down the road if we just do this in case they are used
                deckUI.ClickableModule.OnLeftClicked         += OnLeftClicked;
                deckUI.ClickableModule.OnMiddleClicked       += OnMiddleClicked;
                deckUI.ClickableModule.OnRightClicked        += OnRightClicked;
                deckUI.ClickableModule.LeftClickAccelerator   = LeftClickAccelerator;
                deckUI.ClickableModule.MiddleClickAccelerator = MiddleClickAccelerator;
                deckUI.ClickableModule.RightClickAccelerator  = RightClickAccelerator;
            }

            base.Begin();
        }
Example #9
0
    //ITEM DEPENDS ON SIZE AFTER UI SCALING - SO METHODS MUST BE INVOKED AFTER SCALING (IN START), AWAKE IS USED TO SET UP REFERENCES
    private void Awake()
    {
        _circleGO        = this.transform.Find("Circle").gameObject;
        _circleRectTrans = _circleGO.GetComponent <RectTransform>();

        _indicatorGO            = _circleGO.transform.Find("Indicator").gameObject;
        _indicator              = _indicatorGO.GetComponent <CircleControllerIndicator>();
        _indicatorRectTransform = _indicatorGO.GetComponent <RectTransform>();

        _indicator.DragHandler = _handleIndicatorDrag;

        _middleButtonGO = _circleGO.transform.Find("MiddleButton").gameObject;

        _middleButton = _middleButtonGO.GetComponent <ClickableImage>();
        _middleButtonRectTransform = _middleButtonGO.GetComponent <RectTransform>();

        _middleButton.OnClick = _middleButtonClicked;
    }
Example #10
0
    private void Awake()
    {
        this._languageButtonGO = transform.Find("LanguageButton").gameObject;
        this._helpButtonGO     = transform.Find("HelpButton").gameObject;

        this._languageButton = _languageButtonGO.GetComponent <ClickableImage>();
        this._helpButton     = _helpButtonGO.GetComponent <ClickableImage>();

        var loginComponent = transform.Find("LoginComponent").gameObject;

        this._loginInputGO    = loginComponent.transform.Find("LoginInput").gameObject;
        this._passwordInputGO = loginComponent.transform.Find("PasswordInput").gameObject;
        this._loginButtonGO   = loginComponent.transform.Find("LoginButton").gameObject;
        this._mainLabelGO     = loginComponent.transform.Find("MainLabel").gameObject;
        this._demoButtonGO    = transform.Find("DemoButton").gameObject;

        var loginInputTextArea = _loginInputGO.transform.Find("Text Area").gameObject;

        _loginInputPlaceholderGO = loginInputTextArea.transform.Find("Placeholder").gameObject;

        var passwordInputTextArea = _passwordInputGO.transform.Find("Text Area").gameObject;

        _passwordInputPlaceholderGO = passwordInputTextArea.transform.Find("Placeholder").gameObject;

        this._loginInput    = _loginInputGO.GetComponent <TMP_InputField>();
        this._passwordInput = _passwordInputGO.GetComponent <TMP_InputField>();
        this._loginButton   = _loginButtonGO.GetComponent <LoginButton>();
        this._mainLabel     = _mainLabelGO.GetComponent <TextMeshProUGUI>();
        this._demoButton    = _demoButtonGO.GetComponent <DemoButton>();

        this._loginInputPlaceholder    = _loginInputPlaceholderGO.GetComponent <TextMeshProUGUI>();
        this._passwordInputPlaceholder = _passwordInputPlaceholderGO.GetComponent <TextMeshProUGUI>();

        this._loginButton.OnClick.AddListener(_handleLoginButtonClicked);
        this._demoButton.OnClick.AddListener(_handleDemoButtonClicked);
        this._helpButton.OnClick.AddListener(_handleHelpButtonClicked);

        this._languageButton.OnClick.AddListener(_handleLanguageButtonClicked);
    }
        /// <summary>
        /// Set up our buttons for the campaign thumbnails
        /// </summary>
        protected override void AddInitialUI()
        {
            base.AddInitialUI();

            MissionGridControl = AddScreenUIObject(new GridControl(4, new Vector2(ScreenDimensions.X * 0.5f, ScreenDimensions.Y), new Vector2(ScreenCentre.X * 0.5f, ScreenCentre.Y)));
            MissionGridControl.Padding = new Vector2(60, 60);

            List<MissionData> allMissionData = AssetManager.GetAllDataOfType<MissionData>();
            foreach (MissionData missionData in allMissionData)
            {
                ClickableImage clickImage = MissionGridControl.AddChild(new ClickableImage(Vector2.Zero, missionData.MissionThumbnailTextureAsset));
                clickImage.ClickableModule.OnLeftClicked += OnMissionLeftClicked;
                clickImage.StoredObject = missionData;

                if (missionData.MissionNumber > PlayerDataRegistry.Instance.PlayerData.CurrentLevel)
                {
                    clickImage.Hide();
                }
            }

            CurrentSelectedMission = AddScreenUIObject(new MissionInfoImage(allMissionData[PlayerDataRegistry.Instance.PlayerData.CurrentLevel - 1]));
        }
Example #12
0
        void Awake()
        {
            lux = LuxManager.Instance;
            lux.onStarted.AddListener(() =>
            { // Update UI once
                MainSection.UpdateUI();
                SettingsSection.UpdateUI();
                isUpdating = true;
            });

            lux.onStopped.AddListener(() =>
            {
                isUpdating = false;
            });


            mb_fio = ModalBackground.GetComponent <FadeInOutUI>();
            mb_ci  = ModalBackground.GetComponent <ClickableImage>();
            mb_ci.onClick.AddListener(() =>
            {
                HideModalView(); // can refactor here, decouple from specifically SettingsUIController
            });
            mb_fio.FadeOut(true);
        }
Example #13
0
        public void InitializeControls()
        {
            MainStackLayout = new StackLayout
            {
                Padding = 0,
                Spacing = 1,
            };

            azkarStackLayout = new StackLayout
            {
                Padding = 0,
                Spacing = 1,
            };

            mistakesStackLayout = new StackLayout
            {
                Padding = 0,
                Spacing = 1,
            };

            ahkamStackLayout = new StackLayout
            {
                Padding = 0,
                Spacing = 1,
            };

            virtueStackLayout = new StackLayout
            {
                Padding = 0,
                Spacing = 1,
            };
            /////////////////////////////////////////////////////
            // Image of place and description
            /////////////////////////////////////////////////////
            imgMedia = new Image
            {
                Source            = postData.GetImageUri(),
                Aspect            = Aspect.Fill,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };

            imgMapPlaceIcon = new ClickableImage
            {
                Source          = PLACE_MAP_ICON_URI,
                VerticalOptions = LayoutOptions.Start,
                TranslationY    = -30,
                Scale           = .9,
            };

            imgMapViewIcon = new ClickableImage
            {
                Source            = MAP_VIEW_ICON_URI,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Start,
                TranslationX      = -10,
                TranslationY      = 10,
                IsVisible         = false,
                Scale             = .8,
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                imgMapPlaceIcon.Scale        = .45;
                imgMapPlaceIcon.TranslationY = -72;
                imgMapViewIcon.Scale         = .45;

                imgMapViewIcon.TranslationX = +5;
                imgMapViewIcon.TranslationY = -5;
            }

            imgMapPlaceIcon.Clicked += ImgMapPlaceIcon_Clicked;
            imgMapViewIcon.Clicked  += ImgMapViewIcon_Clicked;


            lblPlaceTitle = new Label()
            {
                Text            = postData.Title,
                VerticalOptions = LayoutOptions.FillAndExpand,
                XAlign          = TextAlignment.End,
                YAlign          = TextAlignment.Start,
                FontSize        = ZadSpecialDesigen.GetFontSizeOfTitle(),
                TextColor       = ZadSpecialDesigen.ZadGreen,
                //BackgroundColor = ZadSpecialDesigen.ZadWhite,
            };
            lblPlaceDescription = new Label()
            {
                Text            = postData.Description,
                VerticalOptions = LayoutOptions.FillAndExpand,
                FontSize        = ZadSpecialDesigen.GetFontSizeOfTitle(),
                XAlign          = TextAlignment.End,
                YAlign          = TextAlignment.Start,
                TextColor       = ZadSpecialDesigen.GetTextColorOfDescription(),
                //BackgroundColor = Color.FromHex("#F3F7F8"),////
            };

            gridMedia = new Grid()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowSpacing        = 0,
                ColumnSpacing     = 0,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(250, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                BackgroundColor = Color.FromHex("#F3F7F8"),
            };

            var stackDescription = new StackLayout()
            {
                Padding         = ZadSpecialDesigen.GetPaddingOfDescription(),
                BackgroundColor = Color.FromHex("#F3F7F8"),////
            };

            stackDescription.VerticalOptions = LayoutOptions.Fill;
            //stackDescription.HorizontalOptions = LayoutOptions.FillAndExpand;
            stackDescription.Children.Add(lblPlaceTitle);
            stackDescription.Children.Add(lblPlaceDescription);

            //// image for loading status which apper under the media image and it will be disappear when the image media cove over it.
            gridMedia.Children.Add(new StackLayout
            {
                Padding           = 100,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Children          = { new Image {
                                          Source = DEFAULT_LOADING_IMAGE,
                                      } },
            }, 0, 0);

            gridMedia.Children.Add(imgMedia, 0, 0);
            gridMedia.Children.Add(imgMapViewIcon, 0, 0);
            gridMedia.Children.Add(stackDescription, 0, 1);
            gridMedia.Children.Add(imgMapPlaceIcon, 0, 1);

            MainStackLayout.Children.Add(gridMedia);
            MainStackLayout.Children.Add(azkarStackLayout);
            MainStackLayout.Children.Add(mistakesStackLayout);
            MainStackLayout.Children.Add(ahkamStackLayout);
            MainStackLayout.Children.Add(virtueStackLayout);


            /////////////////////////////////////////////////////
            ///////     Related Post Layout
            /////////////////////////////////////////////////////
            FillRelatedPostsLayout(PostType.Place);

            /////////////////////////////////////////////////////
            ///////     Footer toolBar Area
            /////////////////////////////////////////////////////
            imgAzkar = new ClickableImage {
                Source = AZKAR_FOOTER_ICON_URI,
            };
            imgAhkam = new ClickableImage {
                Source = AHKAM_FOOTER_ICON_URI,
            };
            imgMistakes = new ClickableImage {
                Source = MISTAKES_FOOTER_ICON_URI,
            };
            imgVirtue = new ClickableImage {
                Source = VIRTUE_FOOTER_ICON_URI
            };
            imgFavorite = new ClickableImage {
                Source = Helper.GetUnFavoriteIconUri()
            };

            imgAzkar.Clicked    += ImgAzkar_Clicked;
            imgAhkam.Clicked    += ImgAhkam_Clicked;
            imgMistakes.Clicked += ImgMistakes_Clicked;
            imgVirtue.Clicked   += ImgVirtue_Clicked;
            imgFavorite.Clicked += ImgFavorite_Clicked;

            if (!azkar.HasData())
            {
                imgAzkar.Disabled = true;
            }

            if (!mistakes.HasData())
            {
                imgMistakes.Disabled = true;
            }

            if (!ahkam.HasData())
            {
                imgAhkam.Disabled = true;
            }

            if (!virtue.HasData())
            {
                imgVirtue.Disabled = true;
            }

            gridToolBar = new Grid()
            {
                ColumnSpacing     = 20,
                Padding           = 5,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(.20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(.20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(.20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(.20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(.20, GridUnitType.Star)
                    },
                },
                BackgroundColor = Color.FromHex("#189597"),
            };

            gridToolBar.Children.Add(imgAzkar, 0, 0);
            gridToolBar.Children.Add(imgAhkam, 1, 0);
            gridToolBar.Children.Add(imgMistakes, 2, 0);
            gridToolBar.Children.Add(imgVirtue, 3, 0);
            gridToolBar.Children.Add(imgFavorite, 4, 0);
        }
Example #14
0
 void imgStop_ClickImage(ClickableImage image, MouseState mouseState, GameTime gameTime)
 {
     GamePlay.Stop();
 }
Example #15
0
 void imgPlay_ClickImage(ClickableImage image, MouseState mouseState, GameTime gameTime)
 {
     GamePlay.Play();
 }
Example #16
0
        public void UpdateScrollbar()
        {
            //--- Charge les boutons
            if (countMaxItem < CountItem)
            {
                ClickableImage imgUp = new ClickableImage(UI, this, GetNewTimeSpan(), "ArrowUp", GetIcon("ArrowUp"), GetIcon("ArrowUp"), new Vector2(Rec.Right - GetIcon("ArrowUp").Width, Rec.Top));
                imgUp.ClickImage += new ClickableImage.ClickImageHandler(imgUp_ClickImage);
                ListUIChildren.Add(imgUp);

                ClickableImage imgDown = new ClickableImage(UI, this, GetNewTimeSpan(), "ArrowDown", GetIcon("ArrowDown"), GetIcon("ArrowDown"), new Vector2(Rec.Right - GetIcon("ArrowUp").Width, Rec.Bottom - GetIcon("ArrowUp").Height));
                imgDown.ClickImage += new ClickableImage.ClickImageHandler(imgDown_ClickImage);
                ListUIChildren.Add(imgDown);

                foreach (UIComponent ui in ListUIChildren)
                {
                    if (ui is ClickableText)
                    {
                        ui.Rec = new Rectangle(Rec.X + MARGE, ui.Rec.Y, Rec.Width - 2 * MARGE - imgUp.Width, ui.Rec.Height);
                    }
                }
            }
            //---

            Sort();
        }
        protected async void InitializeControls()
        {
            Image imgMedia;
            Label lblDescription;
            Grid  gridTextLayout;
            Grid  gridToolBar;
            Grid  gridMedia;

            /////////////////////////////////////////////////////
            // Media Area show media wheather it's video or image
            /////////////////////////////////////////////////////
            string imageUri = postData.GetImageUri();

            imgMedia = new Image
            {
                Aspect            = Aspect.AspectFit,
                Source            = imageUri,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = ZadSpecialDesigen.DefaultNoneImageColor,
            };

            // /*////////////////////////////////////////////////////////////////////////////////////////


            gridMedia = new Grid()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ColumnSpacing     = 0,
                RowSpacing        = 0,
                BackgroundColor   = Color.Black,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        BindingContext = new GridLength(1, GridUnitType.Star)
                    }
                },
            };

            /// if media type is audio or video initialize webview with source
            if (postData.DataType == DataType.Video || postData.DataType == DataType.Audio)
            {
                if (webViewPlayer == null) //for first time
                {
                    webViewPlayer = new WebView
                    {
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Source            = await GetHTMLWebViewSource(),
                    };
                }
                else
                {
                    webViewPlayer.Source = await GetHTMLWebViewSource();
                }

                var webStackLayout = new StackLayout
                {
                    BackgroundColor = Color.Black,
                    Children        = { webViewPlayer },
                };
                gridMedia.Children.Add(webStackLayout);
            }
            else
            {
                gridMedia.Children.Add(imgMedia);
            }

            /////////////////////////////////////////////////////
            // Text Area for title and description (Paragraph)
            /////////////////////////////////////////////////////

            lblDescription = new Label()
            {
                Text            = postData.Description,
                FontSize        = ZadSpecialDesigen.GetFontSizeOfDescription(),
                XAlign          = TextAlignment.End,
                YAlign          = TextAlignment.Start,
                TextColor       = Color.FromHex("#666666"),
                BackgroundColor = Color.White
            };
            StackLayout descriptionLayout = new StackLayout
            {
                Padding = ZadSpecialDesigen.GetPaddingOfDescription(),
            };

            descriptionLayout.Children.Add(lblDescription);

            gridTextLayout = new Grid()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowSpacing        = 0,
                ColumnSpacing     = 0,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                BackgroundColor = Color.White
            };

            gridTextLayout.Children.Add(
                new TitleIconStackLayout(postData.Title, this.TitleIconUri, Color.FromHex("#F0F4F5"), Color.FromHex("#19716B"))
                , 0, 0);
            gridTextLayout.Children.Add(descriptionLayout, 0, 1);

            /////////////////////////////////////////////////////
            // Footer ToolBar Area for shared and favorite
            /////////////////////////////////////////////////////
            var imgShare = new ClickableImage {
                Source = DEFAULT_ICON_SHARE,
            };

            imgFavorite = new ClickableImage {
                Source = Helper.GetUnFavoriteIconUri(),
            };

            imgShare.Clicked    += ImgShare_Clicked;
            imgFavorite.Clicked += ImgFavorite_Clicked;

            gridToolBar = new Grid()
            {
                RowSpacing      = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(.1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(.1, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(30, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(20, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(30, GridUnitType.Star)
                    },
                },
                BackgroundColor = Color.FromHex("#199595"),
            };

            gridToolBar.Children.Add(imgFavorite, 1, 1);
            gridToolBar.Children.Add(imgShare, 2, 1);

            ////////////////////////////////////////////////////////////
            ///////////////////// Main grid //////////////////////////
            //////////////////////////////////////////////////////////
            var scrollview = new ScrollView
            {
                Content = gridTextLayout,
            };

            Grid MainGrid = new Grid()
            {
                Padding           = new Thickness(0, -6, 0, 0),
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                ColumnSpacing     = 0,
                RowSpacing        = 0,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(0.46, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(0.46, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(0.08, GridUnitType.Star)
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            MainGrid.Children.Add(gridMedia, 0, 0);
            MainGrid.Children.Add(scrollview, 0, 1);
            MainGrid.Children.Add(gridToolBar, 0, 2);

            base.MainBodyScrollView.IsVisible = false;
            base.MainForAdjDataView.Children.Add(MainGrid);
            base.MainForAdjDataView.Padding = 0;
            base.MainForAdjDataView.Spacing = 0;


            if (postData.Description == null || postData.Description == "") // no content
            {
                gridTextLayout.Children.Add(Helper.NoContentLable);
            }
        }
Example #18
0
        void imgDown_ClickImage(ClickableImage image, Microsoft.Xna.Framework.Input.MouseState mouseState, GameTime gameTime)
        {
            ScrollValue -= (int)sizeText.Y;

            int scrollMinValue = (int)Math.Min(0, -(CountItem + 1 - countMaxItem) * sizeText.Y);

            if (ScrollValue < scrollMinValue)
                ScrollValue = scrollMinValue;

            UpdateScrollValue();
        }
Example #19
0
        void imgUp_ClickImage(ClickableImage image, Microsoft.Xna.Framework.Input.MouseState mouseState, GameTime gameTime)
        {
            ScrollValue += (int)sizeText.Y;

            if (ScrollValue > 0)
                ScrollValue = 0;

            UpdateScrollValue();
        }