private void Form1_Load(object sender, EventArgs e) { one = new MyMonitor(this); vone = new Thread(one.Smoker1); two = new Thread(one.Smoker2); three = new Thread(one.Smoker3); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void eventShouldBubbleUp() public virtual void EventShouldBubbleUp() { Monitors parent = new Monitors(); MyMonitor parentListener = mock(typeof(MyMonitor)); parent.AddMonitorListener(parentListener); Monitors child = new Monitors(parent); MyMonitor childListener = mock(typeof(MyMonitor)); child.AddMonitorListener(childListener); // Calls on monitors from parent should not reach child listeners MyMonitor parentMonitor = parent.NewMonitor(typeof(MyMonitor)); parentMonitor.AVoid(); verify(parentListener, times(1)).aVoid(); verifyZeroInteractions(childListener); // Calls on monitors from child should reach both listeners MyMonitor childMonitor = child.NewMonitor(typeof(MyMonitor)); childMonitor.AVoid(); verify(parentListener, times(2)).aVoid(); verify(childListener, times(1)).aVoid(); }
public Form_monitor(MyMonitor mymonitor) { this.mymonitor = mymonitor; InitializeComponent(); Thread monitor_run = new Thread(new ParameterizedThreadStart(MonitorDatas)); //带1个参数传递的线程创建 monitor_run.Start(mymonitor); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldProvideNoOpDelegate() public virtual void ShouldProvideNoOpDelegate() { // Given Monitors monitors = new Monitors(); // When MyMonitor monitor = monitors.NewMonitor(typeof(MyMonitor)); // Then those should be no-ops monitor.AVoid(); monitor.TakesArgs("ha", 12, new object()); }
public void GenericWatcherTest_FiresEventWhenConditionMet_LE() { var mockProxy = new Mock <MyVAProxy>(); mockProxy.Setup(x => x.CommandExists(It.IsAny <string>())).Returns(true); MyMonitor mon = new MyMonitor(); mon.addGenericWatcher(50, Watcher.WatchCondition.LessThanEqualTo, "MyIdent"); mon.valueChanged(55, mockProxy.Object); mon.valueChanged(50, mockProxy.Object); mockProxy.Verify(x => x.ExecuteCommand(It.Is <string>(s => s.Equals("_VAP3D_Watcher_MyIdent"))), Times.Once); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRegister() public virtual void ShouldRegister() { // Given Monitors monitors = new Monitors(); MyMonitor listener = mock(typeof(MyMonitor)); MyMonitor monitor = monitors.NewMonitor(typeof(MyMonitor)); object obj = new object(); // When monitors.AddMonitorListener(listener); monitor.AVoid(); monitor.TakesArgs("ha", 12, obj); // Then verify(listener).aVoid(); verify(listener).takesArgs("ha", 12, obj); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void multipleListenersRegistration() public virtual void MultipleListenersRegistration() { Monitors monitors = new Monitors(); MyMonitor listener1 = mock(typeof(MyMonitor)); MyMonitor listener2 = mock(typeof(MyMonitor)); assertFalse(monitors.HasListeners(typeof(MyMonitor))); monitors.AddMonitorListener(listener1); monitors.AddMonitorListener(listener2); assertTrue(monitors.HasListeners(typeof(MyMonitor))); monitors.RemoveMonitorListener(listener1); assertTrue(monitors.HasListeners(typeof(MyMonitor))); monitors.RemoveMonitorListener(listener2); assertFalse(monitors.HasListeners(typeof(MyMonitor))); }
static void Main(string[] args) { //*MyComponent作为被观察者,即事件源(事件源持有事件),MyMonitor作为观察者。.net中的事件不太容易理解,如果看不明白的话,可以看第二个例子,那个例子是基于java中观察者模式的原型而用c#实现的观察者模式。 MyComponent component = new MyComponent(); MyMonitor monitor = new MyMonitor(); component.MonitorList.Add(monitor); component.Init(); component.Load(); //*/ //*这是个基于java的观察者模式,它比较标准,也容易理解。EatAction和SleepAction就是事件,MyActionSource就是事件源(即被观察者),MyActionListener就是观察者。这种写法就是每个事件都要一个单独的监听者列表。而第一个和第三个例子都是指定同一种监听者,至于若干个事件中监听哪个几个或哪一个都使用同一列表,使用上有一定局限性。建议使用这种,每个事件都有一个单独的监听者列表,这种写法比较麻烦,但是相对比较灵活。 MyActionSource actionSource = new MyActionSource(); MyActionListener eatActionListener = new MyActionListener(); MyActionListener sleepActionListener = new MyActionListener(); actionSource.EatActionListenerList.Add(eatActionListener); actionSource.SleepActionListenerList.Add(sleepActionListener); actionSource.Eat(); actionSource.Sleep(); //*/ //*这是一个简单pipeline模型,它模拟asp.net的请求管道处理模型。平时我们不用写下面行代码是因为asp.net底层机制通过我们的web.config中的httpmodules节点会帮我们自动注册到每个HttpApplication中去。平时我们只需自定义HttpModule即可,确实帮我们简化了很多步骤。 //通过事件实现观察者模式,这里的MyHttpApplication即被观察者,也叫事件源。 MyHttpApplication httpApplication = new MyHttpApplication(); //实例化观察者MyHttpModule的实例 MyHttpModule httpModule = new MyHttpModule(); //注册MyHttpModule实例到事件源 httpApplication.HttpModuleList.Add(httpModule); //模拟初始化HttpApplication httpApplication.Init(); //模拟http上下文 object httpContext = new object(); //执行模拟的管道模型 httpApplication.ProcessRequest(httpContext); //*/ Console.ReadLine(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldUnregister() public virtual void ShouldUnregister() { // Given Monitors monitors = new Monitors(); MyMonitor listener = mock(typeof(MyMonitor)); MyMonitor monitor = monitors.NewMonitor(typeof(MyMonitor)); object obj = new object(); monitors.AddMonitorListener(listener); // When monitors.RemoveMonitorListener(listener); monitor.AVoid(); monitor.TakesArgs("ha", 12, obj); // Then verifyNoMoreInteractions(listener); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRespectTags() public virtual void ShouldRespectTags() { // Given Monitors monitors = new Monitors(); MyMonitor listener = mock(typeof(MyMonitor)); MyMonitor monitorTag1 = monitors.NewMonitor(typeof(MyMonitor), "tag1"); MyMonitor monitorTag2 = monitors.NewMonitor(typeof(MyMonitor), "tag2"); // When monitors.AddMonitorListener(listener, "tag2"); // Then monitorTag1.AVoid(); verifyZeroInteractions(listener); monitorTag2.AVoid(); verify(listener, times(1)).aVoid(); verifyNoMoreInteractions(listener); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTellIfMonitorHasListeners() public virtual void ShouldTellIfMonitorHasListeners() { // Given Monitors monitors = new Monitors(); MyMonitor listener = mock(typeof(MyMonitor)); // When I have a monitor with no listeners monitors.NewMonitor(typeof(MyMonitor)); // Then assertFalse(monitors.HasListeners(typeof(MyMonitor))); // When I add a listener monitors.AddMonitorListener(listener); // Then assertTrue(monitors.HasListeners(typeof(MyMonitor))); // When that listener is removed again monitors.RemoveMonitorListener(listener); // Then assertFalse(monitors.HasListeners(typeof(MyMonitor))); }
/******************************************** * 函数名称:MonitorDatas() * 功能:数据监控,监控组件数据 * 参数:monitor 表示对应的监控器组件 * 返回值:无 * ******************************************/ private void MonitorDatas(Object monitor) { CheckForIllegalCrossThreadCalls = false; //去掉线程间操作无效检查 MyMonitor mymonitor = (MyMonitor)monitor; while (true) { if (Form1.stop) { this.mymonitor.EmptyingQueue(); return; } try { //接收数据 mymonitor.ComponentDataReceive(mymonitor); if (mymonitor.Component_reveice_queue.Count > 0) { Object data = mymonitor.Component_reveice_queue.Dequeue(); //if (data.GetType().Name == "Int32[]") //{ // MonitorInt32Array(data); //} //Console.WriteLine(data.GetType()); //Console.WriteLine(data.GetType().GetGenericArguments()[0].Name); switch (data.GetType().Name) { case "BloodPressureDataType": MonitorBloodPressureData(data); break; case "TemperatureDataType": MonitorTemperatureData(data); break; case "HeartRateDataType": MonitorHeartRateData(data); break; case "List`1": //若为列表数据类型 //若列表元素为BloodPressureDataType if (data.GetType().GetGenericArguments()[0].Name == "BloodPressureDataType") { MonitorListBloodPressureData(data); } else if (data.GetType().GetGenericArguments()[0].Name == "TemperatureDataType") { MonitorListTemperatureData(data); } else if (data.GetType().GetGenericArguments()[0].Name == "HeartRateDataType") { MonitorListHeartRateData(data); } break; case "PDU_LoWPAN_IPHC": Monitor_PDU_LoWPAN_IPHC(data); break; case "PDU_ConnID": Monitor_PDU_ConnID(data); break; case "PDU_Network": Monitor_PDU_Network(data); break; case "Frame_802_15_4": Monitor_Frame_802_15_4(data); break; case "Frame_802_15_1": Monitor_Frame_802_15_1(data); break; case "Frame_Ethernet": Monitor_Frame_Ethernet(data); break; } } //Thread.Sleep(delay); } catch (Exception e) { Console.WriteLine("Form monitor错误情况:" + e.Message + " " + e.StackTrace); } } }
/*************************************************************************** * 函数名称:treeView1_NodeMouseDoubleClick() * 功能:组件库列表表项鼠标双击事件,在graphControl绘图控制区创建相应组件 * 参数:sender;e * 返回值:无 * *************************************************************************/ private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); if (treeView1.SelectedNode.Level > 1) { string name; //int tabIndex = 0; //第一个选项卡 name = e.Node.Name.ToString(); switch (name) { //================================================================// //======================创建基本组件==============================// //================================================================// //B01 人体血压 case "BloodPressure": bloodPressure = new BloodPressure(this.graphControl, null, null, null); graphControl.AddShape(bloodPressure, bloodPressure.Location); break; //B02 人体体温 case "Temperature": temperature = new Temperature(this.graphControl, null, null, null); graphControl.AddShape(temperature, new PointF(temperature.Location.X, temperature.Location.Y + 80)); break; //B03 人体心率 case "HeartRate": heartRate = new HeartRate(this.graphControl, null, null, null); graphControl.AddShape(heartRate, new PointF(heartRate.Location.X, heartRate.Location.Y + 160)); break; //B04 血压传感器 case "BloodPressureSensor": bloodPressureSensor = new BloodPressureSensor(this.graphControl, null, null, null); graphControl.AddShape(bloodPressureSensor, new PointF(bloodPressureSensor.Location.X + 110, bloodPressureSensor.Location.Y)); break; //B05 体温传感器 case "TemperatureSensor": temperatureSensor = new TemperatureSensor(this.graphControl, null, null, null); graphControl.AddShape(temperatureSensor, new PointF(temperatureSensor.Location.X + 110, temperatureSensor.Location.Y + 80)); break; //B06 心率传感器 case "HeartRateSensor": heartRateSensor = new HeartRateSensor(this.graphControl, null, null, null); graphControl.AddShape(heartRateSensor, new PointF(heartRateSensor.Location.X + 110, heartRateSensor.Location.Y + 160)); break; //B07 显示控制器 case "DisplayController": displayController = new DisplayController(this.graphControl, null, null, null); graphControl.AddShape(displayController, new PointF(displayController.Location.X + 220, displayController.Location.Y)); break; //B08 音频控制器 case "AudioController": audioController = new AudioController(this.graphControl, null, null, null); graphControl.AddShape(audioController, new PointF(audioController.Location.X + 220, audioController.Location.Y + 80)); break; //B09 电机控制器 case "ElectricMachineryController": electricMachineryController = new ElectricMachineryController(this.graphControl, null, null, null); graphControl.AddShape(electricMachineryController, new PointF(electricMachineryController.Location.X + 220, electricMachineryController.Location.Y + 160)); break; //B10 运算器 微处理器 case "MicroProcessor": microProcessor = new MicroProcessor(this.graphControl, null, null, null); graphControl.AddShape(microProcessor, new PointF(microProcessor.Location.X + 330, microProcessor.Location.Y)); break; //B11 协议转换器 case "ProtocolConverter": protocolConverter = new ProtocolConverter(this.graphControl, null, null, null); graphControl.AddShape(protocolConverter, new PointF(protocolConverter.Location.X + 330, protocolConverter.Location.Y + 70)); break; //B12 数据处理器 case "DataProcessor": dataProcessor = new DataProcessor(this.graphControl, null, null, null); graphControl.AddShape(dataProcessor, new PointF(dataProcessor.Location.X + 330, dataProcessor.Location.Y + 160)); break; //B13 数据分析器 case "DataAnalyzer": dataAnalyzer = new DataAnalyzer(this.graphControl, null, null, null); graphControl.AddShape(dataAnalyzer, new PointF(dataAnalyzer.Location.X + 330, dataAnalyzer.Location.Y + 240)); break; //B14 有线通信模块 case "WiredModule": wiredModule = new WiredModule(this.graphControl, null, null, null); graphControl.AddShape(wiredModule, new PointF(wiredModule.Location.X + 440, wiredModule.Location.Y)); break; //B15 无线通信模块 case "WirelessModule": wirelessModule = new WirelessModule(this.graphControl, null, null, null); graphControl.AddShape(wirelessModule, new PointF(wirelessModule.Location.X + 440, wirelessModule.Location.Y + 80)); break; //B16 有线媒介 case "WiredMedia": wiredMedia = new WiredMedia(this.graphControl, null, null, null); graphControl.AddShape(wiredMedia, new PointF(wiredMedia.Location.X + 440, wiredMedia.Location.Y + 160)); break; //B17 无线媒介 case "WirelessMedia": wirelessMedia = new WirelessMedia(this.graphControl, null, null, null); graphControl.AddShape(wirelessMedia, new PointF(wirelessMedia.Location.X + 440, wirelessMedia.Location.Y + 240)); break; //18 寄存器 case "Register": register = new Register(this.graphControl, null, null, null); graphControl.AddShape(register, new PointF(register.Location.X + 550, register.Location.Y)); break; //B19 存储器RAM case "RAM": ram = new RAM(this.graphControl, null, null, null); graphControl.AddShape(ram, new PointF(ram.Location.X + 550, ram.Location.Y + 80)); break; //B20 存储器ROM case "ROM": rom = new ROM(this.graphControl, null, null, null); graphControl.AddShape(rom, new PointF(rom.Location.X + 550, rom.Location.Y + 160)); break; //B21 数据存储器 case "DataMemory": dataMemory = new DataMemory(this.graphControl, null, null, null); graphControl.AddShape(dataMemory, new PointF(dataMemory.Location.X + 550, dataMemory.Location.Y + 240)); break; //B22 缓冲区 case "Buffer": buffer = new MyBuffer(this.graphControl, null, null, null); graphControl.AddShape(buffer, new PointF(buffer.Location.X + 550, buffer.Location.Y + 320)); break; //B23 路由模块 case "RouteModule": routeModule = new RouteModule(this.graphControl, null, null, null); graphControl.AddShape(routeModule, new PointF(routeModule.Location.X + 330, routeModule.Location.Y + 320)); break; //B24 监控器 case "Monitor": monitor = new MyMonitor(this.graphControl, null, null, null); graphControl.AddShape(monitor, new PointF(monitor.Location.X + 220, monitor.Location.Y + 240)); break; //B25 血压监控器 case "BloodPressureMonitor": bpMonitor = new BloodPressureMonitor(this.graphControl, null, null, null); graphControl.AddShape(bpMonitor, new PointF(bpMonitor.Location.X + 220, bpMonitor.Location.Y + 280)); break; //B26 体温监控器 case "TemperatureMonitor": tempMonitor = new TemperatureMonitor(this.graphControl, null, null, null); graphControl.AddShape(tempMonitor, new PointF(tempMonitor.Location.X + 220, tempMonitor.Location.Y + 320)); break; //B27 心率监控器 case "HeartRateMonitor": hrMonitor = new HeartRateMonitor(this.graphControl, null, null, null); graphControl.AddShape(hrMonitor, new PointF(hrMonitor.Location.X + 220, hrMonitor.Location.Y + 360)); break; //====================================================================// //======================CMIoT组件库中组件=============================// //====================================================================// //C01 患者组件 case "Patient": patient = new Patient(this.graphControl); graphControl.AddShape(patient, patient.Location); break; //C02 血压传感节点 case "BloodPressureSensorNode": BPSN = new BloodPressureSensorNode(this.graphControl); //BPSN_InsideForm = new InsideForm(BPSN); //构建内部结构 graphControl.AddShape(BPSN, BPSN.Location); break; //C03 体温传感节点 case "TemperatureSensorNode": TSN = new TemperatureSensorNode(this.graphControl); graphControl.AddShape(TSN, TSN.Location); break; //C04 心率传感节点 case "HeartRateSensorNode": HRSN = new HeartRateSensorNode(this.graphControl); graphControl.AddShape(HRSN, HRSN.Location); break; //C05 物联网网关 case "IoTGateway": IoTG = new IoTGateway(this.graphControl); graphControl.AddShape(IoTG, IoTG.Location); break; //C06 802.11信道组件 case "802.11Channel": channel_802_11 = new Channel802_11(this.graphControl, null, null, null); graphControl.AddShape(channel_802_11, channel_802_11.Location); break; //C07 802.15.1信道组件 case "802.15.1Channel": channel802_15_1 = new Channel802_15_1(this.graphControl, null, null, null); graphControl.AddShape(channel802_15_1, channel802_15_1.Location); break; //C08 802.15.4信道组件 case "802.15.4Channel": channel802_15_4 = new Channel802_15_4(this.graphControl, null, null, null); graphControl.AddShape(channel802_15_4, channel802_15_4.Location); break; //C09 Ethernet信道组件 case "EthernetChannel": channel_ethernet = new ChannelEthernet(this.graphControl, null, null, null); graphControl.AddShape(channel_ethernet, channel_ethernet.Location); break; //C10 IPv6路由器组件 case "IPv6Router": ipv6Router = new IPv6Router(this.graphControl); graphControl.AddShape(ipv6Router, ipv6Router.Location); break; //C11 医疗服务器组件 case "MedicalServer": MS = new MedicalServer(this.graphControl); graphControl.AddShape(MS, MS.Location); break; } } // if (treeView1.SelectedNode.Level > 1) } //treeView1_NodeMouseDoubleClick
} //private void Run_Click(object sender, EventArgs e) /*********************************************** * 函数名称:ComponentsStartRun() * 功能:依据组件类型启动执行相应的组件 * 参数:component 相应启动执行的组件 * 返回值:无 * **********************************************/ private void ComponentsStartRun(Component component) { // 若组件为B01:血压组件 if (component.GetType().Name == "BloodPressure") { bloodPressure = (BloodPressure)component; int x = 1; //设定血压数据获取方式 //创建生成血压数据的线程 //Thread GeneratingBPData_thread = new Thread(bloodPressure.GeneratingBloodPressureData); //不带参数创建Thread //GeneratingBPData_thread.Start(); //启动线程 Thread bp_thread = new Thread(new ParameterizedThreadStart(bloodPressure.run)); //带1个参数传递的线程创建 bp_thread.Start(x); } // 若组件为B02:体温组件 else if (component.GetType().Name == "Temperature") { temperature = (Temperature)component; int x = 1; //设定体温数据获取方式 //创建生成体温数据的线程 Thread temp_thread = new Thread(new ParameterizedThreadStart(temperature.run)); //带1个参数传递的线程创建 temp_thread.Start(x); } // 若组件为B03:心率组件 else if (component.GetType().Name == "HeartRate") { heartRate = (HeartRate)component; int x = 1; //设定心率数据获取方式 //创建生成心率数据的线程 Thread hr_thread = new Thread(new ParameterizedThreadStart(heartRate.run)); //带1个参数传递的线程创建 hr_thread.Start(x); } // 若组件为B04:血压传感器组件 else if (component.GetType().Name == "BloodPressureSensor") { bloodPressureSensor = (BloodPressureSensor)component; //创建血压传感器执行的线程 Thread bps_thread = new Thread(bloodPressureSensor.run); bps_thread.Start(); } // 若组件为B07:显示控制器组件 else if (component.GetType().Name == "DisplayController") { displayController = (DisplayController)component; displayController.run(); } //若组件为B10:微处理器组件 else if (component.GetType().Name == "MicroProcessor") { microProcessor = (MicroProcessor)component; //int x = 1; //设定封装为6LoWPAN报文格式 string x = "6LoWPAN"; //设定封装为6LoWPAN报文格式 //创建微处理器执行的线程 Thread mp_thread = new Thread(new ParameterizedThreadStart(microProcessor.run)); mp_thread.Start(x); } // 若组件为B24:监控器器组件 else if (component.GetType().Name == "MyMonitor") { MyMonitor myMonitor = (MyMonitor)component; myMonitor.run(); } //若组件为B25:血压监控器 else if (component.GetType().Name == "BloodPressureMonitor") { BloodPressureMonitor bpMonitor = (BloodPressureMonitor)component; bpMonitor.run(); } //若组件为B26:体温监控器 else if (component.GetType().Name == "TemperatureMonitor") { TemperatureMonitor tempMonitor = (TemperatureMonitor)component; tempMonitor.run(); } //B27 心率监控器 else if (component.GetType().Name == "HeartRateMonitor") { HeartRateMonitor hrMonitor = (HeartRateMonitor)component; hrMonitor.run(); } // 若组件为C01:患者组件 else if (component.GetType().Name == "Patient") { patient = (Patient)component; //创建患者组件执行的线程 Thread patient_thread = new Thread(patient.run); //不带参数创建Thread patient_thread.Start(); //启动线程 //+++++++++++++++++++ Debug +++++++++++++++++++++++++++++++++// //foreach (int[] arr in patient.output_ports[0].Port_queue1) //{ // Console.WriteLine("血压数据:" + arr[0] + " " + arr[1]); //} //foreach (double arr in patient.output_ports[1].Port_queue1) //{ // Console.WriteLine("体温数据:" + arr); //} //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// } //若组件为C02:血压传感节点组件 else if (component.GetType().Name == "BloodPressureSensorNode") { BPSN = (BloodPressureSensorNode)component; //创建血压传感节点组件的线程 Thread bpsn_thread = new Thread(BPSN.run); //不带参数创建Thread bpsn_thread.Start(); //启动线程 } //若组件为C03:体温传感节点组件 else if (component.GetType().Name == "TemperatureSensorNode") { TSN = (TemperatureSensorNode)component; //创建体温传感节点组件的线程 Thread tsn_thread = new Thread(TSN.run); //不带参数创建Thread tsn_thread.Start(); //启动线程 } //若组件为C04:心率传感节点组件 else if (component.GetType().Name == "HeartRateSensorNode") { HRSN = (HeartRateSensorNode)component; //创建心率传感节点组件的线程 Thread hrsn_thread = new Thread(HRSN.run); //不带参数创建Thread hrsn_thread.Start(); //启动线程 } //若为C05:物联网网关组件 else if (component.GetType().Name == "IoTGateway") { IoTG = (IoTGateway)component; //创建物联网网关组件执行的线程 Thread gateway_thread = new Thread(IoTG.run); gateway_thread.Start(); } //若为C07:802.15.1Channel组件 else if (component.GetType().Name == "Channel802_15_1") { channel802_15_1 = (Channel802_15_1)component; //创建802.15.1Channel组件执行的线程 Thread channel_802151_thread = new Thread(channel802_15_1.run); channel_802151_thread.Start(); } //若为C08:802.15.4Channel组件 else if (component.GetType().Name == "Channel802_15_4") { channel802_15_4 = (Channel802_15_4)component; //创建802.15.4Channel组件执行的线程 Thread channel_802154_thread = new Thread(channel802_15_4.run); channel_802154_thread.Start(); } //若为C09:Ethernet信道组件 else if (component.GetType().Name == "ChannelEthernet") { channel_ethernet = (ChannelEthernet)component; //创建EthernetChannel组件执行的线程 Thread channel_ethernet_thread = new Thread(channel_ethernet.run); channel_ethernet_thread.Start(); } //若为C10:IPv6路由器组件 else if (component.GetType().Name == "IPv6Router") { ipv6Router = (IPv6Router)component; //创建IPv6Router组件执行的线程 Thread ipv6_router_thread = new Thread(ipv6Router.run); ipv6_router_thread.Start(); } //若为C11:医疗服务器组件 else if (component.GetType().Name == "MedicalServer") { MS = (MedicalServer)component; //创建MedicalServer组件执行线程 Thread ms_thread = new Thread(MS.run); ms_thread.Start(); } }
private List getRPMFiles(File dir, MyMonitor monitor) { List rpms = new ArrayList(); File[] list = dir.listFiles(new FileFilter() {
public Form1() { InitializeComponent(); m = new MyMonitor(); }