Esempio n. 1
0
        private void ShowTime(int unit)
        {
            if (_ITime != null)
            {
                Controls.Remove(_ITime.Control);
            }

            switch (unit)
            {
                case CGtd.UNIT_SECOND:
                    if (_UcSecond == null)
                    {
                        _UcSecond = new UcSecond();
                        _UcSecond.Init(DtStart.Value);
                        InitView(_UcSecond);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcSecond;
                    break;
                case CGtd.UNIT_MINUTE:
                    if (_UcMinute == null)
                    {
                        _UcMinute = new UcMinute();
                        _UcMinute.Init(DtStart.Value);
                        InitView(_UcMinute);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcMinute;
                    break;
                case CGtd.UNIT_HOUR:
                    if (_UcHour == null)
                    {
                        _UcHour = new UcHour();
                        _UcHour.Init(DtStart.Value);
                        InitView(_UcHour);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcHour;
                    break;
                case CGtd.UNIT_DAY:
                    if (_UcDay == null)
                    {
                        _UcDay = new UcDay();
                        _UcDay.Init(DtStart.Value);
                        InitView(_UcDay);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcDay;
                    break;
                case CGtd.UNIT_WEEK:
                    if (_UcWeek == null)
                    {
                        _UcWeek = new UcWeek();
                        _UcWeek.Init(DtStart.Value);
                        InitView(_UcWeek);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcWeek;
                    break;
                case CGtd.UNIT_MONTH:
                    if (_UcMonth == null)
                    {
                        _UcMonth = new UcMonth();
                        _UcMonth.Init(DtStart.Value);
                        InitView(_UcMonth);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcMonth;
                    break;
                case CGtd.UNIT_YEAR:
                    if (_UcYear == null)
                    {
                        _UcYear = new UcYear();
                        _UcYear.Init(DtStart.Value);
                        InitView(_UcYear);
                    }
                    _Editor.StopEnabled = true;
                    _ITime = _UcYear;
                    break;
                default:
                    if (_UcNone == null)
                    {
                        _UcNone = new UcNone();
                        _UcNone.Init(DtStart.Value);
                        InitView(_UcNone);
                    }
                    _Editor.StopEnabled = false;
                    _ITime = _UcNone;
                    return;
            }

            Controls.Add(_ITime.Control);
            _ITime.ShowData(MGtd);
        }