I have a project that simply checks a sql table every minute and if any rows are found, shows a balloontip from the taskbar. If that balloontip is clicked, then open IE to a web page (another project) to show the row details. My env't is terminal services and each user logs into designated servers so there are less than 100 users on each server.
Question:
My plan is to roll out a winform project hidden to the tasktray for each user. Like Messenger, it will require each user to have his or her own instance of this program running. The program is around 1 meg per instance so the overhead should be fine and I've confirmed with my sys admin.
However, would you approach it this way? I'm hesitant on having 100 instances of a winform running from each login's tasktray since from my experiences aren't that good with winforms. They've always had quirks and mysterious crashes and hangs, etc. However, I do need a UI so I did end up choosing a winform project and not a service project. And each message is dependant on the user's dept.
Let me know your thoughts on this, and by all means, if you have a better way you can think of. And please be specific in your suggestions, such as "use system.threading.timer with a winform project".
Code:
This is pretty much it! It "works" but there are some quirks with it hanging after each database connection and when I open IE, the balloontip does not ever come back...
Question:
My plan is to roll out a winform project hidden to the tasktray for each user. Like Messenger, it will require each user to have his or her own instance of this program running. The program is around 1 meg per instance so the overhead should be fine and I've confirmed with my sys admin.
However, would you approach it this way? I'm hesitant on having 100 instances of a winform running from each login's tasktray since from my experiences aren't that good with winforms. They've always had quirks and mysterious crashes and hangs, etc. However, I do need a UI so I did end up choosing a winform project and not a service project. And each message is dependant on the user's dept.
Let me know your thoughts on this, and by all means, if you have a better way you can think of. And please be specific in your suggestions, such as "use system.threading.timer with a winform project".
Code:
This is pretty much it! It "works" but there are some quirks with it hanging after each database connection and when I open IE, the balloontip does not ever come back...
VB.NET:
Private Sub OnLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim autoEvent As New AutoResetEvent(False)
Dim timerDelegate As TimerCallback = AddressOf GetMsg
Dim stateTimer As System.Threading.Timer = New System.Threading.Timer(timerDelegate, autoEvent, 5000, 10000)
AddHandler NotifyIcon1.BalloonTipClicked, AddressOf OpenIE
End Sub
Private Sub GetMsg()
Try
Dim dt As DataTable
dt = FunctionToGetDataFromSQLToADataTable("select * from tablename")
If dt.Rows.Count > 0 Then
strMsg = "Has Rows"
else
strMsg = "No Rows"
End If
Me.NotifyIcon1.BalloonTipText = strMsg
Me.NotifyIcon1.ShowBalloonTip(10)
dt.Dispose()
Catch ex As Exception
Me.NotifyIcon1.BalloonTipText = "error"
Me.NotifyIcon1.ShowBalloonTip(10)
End Try
End Sub
Private Sub OpenIE()
Dim webAddress As String = FunctionToURL()
Process.Start(webAddress)
End Sub