Пример #1
0
        private void MonitorView_MouseDown(object sender, MouseEventArgs e)
        {
            bool clicked = false;

            foreach (List <Device> deviceList in devices.Values)
            {
                foreach (Device device in deviceList)
                {
                    if (device.ClickDevice(e.X, e.Y))
                    {
                        try
                        {
                            Resource info      = deviceManager.GetResource(device.DeviceClass, device.State);
                            string   stateDesc = null;
                            if (info != null)
                            {
                                stateDesc = info.StateDesc;
                            }

                            ViewClickArgs state = new ViewClickArgs(e.Button.ToString(),
                                                                    device.DeviceClass,
                                                                    device.DeviceNo,
                                                                    device.State,
                                                                    stateDesc);

                            context.ProcessDispatcher.WriteToProcess(context.ViewProcess, "DeviceClick", state);
                        }
                        catch (Exception ex)
                        {
                            Logger.Debug("MonitorView出错。原因:" + ex.Message);
                        }
                        clicked = true;
                        break;
                    }
                }
                if (clicked)
                {
                    break;
                }
            }
        }
Пример #2
0
        private void MonitorView_MouseDown(object sender, MouseEventArgs e)
        {
            bool clicked = false;
            foreach (List<Device> deviceList in devices.Values)
            {
                foreach (Device device in deviceList)
                {
                    if (device.ClickDevice(e.X, e.Y))
                    {
                        try
                        {
                            Resource info = deviceManager.GetResource(device.DeviceClass, device.State);
                            string stateDesc = null;
                            if (info != null)
                            {
                                stateDesc = info.StateDesc;
                            }

                            ViewClickArgs state = new ViewClickArgs(e.Button.ToString(),
                                                                    device.DeviceClass,
                                                                    device.DeviceNo,
                                                                    device.State,
                                                                    stateDesc);

                            context.ProcessDispatcher.WriteToProcess(context.ViewProcess, "DeviceClick", state);
                        }
                        catch (Exception ex)
                        {
                            Logger.Debug("MonitorView�����ԭ��" + ex.Message);
                        }
                        clicked = true;
                        break;
                    }
                }
                if (clicked)
                    break;
            }
        }