public void GetServerTime() { Host master = Helpers.GetMaster(Pool); if (master != null) { GetServerTimeAction action = new GetServerTimeAction(master); action.Completed += action_CompletedTimeServer; action.RunAsync(); } }
void action_CompletedTimeServer(ActionBase sender) { GetServerTimeAction action = (GetServerTimeAction)sender; Program.Invoke(Program.MainWindow, () => { string serverLocalTimeString = action.Result; if (serverLocalTimeString != "") { DateTime serverLocalTime = DateTime.Parse(serverLocalTimeString, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind); serverLocalTimeString = HelpersGUI.DateTimeToString(serverLocalTime, Messages.DATEFORMAT_WDMY_HM_LONG, true); } labelServerTime.Text = string.Format(Messages.SERVER_TIME, serverLocalTimeString); }); }