使用C#.NET 4.0
我正在尝试使用BackgroundWorker来检索远程计算机上的服务列表.这是作为后台工作程序运行的,因此UI在等待信息时保持响应.
我的方法是将信息请求放在后台工作程序的_DoWork方法中,并使用ManualResetEvent.Set()来指示信息已被处理.应该在_RunWorkerCompleted方法中设置ManaualResetEvent._RunWorkerCompleted永远不会执行.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.ServiceProcess;
using System.Threading;
using System.Diagnostics;
namespace DemoTest
{
public partial class Form1 : Form
{
List<ServiceController> MyBox1Services;
ManualResetEvent MyBox1ServicesObtained = new ManualResetEvent(false);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Use background worker to get the list of services in the background
BackgroundWorker MyBox1Servicess = new BackgroundWorker();
MyBox1Servicess.DoWork += new DoWorkEventHandler(bwGetMyBox1Services_DoWork);
MyBox1Servicess.RunWorkerCompleted += new RunWorkerCompletedEventHandler(MyBox1Servicess_RunWorkerCompleted);
MyBox1Servicess.RunWorkerAsync();
// Wait until all the services …Run Code Online (Sandbox Code Playgroud) 我是wix的新手,并尝试为几个dll安装一个安装程序.过去手动完成的任务之一是使用REGSVR32来注册com对象.
我假设wix中的RegisterClassInfo将执行此功能,但我已经可以找到显示正确语法的示例代码.如果有人能给我一个很好的例子或者在这里作为答案发布,我会很感激.
我正在尝试创建一个包含配置信息的DataGridView.
可以根据不同列中的值为列中的每一行更改可用值,因此我无法将单个数据源附加到comboBox列.例如:如果选择汽车,则可用颜色应限制为该模型可用的颜色.
Car ColorsAvailable
Camry {white,black}
CRV {white,black}
Pilot {silver,sage}
Run Code Online (Sandbox Code Playgroud)
考虑dataGridView的原因是操作员可以为其他汽车添加行.
实现这种类型的UI有什么好的设计?
我需要在类上使用INotifyPropertyChanged接口.当底层属性更改时,需要更新表单中的值.
此类已派生自另一个未实现INotifyPropertyChanged接口的类.
这不起作用:
public class MyClass : BaseClass : INotifyPropertyChanged { }
Run Code Online (Sandbox Code Playgroud)
我很感激程序结构更改或语法更改的想法,这将使我在基类中的属性更改时实现更新表单的目标.