[英]debugger does not recognize User settings
我在应用程序设置中添加了以下设置:
名称:类型:范围:值:
ComboBoxItems字符串用户我没有在此处插入任何值
我声明如下:
public partial class postLoginWindow : Window
{
private readonly string dbConnectionString = Properties.Settings.Default.dbConnectionString;
private readonly string currentAdminEmail;
private string ComboBoxItemsString = Properties.Settings.Default.ComboBoxItems;
public postLoginWindow(string receivedAdminEmail)
{
InitializeComponent();
LoadComboBoxValues();
if (ComboBoxSelectedProfile.Items.IsEmpty)
{
ComboBoxSelectedProfile.IsEnabled = false;
ButtonRenameProfile.IsEnabled = false;
ButtonChangePermissions.IsEnabled = false;
ButtonAddNewUser.IsEnabled = false;
ButtonRemoveUser.IsEnabled = false;
ButtonDeleteProfile.IsEnabled = false;
}
...
}
}
这是我用来将字符串值加载到comboBox的方法:
private void LoadComboBoxValues()
{
string[] ComboBoxRows = ComboBoxItemsString.Split('|');
foreach (string Row in ComboBoxRows)
{
if (Row != "") ComboBoxSelectedProfile.Items.Add(Row);
}
}
这就是当我想将它们保存在设置字符串中时如何添加值:
private void ComboBoxAddItem(string item)
{
string[] ComboBoxRows = Properties.Settings.Default.ComboBoxItems.Split('|');
bool ItemAlreadyExists = false;
foreach (string Row in ComboBoxRows)
{
if (Row == item) ItemAlreadyExists = true;
}
if (!ItemAlreadyExists)
{
parent.ComboBoxSelectedProfile.Items.Add(item);
string ComboBoxSavedProfileAsString = TxtProfileName.Text + "|";
Properties.Settings.Default.ComboBoxItems = Properties.Settings.Default.ComboBoxItems +
ComboBoxSavedProfileAsString;
Properties.Settings.Default.Save();
}
}
这是从另一个我在其中添加用户的窗口完成的。
问题是:每当我进入DebugMode调试我的应用程序时,即使我确实向其中添加了一些字符串,它也会像设置字符串一样为空。 所以我无法调试我的应用程序。
我非常感谢您的帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.