/// <summary>
        /// Displays the editor for the collection of receiver locations being edited.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var result = value as ReceiverLocationOptions;
            if(result != null) {
                using(var dialog = new ReceiverLocationsView()) {
                    dialog.ReceiverLocations.AddRange(result.ReceiverLocations);
                    dialog.SelectedReceiverLocation = result.CurrentReceiverLocation;
                    if(dialog.ShowDialog() == DialogResult.OK) {
                        result = new ReceiverLocationOptions();
                        result.ReceiverLocations.AddRange(dialog.ReceiverLocations);
                        result.CurrentReceiverLocation = dialog.SelectedReceiverLocation;
                    }
                }
            }

            return result;
        }
コード例 #2
0
        /// <summary>
        /// Displays the editor for the collection of receiver locations being edited.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var result = value as ReceiverLocationOptions;

            if (result != null)
            {
                using (var dialog = new ReceiverLocationsView()) {
                    dialog.ReceiverLocations.AddRange(result.ReceiverLocations);
                    dialog.SelectedReceiverLocation = result.CurrentReceiverLocation;
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        result = new ReceiverLocationOptions();
                        result.ReceiverLocations.AddRange(dialog.ReceiverLocations);
                        result.CurrentReceiverLocation = dialog.SelectedReceiverLocation;
                    }
                }
            }

            return(result);
        }