public override void Update(UpdateParamater updatePara, CatController cc) { if (!greeting) { greeting = true; greetingMsg = memorialDays.GetDay((uint)DateTime.Today.Month, (uint)DateTime.Today.Day).HandledDescription; } if (cc.Execute(cc.Commands["Greet"], new string[] { greetingMsg })) { greeting = false; } }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.Transform = layoutEngine.YearPosition; e.Graphics.DrawString(CurrentYear.ToString(), font, Brushes.DarkBlue, orgPos, stringFormat); e.Graphics.Transform = layoutEngine.MonthPosition; e.Graphics.DrawString(CurrentMonth.ToString(), font, Brushes.DarkBlue, orgPos, stringFormat); string[] weekdayStr = { "Su.", "Mo.", "Tu.", "We.", "Th.", "Fr.", "Sa." }; uint wd = 0; using (Brush brush = new SolidBrush(Color.FromArgb(unchecked ((int)0xff73bd8c)))) { foreach (Matrix tm in layoutEngine.WeekdayPositions) { e.Graphics.Transform = tm; e.Graphics.DrawString(weekdayStr[wd++], font, brush, orgPos, stringFormat); } } uint days = 1; GraphicsPath gp = new GraphicsPath(); using (Brush brush = new SolidBrush(Color.FromArgb(unchecked ((int)0xffffe6d6)))) { Pen pen = new Pen(brush, 4); foreach (Matrix tm in layoutEngine.DayPositions) { e.Graphics.Transform = tm; gp.AddString(days.ToString(), fontFamily, (int)FontStyle.Regular, layoutEngine.FontSize, orgPos, stringFormat); if (memorialDays.GetDay(CurrentMonth, days) != null) { e.Graphics.DrawPath(pen, gp); } e.Graphics.FillPath(Brushes.OrangeRed, gp); gp.Reset(); ++days; } pen.Dispose(); } }