|
Hi all,
Let me introduce you to the problem which I'm trying to cope with. I'm having two windows forms in 2 threads - one is a splash screen and the other one is the main window. On starting, the splash is visible and the main is hidden. I've written everything to the point where I've to implement signalling the splash that main is ready and closing the splash. What I've tried yesterday is to implement this with timers, so splash has a 100ms timer which checks a property on the mainwindow class and if it's true, then the splash closes itself. But then, how would I synchronise the closing of the splash with setting the main form visibility to true so they happen syncroniously(one after the other). What I've been thinking about is using events, but I'm not sure how to do this in cross-threads windows forms, ie how to design it. Should I have event for the main which is emitted when it's ready and the splash listens for this event? And then it closes itself and emits another signal that's has closed and the main listens for the closing signal of the splash? If so, how would I attach to listening to the signals across the threads? In my Main() function, I create both threads and I've two properties of the EntryPoint class(which contains the main and nothing else) - the splash form and the main form. And I have two methods which are used for the entry point of the the both, which are basically doing:
<br />
Application.Run(this.splashform);<br />
Any advice is greatly appreciated. Thanks for reading.
|
|
|
|
|
Why use 2 threads? You're introducing complexity unnecessarily.
In the constructor for your main window, I assume you have the InitializeComponent() call that actually initializes your main window. Change that constructor to
public MainWindow()
{
SplashWindow splash = new SplashWindow();
splash.Show();
InitializeComponent();
}
And when your MainWindow finishes loading (override the OnLoad method or create an OnLoad event handler), you can set the visibility of both forms synchronously.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
Wouldn't the splash be blocked by the main form and not receive events? Because that's what I think will happen and most solutions for a splash use threads. Or I could be wrong...
|
|
|
|
|
1nsp1r3d wrote:
Wouldn't the splash be blocked by the main form and not receive events?
No, the splash will be free to receive events. Using multiple threads to touch different UI components is a widely-known no-no anyways. If you update your splash screen, you may need to call .Update() to force a redraw, however, since the OS is busy loading your main form.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuals for Christ, Yeah!
Judah Himango
|
|
|
|
|
|
It has a collection of items, it may even be called Items. The collection has an Add method.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am trying to create a NT Service that will be able to monitor users logging on and off.
Or an NT service that can monitor an application like Internet explorer opening, running, and closing.
Basically I have an application that I want to run which will pause azureus from downloading. Basically to free up network resources for the user logging in.
I can create a NT service fine but don't know what methods or events to use in the service that will fire off when a user logs in or off in XP
and ideas?
|
|
|
|
|
The service geting notified of session logon and logoff events isn't hard. It's the other spec you have...
"Basically to free up network resources for the user loggin in." - WHAT? If a user is loggin onto XP, then there can't be anyone else downloading something. There's no network resources to free up.
You, also, can't stop someone from downloading something, while a user logs on, unless your service is also going to act as a proxy for network access.
Why would you even want to do this in the first place? Logon isn't exactly a network intensive operation.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Its not the logon I want to free up the network for...
I want to free up the network while the user is logged in to the machine.
Basically I will be running azurues on a machine that my family uses. They have all different logins to the machine. Mum, Dad, Sister, etc.
When I have azureus running under my account they can't browse the web becuase I am chewing up all the network. User fast switching allows my account to continue downloading through azureus ... while someone else logs in to browse the web and check their emails etc
I don't want to give them access to my account to pause/stop azurues.
I can build a small app that can talk azurues by using azurus xml over HTTP plugin. This is not a problem. But I don't want to have to have them manually stop/start azurues with this app as they may forget to restart it.
I wanted to make the whole process automated. So I was going to write a NT service that will pause azurues when a user logs in and resume download when they log off.
But I am not sure where to start looking to get the logon and logoff event.
As you say its not hard to do. But I am not sure where to look. It would be good if I could get the user id that is logging on and off So that I can select which accounts will pause azureus and which will allow it to continue running (ie my logon account).
|
|
|
|
|
Hi,
Recently I have several .NET solutions and I want to manage them by CVS (Concurrent Versions System). I am using WinCVS and I have a few questions:
1.Is there any special linkage of the CVS to the Visual Studio .NET?
2.Is the above way recommanded?
3.How can I know about the version of the .NET solution in the Visual Studio?
Thanks
|
|
|
|
|
1. no
2. I think CVS is crap, but your milage may vary
3. It's tied to the IDE VS2002 = 1.0, VS2003 = 1.1, VS2005 = 2.0
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What events can I monitor to implement in my service so that I can write to a log what time the user logged in and logged off and which user it was.
|
|
|
|
|
You can start out with the documentation here: WTSRegisterSessionNotification[^]. You want to pass NOTIFY_FOR_ALL_SESSIONS . I'm not sure how this works out with a service... you probably have to have the correct permissions set up.
[EDIT]Oops... there is a managed alternative. I've been coding in C++ for too long.
Alex Korchemniy
|
|
|
|
|
Thanks.
I found something else I think I might be able to use
Microsoft.Win32.SessionEndedEventArgs
and
Microsoft.Win32.SessionSwitchEventArgs
private void sessionSwitch(System.Object sender, _
Microsoft.Win32.SessionSwitchEventArgs e)
{
if (e.Reason == SessionSwitchReason.SessionLogon)
EventLog.WriteEntry("sessionSwitch", _
SystemInformation.UserName.ToString() + " logged on at " + _
DateTime.Now.TimeOfDay.ToString());
else if (e.Reason == SessionSwitchReason.SessionLogoff)
EventLog.WriteEntry("sessionSwitch", _
SystemInformation.UserName.ToString() + " logged off at " + _
DateTime.Now.TimeOfDay.ToString());
}
|
|
|
|
|
Doesn't seem to work.
I was not looking for terminal service.
Trying to create an NT service that can do stuff when a user logs on.. then do something else when the user logs off
|
|
|
|
|
Hello Every body...
I wanna send email by my application(SMTP Mail).Everything is ok when I send email to a yahoo email address.But when I try to send mails to another mail servers like Gmail I recieve the following Errors :
1 - When using localhost as SMTP mail server :
550 5.7.1 : Unable to relay for username@gmail.com
2- or (When using mx1.yahoo.com as smtp server) :
550 : Relaying Denied for <username@gmail.com>
How can I solve this problem.
Note : I use FreeSMTP.NET Component to sending Emails(http://www.quiksoftcorp.com/)
Best Regards,
|
|
|
|
|
Your mail server doesn't allow sending email to other servers. While yahoo's mail server will never allow relaying, you can configure your local mail server to allow relaying (Right click on My Computer->Manage, Services and Applications, Internet Information Services, right click on Default SMTP Virtual Server, go to the Access tab and click the Relay button).
Hope this helps.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Dear S. Senthil Kumar
Hi
Thank you very much for your clear answer.My problem solved.But I traped in another problem .Emails sent successfully from my application but they remained (Hanged) in the SMTP sending queue ! (C:\Inetpub\mailroot\Queue).
They are not in C:\Inetpub\mailroot\Badmail folder.But they didn't Sent !
How can I do with this problem.
Thanx for your Guid,
|
|
|
|
|
Hi,
I have a problem releted to Scribble(.pwi Format). I want to display this .pwi Format data which is stored in SQL Server Database Feild on Desktop Application. Is there any programming in VB, C# by which we can convert .pwi data in bitmap. Or is there any other solution to achinve it.
Brijesh Jaiswal
|
|
|
|
|
how to forbid F8 mode in Win2000 and WinXP?
HOW TO forbid safemode in Win2000 and WinXP?
|
|
|
|
|
Why would you want to ? I don't see how you could, for starters it happens before your code runs. Perhaps you can *detect* safe mode and refuse to run under it, is that what you want ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I know how this can be done. But it would be a great learning experience for you. Here's a few tips.
- Know assembly
- Know what goes on in the loader
- Find code that handles F8
- Patch things up... (most likely single byte patch)
- ... done
I hope your doing this for fun and not for some kind of software you're releasing. Besides, this doesn't have anything to do with c#.
Alex Korchemniy
|
|
|
|
|
Alex Korchemniy wrote:
Besides, this doesn't have anything to do with c#.
LOL - I knew this answer to, but he was obviously hoping for a C# solution...
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Has anyone out there created a m4a tag reader / writer?
|
|
|
|
|
Good question. I need to read the title from an m4a file. Can anyone help please?
|
|
|
|