Beispiel #1
0
        public void UpdatePage()
        {
            //-- Background
            TestingEditor.Page auxPage = taleManager.CurrentPage;


            if (auxPage.Background != null)
            {
                String background    = auxPage.Background;
                int    tamBackground = background.Length;
                if (tamBackground > 0)
                {
                    String p = background.Substring(tamBackground - 4);
                    if (p.Contains("."))
                    {
                        String pathBackgroundPage = auxPage.Background;
                        imgBackgroundPage.Source              = Utils.GetBitmapFromUri(pathBackgroundPage, UriKind.Absolute);
                        imgBackgroundPage.Stretch             = Stretch.UniformToFill;
                        imgBackgroundPage.HorizontalAlignment = HorizontalAlignment.Center;
                        imgBackgroundPage.VerticalAlignment   = VerticalAlignment.Center;
                    }

                    if (background.Contains("#"))
                    {
                        var bc = new BrushConverter();
                        grdPage.Background = (Brush)bc.ConvertFrom(background);
                    }
                }
            }


            //-- PICTOGRAMAS ----
            for (int i = 0; i < 10; i++)
            {
                label[i].Content = "";
                image[i].Source  = null;
            }


            foreach (Pictogram pictogram in auxPage.Pictograms)
            {
                int i = pictogram.Index;
                label[i].Content = pictogram.TextToRead;

                String path = pictogram.ImageName;
                image[i].Source = Utils.GetBitmapFromUri(path, UriKind.Absolute);

                EditBorder(borderImage[i], pictogram.getColorByType(pictogram.Type), 6);
            }


            for (int i = 0; i < 10; i++)
            {
                if (label[i].Content == null || image[i].Source == null)
                {
                    grid[i].Visibility = Visibility.Hidden;
                }
            }
        }
Beispiel #2
0
        private void UpdatePageGUI()
        {
            grdPage.Background       = Brushes.WhiteSmoke;
            imgPageBackground.Source = null;

            for (int i = 0; i < 10; i++)
            {
                textBlocksWord[i].Text = "";
                images[i].Source       = null;
                grid[i].Visibility     = Visibility.Visible;
                borders[i].BorderBrush = Brushes.Transparent;
            }

            //-- Background
            TestingEditor.Page auxPage = taleManager.CurrentPage;

            if (auxPage.Background != "")
            {
                String background    = auxPage.Background;
                int    tamBackground = background.Length;
                if (tamBackground > 0)
                {
                    String p = background.Substring(tamBackground - 4);
                    if (p.Contains("."))
                    {
                        String pathBackgroundPage = auxPage.Background;
                        imgPageBackground.Source              = Utils.GetBitmapFromUri(pathBackgroundPage, UriKind.Absolute);
                        imgPageBackground.Stretch             = Stretch.UniformToFill;
                        imgPageBackground.HorizontalAlignment = HorizontalAlignment.Center;
                        imgPageBackground.VerticalAlignment   = VerticalAlignment.Center;
                    }

                    if (background.Contains("#"))
                    {
                        var bc = new BrushConverter();
                        grdPage.Background = (Brush)bc.ConvertFrom(background);
                    }
                }
            }

            //-- PICTOGRAMAS ----

            foreach (Pictogram pictogram in auxPage.Pictograms)
            {
                int i = pictogram.Index;
                textBlocksWord[i].Text = pictogram.TextToRead;

                String path = pictogram.ImageName;
                images[i].Source = Utils.GetBitmapFromUri(path, UriKind.Absolute);

                EditBorder(borders[i], pictogram.getColorByType(pictogram.Type), 6);
            }


            for (int i = 0; i < 10; i++)
            {
                if (textBlocksWord[i].Text == null && images[i].Source == null)
                {
                    grid[i].Visibility = Visibility.Hidden;
                }
            }

            if (this.WindowState == WindowState.Maximized)
            {
                GetResolution();
                Resize();
            }
        }
Beispiel #3
0
        private void UpdatePageAndroidGUI()
        {
            mediaPlayerTale.Stop();

            frmLytPage.SetBackgroundColor(Color.WhiteSmoke);
            imgBackgroundPage.SetImageBitmap(null);

            for (int i = 0; i < 10; i++)
            {
                textBlocksWord[i].Text = "";
                images[i].SetImageResource(0);
                images[i].SetImageBitmap(null);
                borders[i].SetBackgroundColor(Color.Transparent);
            }

            //-- Background
            TestingEditor.Page auxPage = taleManager.CurrentPage;

            if (auxPage.Background != "")
            {
                String background    = auxPage.Background;
                int    tamBackground = background.Length;
                if (tamBackground > 0)
                {
                    String p = background.Substring(tamBackground - 4);
                    UtilsImageAndroid.SetImage(background, imgBackgroundFrontPage);

                    if (p.Contains("."))
                    {
                        UtilsImageAndroid.SetImage(background, imgBackgroundPage);
                    }

                    if (background.Contains("#"))
                    {
                        frmLytPage.SetBackgroundColor(Color.ParseColor(background));
                    }
                }
            }

            if (auxPage.Music != "")
            {
                mediaPlayerTale = MediaPlayer.Create(this, Android.Net.Uri.Parse(auxPage.Music));
                mediaPlayerTale.Start();
            }

            //-- PICTOGRAMAS ----

            foreach (Pictogram pictogram in auxPage.Pictograms)
            {
                int i = pictogram.Index;
                textBlocksWord[i].Text = pictogram.TextToRead;

                string path = pictogram.ImageName;

                if (path != "")
                {
                    Bitmap bit = BitmapFactory.DecodeFile(path);
                    images[i].SetImageBitmap(bit);

                    EditBorderAndroid(borders[i], pictogram.getColorByType(pictogram.Type), images[i], 10);
                }
            }

            Application.Dispose();
            Application.OnTrimMemory(TrimMemory.RunningCritical);
        }