Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: Ok, is it just me or...? Pin
PIEBALDconsult5-Apr-09 5:39
mvePIEBALDconsult5-Apr-09 5:39 
QuestionHow to validate the xml while updating the node of an xml Pin
member1234564-Apr-09 19:40
member1234564-Apr-09 19:40 
QuestionRounded button and panel in c# Pin
sepel4-Apr-09 19:17
sepel4-Apr-09 19:17 
AnswerRe: Rounded button in c# Pin
Xmen Real 4-Apr-09 19:36
professional Xmen Real 4-Apr-09 19:36 
AnswerRe: [Message Deleted] Pin
Luc Pattyn4-Apr-09 23:05
sitebuilderLuc Pattyn4-Apr-09 23:05 
GeneralRe: [Message Deleted] Pin
sepel5-Apr-09 18:17
sepel5-Apr-09 18:17 
QuestionCOM Interop GUID Help Pin
monkh4-Apr-09 18:01
monkh4-Apr-09 18:01 
QuestionClickOnce app... contanstly checking for updates? Pin
Jacob Dixon4-Apr-09 17:16
Jacob Dixon4-Apr-09 17:16 
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?
AnswerRe: ClickOnce app... contanstly checking for updates? Pin
Mycroft Holmes4-Apr-09 22:48
professionalMycroft Holmes4-Apr-09 22:48 
GeneralRe: ClickOnce app... contanstly checking for updates? Pin
Jacob Dixon5-Apr-09 5:00
Jacob Dixon5-Apr-09 5:00 
GeneralRe: ClickOnce app... contanstly checking for updates? Pin
Mycroft Holmes5-Apr-09 13:03
professionalMycroft Holmes5-Apr-09 13:03 
GeneralRe: ClickOnce app... contanstly checking for updates? Pin
Jacob Dixon5-Apr-09 5:04
Jacob Dixon5-Apr-09 5:04 
QuestionBlackJack using WPF Pin
BenJamming4-Apr-09 16:22
BenJamming4-Apr-09 16:22 
AnswerRe: BlackJack using WPF Pin
Luc Pattyn4-Apr-09 23:06
sitebuilderLuc Pattyn4-Apr-09 23:06 
AnswerRe: BlackJack using WPF Pin
#realJSOP5-Apr-09 3:12
mve#realJSOP5-Apr-09 3:12 
Questionaccessing elements from a webbrowser Pin
jeanbern4-Apr-09 13:28
jeanbern4-Apr-09 13:28 
QuestionUsing FTPWebRequet for simple ftp-client on C# Pin
Eugene Efimov4-Apr-09 11:07
Eugene Efimov4-Apr-09 11:07 
AnswerRe: Using FTPWebRequet for simple ftp-client on C# Pin
N a v a n e e t h4-Apr-09 15:59
N a v a n e e t h4-Apr-09 15:59 
GeneralRe: Using FTPWebRequet for simple ftp-client on C# Pin
Eugene Efimov4-Apr-09 20:57
Eugene Efimov4-Apr-09 20:57 
QuestionFile Name Pin
egpuyos4-Apr-09 10:04
egpuyos4-Apr-09 10:04 
AnswerRe: File Name Pin
Christian Graus4-Apr-09 10:50
protectorChristian Graus4-Apr-09 10:50 
AnswerRe: File Name Pin
PIEBALDconsult5-Apr-09 5:45
mvePIEBALDconsult5-Apr-09 5:45 
AnswerRe: File Name Pin
Megidolaon5-Apr-09 20:26
Megidolaon5-Apr-09 20:26 
QuestionHow to set the text of a control to a string from the resx? Pin
ioctl514-Apr-09 9:52
ioctl514-Apr-09 9:52 
Questionsmiley icons(emotion icons) in richtextbox? Pin
shaghyegh4-Apr-09 9:49
shaghyegh4-Apr-09 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.