如何在C#Windows应用程序的客户端PC上获取活动表单? [英] How to get the active form on the Client Pc In C# Windows Application?

查看:83
本文介绍了如何在C#Windows应用程序的客户端PC上获取活动表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是Yogesh Sharma,我已经开发了一个C#多用户Windows应用程序.现在,我需要向我的应用程序添加新功能.即:
我需要在服务器上,我需要跟踪当前登录的每个用户,
我需要查看当前在特定时间登录的用户,并且他/她正在使用哪种表单.是否可以...?请帮助.如果解决方案是多线程的话.
请提供一些逻辑示例.我只知道多线程的基本概念,请提供详细信息,因为很少有人知道如何实现此任务.
请为我紧急.甚至我都没有从Google获得帮助...
谢谢...任何帮助将不胜感激..

Hi I Am Yogesh Sharma I Have developed An C# Multi User Windows Application.. Now I Need to add an new functionality to my application..That Is:
i need that at server i need to keep the track of each user that are currently logged in,
i need to see which user is logged in currently at a particular time and also he/she is working on which form..Is It Possible...??Please Help..If Multithreading is the soluion.
Please provide some logic with example. I know just the basic concept of multithreading please provide details as not many know how to implement this task.
please help its urgent for me. even i am not getting help from google...
thanks in advanced...Any help will be highly appreciated..

推荐答案

您好,

我有一个解决方案,但我不知道它的正确与否.我正在与您分享.

您可以将一个像UserLog的表放入表中.
该表包含以下列.

UserLogID(PK), UserID(UserLoginID), Operatin(Which contains Add,Update,Delete,Login etc), Description(Any comments or description), CreatedDateTime(datetime)

现在,您可以使一个常用功能在此表中插入记录.
在您的项目中,您可以调用此函数并插入值.这样就可以跟踪每个用户.

例如.用户登录.因此,在验证用户名和密码后,您可以使用以下参数调用此函数.

UserLog(UserID,''Login'',''Member Login'',DATETIME.NOW);

现在,当您要跟踪哪个页面用户离开时,然后在每次页面加载时,都可以使用以下值调用此函数.

UserLog(UserID,''Usercomeson this page'',''User come on this page'',DATETIME.NOW);

您可以制作一个ENUM进行操作.

希望您能了解用户跟踪的想法.可能对您有帮助.

谢谢,
Viprat
Hi,

I have one solution but i don`t know its proper or not. I am sharing with you.

you can make one table like UserLog into the table.
That table contains the following columns.

UserLogID(PK), UserID(UserLoginID), Operatin(Which contains Add,Update,Delete,Login etc), Description(Any comments or description), CreatedDateTime(datetime)

Now you can make one common function to insert record in this this table.
In your project you can call this function and insert values. so can keep the track of every user.

For Example. User login. So after verifying username and password you can call this function with following parameters.

UserLog(UserID,''Login'',''Member Login'',DATETIME.NOW);

Now when you want to keep track on which page user gone then on every page load you can call this function with following value.

UserLog(UserID,''Usercomeson this page'',''User come on this page'',DATETIME.NOW);

you can make one ENUM for operations.

I hope you get my idea for user tracking. May be it help you.

Thanks,
Viprat


您可以创建一个xml文件,该文件会根据登录,注销等事件进行更新.
您可以创建另一个线程来监视表单并更新xml文件.
您有2个选择:
1.在客户端中创建一个xml文件,在固定的时间间隔后将其提取.
2.为服务器中的每个客户端创建一个xml文件.

在第二种情况下,您将获得有关客户行为的实时报告.

由于其xml易于解析数据.

Xml教程
关于如何使用c#读写xml文件的教程

由于您不太熟悉线程,因此可以通过使用事件来实现目标.
为您要监视的动作创建事件.
触发事件时,将信息写入xml文件.
由于您未提供代码,因此无法提供太多信息.
You can create a xml file which is updated on events like login,log out etc.
You can create another thread which monitors the form and updates the xml file.
You have 2 options:
1.create a xml file in client,fetch it after a fixed interval.
2.create a xml file for each client in server.

in 2nd case u will get a live report on client actions.

since its xml its easy to parse the data.

Xml Tutorial
Tutorial on how to read and write to xml file using c#

since you are not much familiar to threading, you can achieve your goal by using events.
create events for the actions you wanna monitor.
when the event is triggered write the info to xml file.
cant give much info since you havent provided the code.


这篇关于如何在C#Windows应用程序的客户端PC上获取活动表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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