private ToolBarDateTimeEdit(Codon codon, object caller, DateTimePicker dtEdit) : base(dtEdit) { this.menuCommand = null; this.RightToLeft = RightToLeft.Inherit; this.caller = caller; this.codon = codon; this.dtEdit = dtEdit; if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("时间编辑器的时间是:{0}", new object[] { dtEdit.Value }); } this.dtEdit.Width = Convert.ToInt32(codon.Properties["width"]); try { this.CreateCommand(); } catch (Exception exception) { LoggingService.Error(exception); } if (!this.menuCommand.EditValue.HasValue) { this.dtEdit.Value = DateTime.Now; } else { this.dtEdit.Value = this.menuCommand.EditValue.Value; } this.dtEdit.ValueChanged += new EventHandler(this.EditValueChanged); this.UpdateStatus(); this.UpdateText(); }
private void CreateCommand() { this.menuCommand = (AbstractDateTimeEditCommand) this.codon.AddIn.CreateObject(this.codon.Properties["class"]); this.menuCommand.ID = this.codon.Id; this.menuCommand.Owner = this; this.menuCommand.Codon = this.codon; }