0

この [RefreshProperties(RefreshProperties.All)] 属性を使用して、実行時に特定の名前のプロパティのみを変更したいので、すべてではありません。Browsable(false/true) 属性はここで設定されます。私のコードはこれまでのところ次のようになります。

   [RefreshProperties(RefreshProperties.All)]
    [Display(ResourceType = typeof(Resource), Order = 0, GroupName = "HTF Parameter", Name = "BarsPeriodType", Description = "Select BarsPeriodType")]
    public BarsPeriodTypeInput BarsPeriodTypeHTF
    {
        get { return barsPeriodTypeHTF; }
        set
        {
            if (value != barsPeriodTypeHTF)
            {
                switch (value)
                {
                    case BarsPeriodTypeInput.Tick:
                        Dictionary<string, bool> prop1 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop1);
                        break;
                    case BarsPeriodTypeInput.Volume:
                        Dictionary<string, bool> prop2 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop2);
                        break;
                    case BarsPeriodTypeInput.Range:
                        Dictionary<string, bool> prop3 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop3);
                        break;
                    case BarsPeriodTypeInput.Second:
                        Dictionary<string, bool> prop4 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop4);
                        break;
                    case BarsPeriodTypeInput.Minute:
                        Dictionary<string, bool> prop5 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop5);
                        break;
                    case BarsPeriodTypeInput.Day:
                        Dictionary<string, bool> prop6 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop6);
                        break;
                    case BarsPeriodTypeInput.Week:
                        Dictionary<string, bool> prop7 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop7);
                        break;
                    case BarsPeriodTypeInput.Month:
                        Dictionary<string, bool> prop8 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop8);
                        break;
                    case BarsPeriodTypeInput.Year:
                        Dictionary<string, bool> prop9 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop9);
                        break;
                    case BarsPeriodTypeInput.HeikenAshi:
                        Dictionary<string, bool> prop10 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", true},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", false},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop10);
                        break;
                    case BarsPeriodTypeInput.Kagi:
                        Dictionary<string, bool> prop11 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", true},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", true},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop11);
                        break;
                    case BarsPeriodTypeInput.Renko:
                        Dictionary<string, bool> prop12 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", false},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop12);
                        break;
                    case BarsPeriodTypeInput.PointAndFigure:
                        Dictionary<string, bool> prop13 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", true},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", true},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", true},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop13);
                        break;
                    case BarsPeriodTypeInput.LineBreak:
                        Dictionary<string, bool> prop14 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", true},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop14);
                        break;
                    case BarsPeriodTypeInput.Volumetric:
                        Dictionary<string, bool> prop15 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", true},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", true},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", true},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop15);
                        break;
                    case BarsPeriodTypeInput.UniRenko:
                        Dictionary<string, bool> prop16 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", true},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop16);
                        break;
                    case BarsPeriodTypeInput.NinZaRenko:
                        Dictionary<string, bool> prop17 = new Dictionary<string, bool>()
                            {
                                {"BaseBarsPeriodTypeHTF", false},
                                {"BaseBarsPeriodValueHTF", true},
                                {"BarsPeriodValueHTF", true},
                                {"BarsPeriodValue2HTF", false},
                                {"ReversalTypeInputHTF", false},
                                {"PointAndFigurePriceTypeInputHTF", false},
                                {"VolumetricDeltaTypeHTF", false},
                            };
                        SidiExtensions.SetBrowsableAttributeValue(this, prop17);
                        break;
                }

                barsPeriodTypeHTF = value;
            }
        }
    }

    [Range(1, int.MaxValue), Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 1, GroupName = "HTF Parameter", Name = "BarsPeriodValue", Description = "Select BarsPeriodValue")]
    public int BarsPeriodValueHTF { get; set; }

    [Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 2, GroupName = "HTF Parameter", Name = "BaseBarsPeriodType", Description = "Select BaseBarsPeriodType")]
    public BarsPeriodTypeInput BaseBarsPeriodTypeHTF { get; set; }

    [Range(1, int.MaxValue), Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 3, GroupName = "HTF Parameter", Name = "BaseBarsPeriodValue", Description = "Select BaseBarsPeriodValue")]
    public int BaseBarsPeriodValueHTF { get; set; }

    [Range(1, int.MaxValue), Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 4, GroupName = "HTF Parameter", Name = "BarsPeriodValue2", Description = "Select BarsPeriodValue2")]
    public int BarsPeriodValue2HTF { get; set; }

    [Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 5, GroupName = "HTF Parameter", Name = "ReversalTypeInput", Description = "Select ReversalTypeInput")]
    public ReversalTypeInput ReversalTypeInputHTF { get; set; }

    [Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 6, GroupName = "HTF Parameter", Name = "PointAndFigurePriceTypeInputHTF", Description = "Select PointAndFigurePriceTypeInputHTF")]
    public PointAndFigurePriceTypeInput PointAndFigurePriceTypeInputHTF { get; set; }

    [Browsable(false)] // changes at runtime
    [Display(ResourceType = typeof(Resource), Order = 7, GroupName = "HTF Parameter", Name = "VolumetricDeltaTypeHTF", Description = "Select VolumetricDeltaTypeHTF")]
    public VolumetricDeltaTypeInput VolumetricDeltaTypeHTF { get; set; }

すべてが完璧に機能します。ただ、物件数が多いので全部変えるのは時間がかかるので、変えるべきところだけ変えたいと思っています。特定の「表示...名前」のプロパティのみを変更するにはどうすればよいですか?

 [Display ..... Name = "VolumetricDeltaTypeHTF"]
4

0 に答える 0