/// <summary>
        /// Constructor for setting label expression and options
        /// </summary>
        public LabelStyleForm(LegendControl.Legend legend, MapWinGIS.Shapefile sf, int handle)
        {
            if (sf == null)
            {
                throw new Exception("LabelStyleForm: unexpected null parameter");
            }
            m_legend    = legend;
            m_shapefile = sf;
            m_handle    = handle;

            InitializeComponent();

            //LabelStyle style = new LabelStyle( m_shapefile.Labels.Options);

            // old-style labels not based on expression
            if (m_shapefile.Labels.Expression == "" && m_shapefile.Labels.Count > 0 &&
                m_shapefile.Labels.get_Label(0, 0).Text != "")
            {
                richTextBox1.Text    = "<no expression>";
                listBox1.Enabled     = false;
                btnPlus.Enabled      = false;
                btnQuotes.Enabled    = false;
                btnNewLine.Enabled   = false;
                richTextBox1.Enabled = false;
            }
            else
            {
                richTextBox1.Text = LabelUtilities.StripNewLineQuotes(m_shapefile.Labels.Expression);
            }

            this.Initialize(m_shapefile.Labels.Options);

            tabControl1.SelectedIndex = tabNumber;
        }
        /// <summary>
        /// Draws preview of the label
        /// </summary>
        private void DrawPreview(object sender, EventArgs e)
        {
            // this function is called after each change of state, therefore it makes sense to update availability of controls here
            RefreshControls();

            if (!m_NoEvents)
            {
                if (m_category.Visible)
                {
                    string text = m_categoryEdited ? m_shapefile.Labels.Expression : richTextBox1.Text;
                    LabelUtilities.DrawPreview(m_category, m_shapefile, pctPreview, text, true);
                }
                else
                {
                    Bitmap img = new Bitmap((int)pctPreview.ClientRectangle.Width, (int)pctPreview.ClientRectangle.Height);
                    if (pctPreview.Image != null)
                    {
                        pctPreview.Image.Dispose();
                    }
                    pctPreview.Image = img;
                }
            }
        }
 /// <summary>
 /// Updates preview of the labels
 /// </summary>
 private void DrawLabelsPreview()
 {
     LabelUtilities.DrawPreview(_shapefile.Labels.Options, _shapefile, pctLabelPreview, false);
 }
