/// <summary>
        /// Renames selected set of options (including file)
        /// </summary>
        private void btnRename_Click(object sender, EventArgs e)
        {
            string name; SymbologyType type;

            if (!get_CurrentNameAndType(out name, out type))
            {
                return;
            }

            if (type == SymbologyType.Default)
            {
                return;
            }

            string newName = name;

            frmAddOptions form = new frmAddOptions();

            form.Text                = "Rename options";
            form.txtName.Text        = newName;
            form.txtDescription.Text = this.txtDescription.Text;

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                newName = form.txtName.Text.Trim();
                this.txtDescription.Text = form.txtDescription.Text;

                try
                {
                    string oldFileame = m_layer.FileName + "." + name + ".mwsymb";
                    System.IO.File.Delete(oldFileame);

                    MapWinGIS.Map map = m_legend.Map;
                    map.SaveLayerOptions(map.get_LayerHandle(0), newName, true, txtDescription.Text);
                }
                catch
                {
                    Globals.MessageBoxError("Failed to rename file");
                    return;
                }

                // updating the list
                listView1.SelectedItems[0].Text = newName;
            }
            form.Dispose();
        }
        /// <summary>
        /// Saves the current state of the layer
        /// </summary>
        private void btnSave_Click(object sender, EventArgs e)
        {
            frmAddOptions form = new frmAddOptions();

            // some values can be set there
            form.txtName.Text        = "";
            form.txtDescription.Text = "";

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                string value = form.txtName.Text;
                txtDescription.Text = form.txtDescription.Text;

                if (listView1.Items.Count == 0)
                {
                    this.LoadLayer();
                }

                // in case file exists, let's ask the user if we are to overwrite it
                string name = m_layer.FileName + "." + value + ".mwsymb";
                if (System.IO.File.Exists(name))
                {
                    if (MessageBox.Show("Set of options with such name already exists." + Environment.NewLine +
                                        "Do you want to rewrite it?", LegendControl.Legend.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                MapWinGIS.Map map = m_legend.Map;
                map.SaveLayerOptions(m_handle, value, true, txtDescription.Text);

                // updating the list
                Globals.FillSymbologyList(listView1, m_layer.FileName, true, ref m_noEvents);
                dgv_CurrentCellChanged(null, null);

                RefreshControlsState();
            }
            form.Dispose();
        }