public bool EditStrategy(StrategyBase strategy)
        {
            Type type = strategy.GetType();
            StrategyConfigurationInfo info = Items.FirstOrDefault(i => i.StrategyType == type);

            if (info == null)
            {
                XtraMessageBox.Show("Configuration form not found for strategy " + type.Name);
                return(false);
            }
            try {
                ConstructorInfo ci = info.ConfigurationFormType.GetConstructor(new Type[] { });
                StrategySpecificConfigurationControlBase specificControl = (StrategySpecificConfigurationControlBase)ci.Invoke(new object[] { });
                StrategyConfigurationForm form = new StrategyConfigurationForm();
                form.Text = strategy.Name + " - Configuration";
                form.StrategySpecificSettingsControl = specificControl;
                form.Strategy = strategy;
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
                if (strategy != form.Strategy)
                {
                    strategy.Assign(form.Strategy);
                }
            }
            catch (Exception e) {
                XtraMessageBox.Show("Invalid configuration form for strategy " + type.Name + " " + e.ToString());
                return(false);
            }
            return(true);
        }
        private void biEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            StrategyBase strategy = (StrategyBase)this.gridView1.GetFocusedRow();

            if (strategy == null)
            {
                XtraMessageBox.Show("No strategy selected for editing.");
                return;
            }
            StrategyBase cloned = strategy.Clone();

            if (!StrategyConfigurationManager.Default.EditStrategy(cloned))
            {
                return;
            }
            strategy.Assign(cloned);
            Manager.Save();
            this.gridView1.RefreshData();
        }