Winforms 我的windows窗体应用程序的组合框出错
我目前正在为我的asp.net发布服务器和windows窗体应用程序订阅服务器开发WCF发布订阅服务 对于windows窗体应用程序,我将使用流布局面板为我的应用程序生成面板列表(通知)。当发布者(asp.net应用程序)向服务发布帖子时,每个订阅者都可以接收信息并相应地更新其面板。至于我的flowlayoutpanel,我有一个组合框来过滤通知类型,主要是类型1和类型2 组合框警报的代码为Winforms 我的windows窗体应用程序的组合框出错,winforms,wcf,user-interface,Winforms,Wcf,User Interface,我目前正在为我的asp.net发布服务器和windows窗体应用程序订阅服务器开发WCF发布订阅服务 对于windows窗体应用程序,我将使用流布局面板为我的应用程序生成面板列表(通知)。当发布者(asp.net应用程序)向服务发布帖子时,每个订阅者都可以接收信息并相应地更新其面板。至于我的flowlayoutpanel,我有一个组合框来过滤通知类型,主要是类型1和类型2 组合框警报的代码为 private void comboAlertType_SelectedIndexChanged(obj
private void comboAlertType_SelectedIndexChanged(object sender, EventArgs e)
{
flowLayoutForAlert.Dispose();
populateList();
if (comboAlertType.SelectedIndex == 0)
{
flowLayoutForAlert = createFlowLayoutPanel(1);
}
else if (comboAlertType.SelectedIndex == 1)
{
flowLayoutForAlert = createFlowLayoutPanel(2);
}
else
{
flowLayoutForAlert = createFlowLayoutPanel(3);
}
this.Controls.Add(flowLayoutForAlert);
}
createFlowlayoutpanel(#)只是我创建面板的一种方法。内部的整数表示所示的面板类型,主要是每个面板1个,重要面板2个,正常面板3个
对于wcf服务的PostReceived()回调方法,我有以下代码
public void PostReceived(String alertId)
{
backgroundForm b = (backgroundForm) Application.OpenForms[0];
b.BeginInvoke((MethodInvoker)delegate()
{
b.getMainFormObject().lblSearch.Text = "lakjslkaja";
b.getSettingsFormObject().player.Play();
b.getMainFormObject().notificationList.Add(new notificationForm("", "", "", "", "", "", 1, 1));
b.getMainFormObject().populateList();
b.getMainFormObject().mainFormLoad();
});
}
mainFormLoad的代码为
public void mainFormTesting()
{
notificationForm tempForm = (notificationForm)notificationList[0];
tempForm.Show();
flowLayoutForAlert = createFlowLayoutPanel(1);
this.Controls.Add(flowLayoutForAlert);
}
当我第一次启动应用程序时,combobox警报过滤器对面板的初始数量起作用,但是当我发布帖子并且应用程序收到帖子时,它在某种程度上破坏了combobox过滤器功能
有人能解决这个问题吗?在调用上面的代码之前,先处理原始面板,然后再解决这个问题。“它有点搞砸了组合框过滤功能”-你能说得更具体些吗?怎么搞砸的?你看到了什么?你看到的与你期望/想要的有什么不同?通常我在组合框中单击不同的选项,我会得到我的程序的不同过滤器视图。但在我发布一次之后,它不再真正过滤选择。