Ejemplo n.º 1
0
        // when the user clicks 'Add to custom symbols' on the details dialog
        private void DetailsDialogAddToCustomSymbols(object sender, LineSymbolizerEventArgs e)
        {
            // Here a dialog is displayed. The user can enter the custom symbol name and category
            // in the dialog.
            AddCustomSymbolDialog dlg = new(_categories, e.Symbolizer);

            dlg.ShowDialog();

            if (dlg.CustomSymbolizer is CustomLineSymbolizer newSym)
            {
                // check if user added a new category
                if (!_categories.Contains(newSym.Category))
                {
                    _categories.Add(newSym.Category);
                }

                UpdateCategories();

                predefinedLineSymbolControl1.SymbolizerList.Insert(0, newSym);
                predefinedLineSymbolControl1.Invalidate();
            }

            // TODO: save the custom symbolizer to xml / serialized file.
            // predefinedLineSymbolControl1.SaveToXml("test.xml");
        }
Ejemplo n.º 2
0
        //when the user clicks 'Add to custom symbols' on the details dialog
        private void detailsDialog_AddToCustomSymbols(object sender, LineSymbolizerEventArgs e)
        {
            // Here a dialog is displayed. The user can enter the custom symbol name and category
            // in the dialog.
            AddCustomSymbolDialog dlg = new AddCustomSymbolDialog(_categories, e.Symbolizer);
            dlg.ShowDialog();

            CustomLineSymbolizer newSym = dlg.CustomSymbolizer as CustomLineSymbolizer;
            if (newSym != null)
            {
                //check if user added a new category
                if (!_categories.Contains(newSym.Category))
                {
                    _categories.Add(newSym.Category);
                }
                UpdateCategories();

                predefinedLineSymbolControl1.SymbolizerList.Insert(0, newSym);
                predefinedLineSymbolControl1.Invalidate();
            }

            //TODO: save the custom symbolizer to xml / serialized file.
            //predefinedLineSymbolControl1.SaveToXml("test.xml");
        }