private void timer1_Tick(object sender, EventArgs e) { if (_game != null) { TimeInformation blackTime = _game.Controller.Players.Black.Clock.GetDisplayTime(false); lblTimeBlackMain.Text = blackTime.MainText; lblTimeBlackSub.Text = blackTime.SubText; TimeInformation whiteTime = _game.Controller.Players.White.Clock.GetDisplayTime(false); lblTimeWhiteMain.Text = whiteTime.MainText; lblTimeWhiteSub.Text = whiteTime.SubText; } }
/// <summary>Validate the document and all its signatures</summary> /// <returns>the validation report</returns> public virtual ValidationReport ValidateDocument() { DateTime verificationTime = DateTime.Now; TimeInformation timeInformation = new TimeInformation(verificationTime); IList <SignatureInformation> signatureInformationList = new AList <SignatureInformation >(); foreach (AdvancedSignature signature in GetSignatures()) { signatureInformationList.AddItem(ValidateSignature(signature, signature.GetSigningTime () == null ? DateTime.Now : signature.GetSigningTime().Value)); } return(new ValidationReport(timeInformation, signatureInformationList)); }
/// <summary> /// 系统时间信息结构体 /// </summary> /// <returns></returns> public static TimeInformation GetSystemTimeInformation() { try { TimeInformation memInfor = new TimeInformation(); GetSystemTime(ref memInfor); return(memInfor); } catch (Exception) { return(new TimeInformation()); } }
public static TimeControlTexts TranslateSubtext(TimeInformation information, TimeControl control) { if (control.IsViolating()) { return(new TimeControlTexts(Localizer.TimeControl_TimeExceeded, null)); } switch (information.Style) { case TimeControlStyle.None: return(TranslateNoneSubtext()); case TimeControlStyle.Japanese: return(TranslateJapaneseSubtext(information as JapaneseTimeInformation, control as JapaneseTimeControl)); case TimeControlStyle.Canadian: return(TranslateCanadianSubtext(information as CanadianTimeInformation, control as CanadianTimeControl)); case TimeControlStyle.Absolute: return(TranslateAbsoluteSubtext(information as AbsoluteTimeInformation)); } throw new Exception("Unknown time control."); }
/// <summary> /// Updates the time control /// </summary> public void Update() { bool graceSecond = _settings.Display.AddGraceSecond && _player.IsHuman && _isOnline; TimeInformation info = Clock.GetDisplayTime(graceSecond); TimeControlMainLine = TimeControlTranslator.TranslateMaintext(info); var tuple = TimeControlTranslator.TranslateSubtext(info, Clock); TimeControlSubLine = tuple.Subtext; TimeControlTooltip = tuple.Tooltip; if (_controller != null) { PrisonerCount = _player.Info.Color == StoneColor.Black ? (_controller.GameTree.LastNode?.Prisoners.BlackPrisoners ?? 0) : (_controller.GameTree.LastNode?.Prisoners.WhitePrisoners ?? 0) ; } RaisePropertyChanged(nameof(CapturesLine)); RaisePropertyChanged(nameof(IsTurnPlayer)); }
public static string TranslateMaintext(TimeInformation information) { return(information.MainText); }
public void UpdateTimeInfo(TimeInformation timeInfo) { this.TimeInfo = timeInfo; }
private static extern void GetSystemTime(ref TimeInformation stinfo);