如何在客户端系统中的应用程序mdi表单上显示服务器时间 [英] How to display server time on the application mdi form in client system

查看:74
本文介绍了如何在客户端系统中的应用程序mdi表单上显示服务器时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

b


 在我的应用程序中,我想在MDI表单上显示服务器系统时间(如果应用程序在服务器或客户端系统上运行)。我想根据间隔时间设置间隔时间和显示消息框,这不应该打扰或停止用户工作
和应用程序性能



是最好使用多线程



并且可以在不使用计时器的情况下进行。


给我示例代码在vb.net中$


等待回复......................


Hi,

  In my Application i want to display server system time on MDI form(if the application runs at Server or client system). and i want to set interval time and display message box based on that interval time and this should not disturb or stop the user work and application performance

is it better to use multithreading

and is it possible to do without using timer

give me sample code in vb.net

waiting for reply......................

推荐答案

您好,

您应首先创建一个返回给您的WebService在正确的DateTime Formation中更正DateTime。在你的客户端App中,引用部署在服务器上的WebService,你应该启动一个线程来捕获Webservice的结果,代码片段可以
为此(不检查代码是否正确)或者不是,只是一个想法的样本......)

You should first create a WebService that returns you a correct DateTime in a proper DateTime Formation。And in your client App,refer that WebService deployed on the Server and you should start a thread to catch the Webservice's result,Snippet of codes can be this(not check whether codes are right or not,just a sample for ideas……)

'Get the SystemTime from a certain WebService……
Dim gst As YourWebService's Class = New ……

Private Sub Form_Load (……)
     Dim ths() As Thread = New Thread(){New Thread(New ThreadStart(GetSystemTime)),New Thread(new ThreadStart(EventUp)}
     MDi's Label.Invoke(New Action(Function() th(0).Start()))
     th(1).Start()
End Sub

Private Sub GetSystemTime()
    While(True)
          Thread.Sleep(1000)    '1second to show time....
          MDi's Label.Text = gst.GetTimeFunction()
    End While
End Sub

Private Sub EventUp()
    While(True)
          Thread.Sleep(YourTime such as 1000)
          msgBox(……)
    End While
End Sub


这篇关于如何在客户端系统中的应用程序mdi表单上显示服务器时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