Beispiel #1
0
        static UCSingleCabinetControl()
        {
            var control = new UCSingleCabinetControl();

            _titleHeight  = ((GridLength)control.Resources["titleHeight"]).Value;
            _bottomHeight = ((GridLength)control.Resources["bottomHeight"]).Value;
        }
Beispiel #2
0
        private void UpdateCabinet()
        {
            this.Dispose();//释放前一次资源

            CabinetInfoGroup cabinetInfoGroup = this.CabinetInfoGroup;

            if (cabinetInfoGroup == null)
            {
                return;
            }

            tbTitle.Text = this.ConvertTitleToVertical(cabinetInfoGroup.Name);
            if (cabinetInfoGroup.Count == 0)
            {
                return;
            }

            byte cabinetMaxHeight = cabinetInfoGroup.Max(t => { return(t.Height); });

            this.Height = UCSingleCabinetControl.CalCabinetControlHeight(cabinetMaxHeight);
            this.Width  = CalCabineRowControlWidth(cabinetInfoGroup.Count, this.CabinetWidth, this.Separator, this.RowNameVisible);

            double left = 0d;

            foreach (CabinetInfo cabinetInfo in cabinetInfoGroup)
            {
                var singleCabinetControl = new UCSingleCabinetControl();
                singleCabinetControl.SelectedDeviceChanged += SingleCabinetControl_SelectedDeviceChanged;
                singleCabinetControl.DeviceNameStyle        = this.DeviceNameStyle;
                singleCabinetControl.CabinetNameStyle       = this.CabinetNameStyle;
                singleCabinetControl.CabinetInfo            = cabinetInfo;
                singleCabinetControl.Width = this.CabinetWidth;
                canvas.Children.Add(singleCabinetControl);

                Canvas.SetBottom(singleCabinetControl, 0d);
                Canvas.SetLeft(singleCabinetControl, left);
                left = left + this.Separator + this.CabinetWidth;
            }
        }