Example #1
0
        /// <summary>
        /// ����������� ������.
        /// </summary>
        /// <param name="device">�������������� ����������.</param>
        public DeviceDiagram(IDevice device, string hostName)
        {
            if (device == null)
                throw new ArgumentNullException("device");

            _device = device;

            _hostName = hostName;

            _partitionControls = new List<PartitionControl>();

            // �������� ������� �����������.
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            MinimumSize = new Size(150, 150);

            foreach (IPartition part in _device.GetPartitions())
            {
                _partitionControls.Add(new PartitionControl(this, part, _hostName));
            }

            _device.PropertyChanged += new EventHandler<DeviceEventArgs>(_device_PropertyChanged);
            _device.PartitionAdded += new EventHandler<DeviceEventArgs>(_device_PartitionAdded);
            _device.PartitionRemoved += new EventHandler<DeviceEventArgs>(_device_PartitionRemoved);

            _centerControl = new DeviceControl(this, _device);

            RearrangePartitions();
        }