private bool _finished;\r
private DateTime _endTime;\r
\r
+ public bool Minus { private get; set; }\r
+\r
public bool IsFinished(DateTime now) => _endTime != DateTime.MinValue && _endTime - now < _spare || _finished;\r
\r
public AlarmTimer(int spare = 60)\r
if (endTime)\r
return _endTime.ToString(@"dd\ HH\:mm", CultureInfo.InvariantCulture);\r
var rest = _finished || _endTime - now < TimeSpan.Zero ? TimeSpan.Zero : _endTime - now;\r
- return $"{(int)rest.TotalHours:d2}:" + rest.ToString(@"mm\:ss", CultureInfo.InvariantCulture);\r
+ return $"{(Minus && rest != TimeSpan.Zero ? "-" : "")}{(int)rest.TotalHours:d2}:" +\r
+ rest.ToString(@"mm\:ss", CultureInfo.InvariantCulture);\r
}\r
}\r
}
\ No newline at end of file
}\r
_missions[id].Name = _missionNames.TryGetValue((int)mission[1], out var name) ? name : "不明";\r
_missions[id].Timer.SetEndTime(mission[2]);\r
+ _missions[id].Timer.Minus = (int)mission[0] == 3;\r
}\r
}\r
\r
Location = new Point(LeftMargin + 30, y),\r
Size = new Size(135, LabelHeight)\r
},\r
- Timer = new Label\r
+ Timer = new GrowLeftLabel()\r
{\r
- Location = new Point(LeftMargin + 165, y),\r
- Size = new Size(51, LabelHeight),\r
- TextAlign = ContentAlignment.MiddleRight\r
+ Location = new Point(LeftMargin + 216, y),\r
+ GrowLeft = true\r
}\r
};\r
}\r
- Controls.AddRange(_labels.SelectMany(l => new Control[] {l.Number, l.Params, l.Name, l.Timer}).ToArray());\r
+ Controls.AddRange(_labels.SelectMany(l => new Control[] {l.Number, l.Params, l.Timer, l.Name}).ToArray());\r
SetCursor();\r
SetClickHandler();\r
}\r