Ejemplo n.º 1
0
        /// <summary>
        /// Make sure the changes in the text tab can be parsed correctly
        /// </summary>
        /// <returns>True if the text is correct</returns>
        private bool ValidateTextContents()
        {
            if (textChanged || StyleLibrary.Styles == null)
            {
                try
                {
                    isTextValidating = true;
                    StyleLibrary.ApplyTextContents(scintillaControl.Text);
                    textChanged = false;
                    SetStyleLibModified(true);
                    timerRefresh.Enabled = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ". Please correct the issue in the text tab.", "MapManager",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                    tabControl.SelectedIndex = 1;
                    return(false);
                }
                finally
                {
                    isTextValidating = false;
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Saving the symbolset to file
 /// </summary>
 private void SaveSymbolset()
 {
     if (StyleLibrary.SymbolsetFileName != null && symbolsetChanged)
     {
         File.WriteAllText(StyleLibrary.SymbolsetFileName, scintillaControlSymbolset.Text);
         // reconstruct the in memory style lib with this new symbolset (without writing a file)
         string text = StyleLibrary.LoadTextContents();
         StyleLibrary.ApplyTextContents(text);
         layerControlStyles.Target = StyleLibrary.Styles;
         SetSymbolsetModified(false);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Saving the fontset to file
 /// </summary>
 private void SaveFontset()
 {
     if (StyleLibrary.FontsetFileName != null && fontsetChanged)
     {
         StringBuilder fontsetContents = new StringBuilder();
         foreach (ListViewItem item in listViewFonts.Items)
         {
             fontsetContents.AppendLine(String.Format("{0}\t{1}", item.Text, item.SubItems[1].Text));
         }
         File.WriteAllText(StyleLibrary.FontsetFileName, fontsetContents.ToString());
         // reconstruct the in memory style lib with this new fontset (without writing a file)
         string text = StyleLibrary.LoadTextContents();
         StyleLibrary.ApplyTextContents(text);
         layerControlStyles.Target = StyleLibrary.Styles;
         SetFontsetModified(false);
     }
 }