|
Thank you, thank you and thank you!
1 ) What about this situation:
(current user time line)
SYSTEM START>------|------------|--------|----------|------->NOW
user A|user B |user C |user B |user A
where "|" is a logout/switch operation.
And I want to calculate how long the user A used computer. Your Duration property calculates duration assuming that all these users are STILL logged in.
I suppose a property "LogOutTime " would do that.
2 ) How do you know that?? Please post some knowledge source - I couldn't find it anywhere.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
unfortunately it seems there is no LogOutTime property (at least I didn't found out anyOne)
but AFAIK In windows only on user can work at the same time
so there is a class in .NET name Microsoft.Win32.SystemEvents.SessionEnding it happens when a user trying to logoff or shutdown
so you can find active user through WMI again or through System.Environment.UserName
and find you are in which session.
I think with adding the event to the class you can find total duration.(but it needs your program always run or atleaset when user is going to logout or shutdown)
if you get the duration inside the method associated with that event it would be total user log time.
ofcourse there is another approaches like looking inside eventlogs but i think this is the easiest one
hope the post would be useful
|
|
|
|
|
Thanks!
However it seems to be difficult to get a real duration because of Windows hibernate service.
UserLogonData.GetUsersLogonTime(Environment.UserName) returns an array which contains two items. NOW it looks like I'm sitting on this chair for
LoggedDuration {1.04:01:07} - from yesterday evening, when Windows was hibernated (28 hours?? Oh God...).
or
LoggedDuration {01:49:33.6101250} - today (almost two hours, not so bad)
?
"AFAIK In windows only on user can work at the same time":
Yes, but more than one may be logged in at the same time AND one user can work more than one time in the single system session (if e.g. some other guy kicked him out for a while because he "just wanted to check mailbox", but after that that guy could return back -- and I want to know how (totally) this first guy was sitting on the chair).
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
first sorry for delay I was in vacation
yes you're right it cannot be done as straight as a simple win App
but with services you can, and writing services in .NET is not harder than writing simple winApp
it can be done with services because they'll works even when a user switch or logoff.
and I think you must log some data byyourself if you need accurate times (like finding hibernate time and subtract it and ...)
gajatko wrote: if e.g. some other guy kicked him out for a while because he "just wanted to check mailbox", but after that that guy could return back
there is another event in SystemEvents Class name SessionSwitch it will occur when the user going to change so I think UserSwitch would be included and when you hibernate it seems something like userSwitch happens (but I'm not sure) so maybe this event would be useful.
gajatko wrote: from yesterday evening, when Windows was hibernated (28 hours?? Oh God...).
another event is PowerModeChanged which will return your computer is going to suspend mode or not and hibernate is counted as a suspend mode (atleast in .NET)this event may help to retrieve hibernate status too.
and at last I think you can retrieve some data from the Service status (like Puase/Stop) and use it for finding machine state like shutdown hibernate
good luck
|
|
|
|
|
hi
i have a Main_form and Detail_form.
in my Main_form, i have a public method as 'LoadData' to load data and show it in gridView, here is my method code :
public void LoadData()<br />
{<br />
this.gridControl1.DataSource = null;<br />
DataAccess.Command.CommandText = "SELECT * FROM v_fish_grid";<br />
DataAccess.Command.CommandType = System.Data.CommandType.Text; <br />
if (DataAccess.Connection.State == ConnectionState.Closed)<br />
DataAccess.Connection.Open();<br />
DataAccess.Reader = DataAccess.Command.ExecuteReader();<br />
this.dt.Load(DataAccess.Reader);<br />
DataAccess.Reader.Close();<br />
if (DataAccess.Connection.State == ConnectionState.Open)<br />
DataAccess.Connection.Close();<br />
this.gridControl1.DataSource = this.dt.DefaultView;<br />
}
in Detail_form, i want when user insert,update or delete data,call the LoadData method in Main_form from Detail_form, i do this but my gridView's records was not update(i trace my LoadData method in runTime and dt object get recoreds but i don't know why my data does not load in gridView)
How to solve My problem ? thanks
|
|
|
|
|
I want to create and element with data, like this:
<Song FileName="DJ Style & MC Loran - Ragga Pumpin [Promo Mix].mp3" FileSize="8782157" TagDate="511031848">
<Infos SongLength="16136064" Date="511031848" />
</Song>
How can i create the FileName and the FileSize, and how can i get them from another node?
Thanks
|
|
|
|
|
When searching for nodes using XPath, use @ to specify that you're searching an attribute.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Don't start new threads all the time: when the topic continues to be the same, as
is obvious from your post, add a message to your earlier thread.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
when you can't help me, why post here ?
|
|
|
|
|
hdv212 wrote: when you can't help me, why post here ?
With over 300 messages posted, you should already be aware it is considered
rude to start a new thread unnecessarily, to modify a message without marking
it as modified, as well as to delete a message once it has one or more replies.
At the time I could not help you, since your message seemed empty;
now I can't because it's gone.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: Don't start new threads all the time: when the topic continues to be the same
Geeze, that is still going on around here
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Did you ever notice a little checkbox marked "Ignore HTML tags in this message" ?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I have changed it
Thanks for the tip.
Can you help me?
|
|
|
|
|
i have two web applications
i want to host both the sites in the same webspace
can i do it
if so how can i do it
please help me out...
thanks bye
|
|
|
|
|
Wrong area to post try ASP.net forums:->
|
|
|
|
|
I am currently developing a File Downloader using C#.net 2005.
So,In My Project How to catch Url from internet explorer when user try to download that file from internet?Means when user click for downloading particular file then the Url of that file is catched in my Downloader so my Downloader will start downloading that file.So how to integrate my Downloader with internet explorer?
|
|
|
|
|
Hi,
I'd like to know why after calling
_tcpClient.Client.LingerState = new LingerOption(false, 0);
_tcpClient.Client.Shutdown(SocketShutdown.Both);
_tcpClient.Client.Disconnect(true);
, when I try to connect again, I get a Socket already connected exception.
I dont know what else to try, please help!
|
|
|
|
|
pease gime me date time picker(dtp)surce code for send values oledb database
|
|
|
|
|
Please don't double post. Your question is unintelligible. You just pass a datetime to the database, the datetime picker is irrelevant to the process.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: question is unintelligible
Yes, and it is a simple process he is trying to do.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
i make progamm.database is oledb.how to send c# date time picker detail to oledb database.please help.give me this soruce code.
|
|
|
|
|
you need to oledbconnection
oledbcommand or oledbdataadapter
command="insert into tablename (dateTime)values('"+datetime.date.now()+"')";
Rami Abdalhalim
|
|
|
|
|
Don't double post. See the response you got from Christian.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello all,
I wonder if the following problem is possible in c#:
I have two classes named class1 & class2 both having two functions named func1 & func2 . Although the function names are the same, what they do are different for two classes.
I want to declare only one object to use these functions.
In order to do what the following code portion does
class1 obj1 = new class1();
class2 obj2 = new class2();
if (selection == 1)
obj1.func1();
else if (selection == 2)
obj2.func1();
I need a shorter and smarter way i.e;
The above code is possible but it is too long. You should write if statements every time you want to call the functions. So I want to do this with a shorter code:
I have an object which is assigned to the obj1 or obj2 (which are declared as above) depending on the selection at the beginning of the program, then you can call the funcs just by obj.func1()
I dont want to write if statements each time i am calling the functions.
Declaring an object of type object is OK but this time you have to cast the obj which is of type object to class1 (or class2 ) each time you are calling the functions. So casting is a not a solution either. I think i am looking for something like "Permanent casting" (if exists of course)?
P.S : One of the classes may have extra funcs which the other doesnt contain so "Inheritance" is not enough
Regards
Zafer
-- modified at 4:36 Saturday 25th August, 2007
|
|
|
|
|
Create a base class, and two derived classes, then you can call the method, and it's different based on which type of class the instance is.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|