Ejemplo n.º 1
0
        private void environmentsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var optionsDialog = new EditDialog <Environment>(true, "Environment")
            {
                ItemList = _configuration.Environments
            };

            if (optionsDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _configuration.Environments = optionsDialog.ItemList;
            _configuration.Save(_configurationFileName);
            Rebind();
        }
Ejemplo n.º 2
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            var val = value == null ? new T() : (T)((T)value).Clone();

            if (svc == null)
            {
                return(null);
            }

            using (var dialog = new EditDialog <T>(false, typeof(T).Name))
            {
                dialog.SelectedItem = val;
                if (svc.ShowDialog(dialog) == DialogResult.OK)
                {
                    return(dialog.SelectedItem.Clone());
                }
            }
            return(value);
        }