Example #4
0
        public TappaRocchetta()
        {
            InitializeComponent();

            int              IDTappa = 2;
            Tappa            tappa;
            List <Sezione>   Sezioni;
            List <Contenuto> Contenuti;

            var db = App.Database;

            tappa   = db.GetTappaAsync(IDTappa).Result;
            Sezioni = db.GetSezioneAsync(IDTappa).Result;

            accordions = new List <Accordion>()
            {
                Accordion0, Accordion1, Accordion2, Accordion3, Accordion4
            };
            foreach (Accordion accordion in accordions)
            {
                accordion.AccordionOpened += accordionEvent;
            }

            #region INTRODUZIONE
            close.Source      = ImageSource.FromResource("AddaDiLeonardo.Images.Icons.close.close_5.png");
            imgTappa.Source   = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.img_tappa.jpg");
            iconMarker.Source = ImageSource.FromResource("*****@*****.**");
            //lblTitolo.Text = tappa.Titolo;
            lblTitolo.Text = tappa.Titolo;
            //lblSottotitolo.Text = tappa.Sottotitolo;
            lblSottotitolo.Text = tappa.Sottotitolo;
            lblDescrizione.Text = tappa.Descrizione;

            #endregion
            //OK

            #region SECTION 1

            Accordion0.Title = Sezioni[0].Titolo;
            //Accordion0.Title = "FEMMINILITÀ E SACRALITÀ DEL FIUME";
            Contenuti = db.GetContenutoAsync(Sezioni[0].Id).Result.OrderBy(c => c.Indice).ToList();

            imgSection1.Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_1.fiume_2.jpeg");
            //titolo: poetica del fiume, richiamo a sacro e femminile
            //stackContenuto_0.Children.Add(new CustomLabelTitle { Text = Contenuti[0].Testo });
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[0].Testo));
            //primo paragrafo

            //stackContenuto_0.Children.Add(new CustomLabel { Text = Contenuti[1].Testo });
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[1].Testo));
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[2].Testo));
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[3].Testo));


            //titolo: Il fiume, dinamico e sacro
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[4].Testo));
            //secondo paragrafo
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[5].Testo));
            stackContenuto_0.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_1.fiume_1.jpeg"), Aspect = Aspect.AspectFill, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[6].Testo));
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[7].Testo));
            stackContenuto_0.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_1.fiume_4.jpeg"), Aspect = Aspect.AspectFill, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[8].Testo));
            stackContenuto_0.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[9].Testo));

            #endregion
            //OK

            #region SECTION 2

            Accordion1.Title = Sezioni[1].Titolo;
            //Accordion1.Title = "LA ROCCHETTA: LUOGO SACRO E MILITARE";
            Contenuti = db.GetContenutoAsync(Sezioni[1].Id).Result.OrderBy(c => c.Indice).ToList();

            imgSection2.Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_2.Rocchetta_2.JPG");
            //titolo:La rocchetta luogo sacro e militare
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[0].Testo));
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[1].Testo));
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[2].Testo));
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[3].Testo));

            //titolo: L'origine e la storia
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[4].Testo));
            stackContenuto_1.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_2.Rocchetta_3.jpg"), Aspect = Aspect.AspectFill, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[5].Testo));
            stackContenuto_1.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_2.Rocchetta_ga.jpg"), Aspect = Aspect.AspectFill, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[6].Testo));
            stackContenuto_1.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[7].Testo));
            stackContenuto_1.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_2.Rocchetta_1.jpeg"), Aspect = Aspect.AspectFill, Margin = new Thickness(0, 10, 0, 10)
            });
            //stackContenuto_1.Children.Add(new CustomLabel { Text = Contenuti[8].Testo });
            stackContenuto_1.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_2.Rocchetta_Leonardo.jpeg"), Aspect = Aspect.AspectFill, Margin = new Thickness(0, 10, 0, 10)
            });
            //stackContenuto_1.Children.Add(new CustomLabel { Text = Contenuti[9].Testo });

            #endregion
            //ok

            #region SECTION 3

            Accordion2.Title = Sezioni[2].Titolo;
            //Accordion2.Title = "SOSPESI TRA IL SACRO E IL PROFANO";
            Contenuti = db.GetContenutoAsync(Sezioni[2].Id).Result.OrderBy(c => c.Indice).ToList();

            //imgSection3.Source = ImageSource.FromResource("AddaDiLeonardo.Images.Tappa1.adda.jpg"); //NO IMMAGINE??
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[0].Testo));
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[1].Testo));
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[2].Testo));
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[3].Testo));
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[4].Testo));
            //Aggiunti
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[5].Testo));
            stackContenuto_2.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[6].Testo));

            #endregion
            //ok

            #region SECTION 4

            Accordion3.Title = Sezioni[3].Titolo;
            //Accordion3.Title = "LA VERGINE DELLE ROCCE DI LEONARDO";
            Contenuti = db.GetContenutoAsync(Sezioni[3].Id).Result.OrderBy(c => c.Indice).ToList();

            imgSection4.Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_4.TreCorni_1.jpeg");
            //titolo:Racconto del dipinto
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[0].Testo));
            stackContenuto_3.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_4.Vergine.jpg"), Aspect = Aspect.AspectFit, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[1].Testo));

            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[2].Testo));
            stackContenuto_3.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_4.TreCorni_3.jpg"), Aspect = Aspect.AspectFit, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[3].Testo));
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[4].Testo));
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[5].Testo));
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[6].Testo));
            stackContenuto_3.Children.Add(new Image {
                Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_4.TreCorni_2.jpg"), Aspect = Aspect.AspectFit, Margin = new Thickness(0, 10, 0, 10)
            });
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[7].Testo));
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[8].Testo));
            stackContenuto_3.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[9].Testo));
            //stackContenuto_3.Children.Add(new CustomLabel { Text = Contenuti[10].Testo , FontAttributes = FontAttributes.Italic});
            #endregion
            //ok

            #region SECTION 5

            Accordion4.Title = Sezioni[4].Titolo;
            //Accordion4.Title = "CURIOSITÀ";
            Contenuti = db.GetContenutoAsync(Sezioni[4].Id).Result.OrderBy(c => c.Indice).ToList();

            imgSection5.Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_2.Rocchetta_2.JPG");
            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[0].Testo));
            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[1].Testo));
            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[2].Testo));
            //stackContenuto_4.Children.Add(new Image { Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_5.Riccioli.png"), Aspect = Aspect.AspectFit, Margin = new Thickness(0, 10, 0, 10) });
            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[3].Testo));
            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[4].Testo));
            //stackContenuto_4.Children.Add(new Image { Source = ImageSource.FromResource("AddaDiLeonardo.Content.Rocchetta.Sezione_5.Grotta.png"), Aspect = Aspect.AspectFit, Margin = new Thickness(0, 10, 0, 10) });
            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[5].Testo));

            stackContenuto_4.Children.Add(LabelUtilities.FormattaContenuto(Contenuti[6].Testo));
            //stackContenuto_4.Children.Add(new CustomLabel { Text = Contenuti[7].Testo });

            //stackContenuto_4.Children.Add(new CustomLabelTitle { Text = Contenuti[8].Testo });
            //stackContenuto_4.Children.Add(new CustomLabel { Text = Contenuti[9].Testo });
            //stackContenuto_4.Children.Add(new CustomLabel { Text = Contenuti[10].Testo });

            #endregion
            //ok
        }