提交 d088a7e3 编写于 作者: B Balaji Krishnan

Don't throw from properties used in databinding.

The BooleanCodeStyleOptionViewModel are a glue between older checkbox
style options and the new grid UI with severity levels. Well, the older
options don't have severity levels and I was throwing NotSupportedEx,
but forgot they were used in databinding. As a result we had non-fatal
exceptions. This change removes them.
上级 91ea086c
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.Imaging;
......@@ -32,12 +33,16 @@ internal abstract class AbstractCodeStyleOptionViewModel : AbstractNotifyPropert
public double DescriptionMargin { get; set; }
public string GroupName { get; set; }
public abstract CodeStylePreference SelectedPreference { get; set; }
public abstract NotificationOptionViewModel SelectedNotificationPreference { get; set; }
public List<CodeStylePreference> Preferences { get; set; }
public List<NotificationOptionViewModel> NotificationPreferences { get; set; }
public abstract bool NotificationsAvailable { get; }
public virtual string GetPreview() => SelectedPreference.IsChecked ? _truePreview : _falsePreview;
public virtual NotificationOptionViewModel SelectedNotificationPreference
{
get { return NotificationPreferences.First(); }
set { }
}
public AbstractCodeStyleOptionViewModel(
IOption option,
......
......@@ -39,19 +39,6 @@ internal class BooleanCodeStyleOptionViewModel : AbstractCodeStyleOptionViewMode
}
public override bool NotificationsAvailable => false;
public override NotificationOptionViewModel SelectedNotificationPreference
{
// presently, these options do not support notification styles.
get
{
throw new NotSupportedException();
}
set
{
throw new NotSupportedException();
}
}
private CodeStylePreference _selectedPreference;
public override CodeStylePreference SelectedPreference
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册