|
I was wondering if there was a better way of doing this?
What I am trying to accomplish is always checking for updates and displaying there is an update with a NotifyIcon. Now I got it working good, but was wondering if there was a better way.
The way I did it was used a timer (every 5 min). On the Tick event:
private void timerCheckUpdates_Tick(object sender, EventArgs e)
{
if (ApplicationDeployment.IsNetworkDeployed)
{
if (!CheckUpdate)
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
try
{
ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
ad.CheckForUpdateAsync();
CheckUpdate = true;
}
catch (COMException)
{
ad.CheckForUpdateAsyncCancel();
}
}
}
}
void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
{
CheckUpdate = false;
if (e.UpdateAvailable)
{
notifyIcon1.ShowBalloonTip(5000, "Update Available!", "There is a new update available for this application!\nPlease click on the Help menu and click Check for updates.", ToolTipIcon.Info);
timerCheckUpdates.Enabled = false;
}
}
Ok I haven't tried it since I've changed it to the COMException, but if the user didn't have internet at all it would throw an exception. I am trying to get away from the error messages.
Is there a better way of doing this?
|
|
|
|
|
Our winforms apps all check on startup only! From this I gather you are checking every 5 minutes
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well yes... I did have it always check at startup but you had to wait for it to load.. it had to check and it wouldn't load the form at first, it would load the checking for updates / prereqs form. I didnt really want this, and for practice I wanted to make something that would check for updates at certain times while using the program.
If no updates were found, nothing would happen. But if there were updates found, a notification would popup from the NotifyIcon (lower right hand corner of screen) and say "There is a new update available!".
If I disabled the timer, that means it would only check once while the program was running. I want it to check multiple times while it is running. This is a inhouse only application and I do change things a lot on it.
|
|
|
|
|
In the ontick event
Disable the timer<br />
check for updates<br />
do updates<br />
ENABLE TIMER
Seems simple to me - we use it all the time!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have also received an email stating there was a reply from jay_t55. I cannot see it? Usually if something was deleted it shows this message was deleted on this forum right? Is there a bug?
Anyways,
Jay, if I disable the timer then it won't check for updates again unless the application restarts.
|
|
|
|
|
Hello all. I have developed full blackjack game using C# in MS VS 2008. Now I want to implement the Windows WPF in my blackJack game. I have no idea where to start, and look for what. Searching the internet wasted 2 days of work. I will post both versions (once the WPF has been developed) on here.
Thanks in advance.
|
|
|
|
|
BenJamming wrote: Searching the internet wasted 2 days of work
In two days you could have read a book on the subject and be half an expert on the subject.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
BenJamming wrote: Hello all. I have developed full blackjack game using C# in MS VS 2008. Now I want to implement the Windows WPF in my blackJack game.
I would start in the WPF forum...
God, I pity the software world when current crop of new programmers gain "manager" status...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
could anyone tell me how to get the IntPtr handle of a flash element of a site which my webbrowser is focused on?
I'm trying to use SendMessage on the site and it's not working because I need to be sending it to the flash player and not just the webbrowser or something
I can get my clicking to work fine with google but not with flash content
int x = 283;
int y = 342;
IntPtr handle = two.Handle;
StringBuilder className = new StringBuilder(100);
while (className.ToString() != "Internet Explorer_Server")
{
handle = GetWindow(handle, 5);
GetClassName(handle, className, className.Capacity);
}
IntPtr lParam = (IntPtr)((y << 16) | x);
IntPtr wParam = IntPtr.Zero;
const uint downCode = 0x201;
const uint upCode = 0x202;
SendMessage(handle, downCode, wParam, lParam);
SendMessage(handle, upCode, wParam, lParam);
System.Drawing.Pen myBrush = new System.Drawing.Pen(System.Drawing.Color.Red);
Graphics g = two.CreateGraphics();
Graphics h = one.CreateGraphics();
h.DrawEllipse(myBrush, new Rectangle(x, y, 5, 5));
g.DrawEllipse(myBrush, new Rectangle(x, y, 5, 5));
here two is my webbrowser and one is just a transparent form over top of it which I will be using later, I just drew circles on them to tell where the mouse should be clicking, and as I said before, it works for other sites just not flash content
|
|
|
|
|
Hi!
The task is to write a simple FTP-client program, but without operating manually with FTP commands. So I need component to do this for me. I've read about standard class FTPWebRequet.
For example, there is a list of directory names and i need to know what files are in them.
Have I understood, there is no way to do this, except to create one component per request. Is it possible to change work directory for existing FTPWebRequet object?
Regards. Ajunta.
|
|
|
|
|
WebClient class makes file downloading and uploading more easy. I am not sure there is some class which will list the specified directory. You need to supply the FTP command for this.
|
|
|
|
|
>I am not sure there is some class which will list the specified directory.
FTPWebRequet can do this because of uri can be absolute. The problem is to list directory:
FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create (new Uri("ftp://" + ftpServerIP + "/"+path));
reqFTP.UseBinary = false;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string line;
while ((line = reader.ReadLine()) != null)
{ ..... }
At this point i wanto to list next directory using existing connection? it is possible?
|
|
|
|
|
Hi Guys, It there anyway we can change some properties of a filename like FONT COLOR, FONT STYLE without affecting other file.
Thanks in advance.
erson
|
|
|
|
|
I would suggest that your asking that means you need to do some basic learning before attempting such a task. The file names in the file system are written by the shell. It's possible that a shell extension, which should probably be written in C++, is how you'd go about this.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
File names don't have fonts and colors.
|
|
|
|
|
The font, probably color and size of file names can be changed by the current windows/OS user, though not individually but for all files in the system.
The only thing you could do is display some files in your program and chnage the font for specific files.
|
|
|
|
|
In the forms designer, can you set the "Text" property of a control so that it grabs a string from your stringtable instead, or do you have to do that with code?
For instance setting the "Text" of a Label to "§MyLableString1" and it would grab the context of that string
Thanks
|
|
|
|
|
I want smiley icon (like yahoomessenger) in richtextbox
Is there anyone to know how i must do this?
Pleas answer I searched lot but Ididnt find Clear answer
if you have simple code please share it Or email me
tnx
shaghayegh244@yahoo.com
|
|
|
|
|
|
I am getting a nullable datetime from the DB and need to store it in as a sortable datetime string but display it in a different datetime string format
ex. get datetime or null from DB and store it as "yyyy-mm-dd" or "" for sorting purposes but then need to convert it to dd-MMM-yyyy or empty in the gridview
any suggestion?
|
|
|
|
|
Hi,
you can decode a date string using DateTime.Parse/ParseExact/TryParse/TryParseExact; you will have to deal with null/DBNull yourself.
you can format a date to a string with ToString(); that holds true for all .NET types
you should not store dates as strings in a database, use the existing database types instead (date, datetime, timestamp). If you do store them as strings anyway, have a look at ISO 8601 for a standard format.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I would use System.DateTime.MinValue or .MaxValue depending on whether I want them sorted to the top or bottom.
if ( f == System.DbBull.Value ) f = System.DateTime.MinValue ;
s = ( f == System.DateTime.MinValue ? "null" : f.ToString() ) ;
|
|
|
|
|
Hi, Has anyone experienced this problem?
i'm using vs.net c# & Report Designer component CRAXDDRT V XI 2
i've added an OleObject in the report page header section by the folowing line
OleObject PicObject = m_Report.Sections[SecNo].AddPictureObject(Application.StartupPath + "\\DefaultLogo.bmp", 0, 0) it's added successfully but after that when i try to change the photo path (Graphic Location) by
PicObject.SetOleLocation("NewPath + "\\AnotherLogo.bmp");
the following error msg appears : 'Access is denied'
I would appreciate your help ...
|
|
|
|
|
U dont have appropriate administrative privileges! Log in as Administrator or its member....
|
|
|
|
|
thanx 4 reply
but i'm actually loging by Administrator
|
|
|
|