[英]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.