Ejemplo n.º 1
0
        /// <summary>
        /// Brings up the Property Dialog in edit mode.
        /// </summary>
        private void editButton_Click(object sender, System.EventArgs e)
        {
            PropertyEditItem item = (PropertyEditItem)this.propListView.SelectedItems[0];

            using (PropertyDialog pDialog = new PropertyDialog(item.Value, _currentNodeKind))
            {
                if (pDialog.ShowDialog(Context) != DialogResult.OK)
                {
                    return;
                }

                SvnPropertyValue value = pDialog.GetPropertyItem();
                if (value != null)
                {
                    if (value.Key != item.PropertyName)
                    {
                        item.Value = null; // Deleted
                        item.Refresh();

                        PropertyEditItem pi;

                        if (!_propItems.TryGetValue(value.Key, out pi))
                        {
                            _propItems[value.Key] = pi = new PropertyEditItem(propListView, value.Key);
                        }

                        pi.Value = value;

                        PopulateListView(); // Add new item
                    }
                    else
                    {
                        item.Value = value;
                        item.Refresh();
                    }
                }
                else
                {
                    item.Value = null;
                    if (item.BaseValue == null)
                    {
                        _propItems.Remove(item.PropertyName);
                        propListView.Items.Remove(item);
                    }
                    else
                    {
                        item.Refresh();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete the selected item if delete-button is clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteButton_Click(object sender, System.EventArgs e)
        {
            PropertyEditItem item = (PropertyEditItem)this.propListView.SelectedItems[0];

            item.Value = null;
            if (item.BaseValue == null)
            {
                propListView.Items.Remove(item);
            }
            else
            {
                item.Refresh();
            }
            this.UpdateButtons();
        }