public void UpdaterProg(SwMsgDwnldUpt swMs)
 {
     try
     {
         if (ThisVerDouble < RemoteVerDouble)
         {
             if (DialogResult.Yes == swMs("New version detected (" + RemoteVersion + ")\nThe application will be automatically updated and restarted\nWhat new:\n" +
                                          WhatNewVer(swMs), AppName + " v" + ThisVersion, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
             {
                 //panelProgress.Invoke(new Action(() => panelProgress.Visible = true));
                 var ClientDownloader = new WebClient();
                 ClientDownloader.DownloadProgressChanged += new DownloadProgressChangedEventHandler(download_ProgressChanged);
                 ClientDownloader.DownloadFileCompleted   += new AsyncCompletedEventHandler(download_Completed);
                 ClientDownloader.DownloadFileAsync(new Uri(@UrlLinq), AppName + ".zip");
             }
         }
         else if (ThisVerDouble == RemoteVerDouble || ThisVerDouble > RemoteVerDouble)
         {
             swMs("You using the lastest version!\nCurrent version:  " + ThisVersion, "No updates available!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception exception)
     {
         swMs(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 public CheckUpdates(string _AppName, string _ThisVers, string _UrlLinq, SwMsgDwnldUpt _sw, MetroFramework.Controls.MetroProgressBar _progressBar, NotifyIcon notify, Panel panel, Label labelU)
 {
     progressBar   = _progressBar;
     AppName       = _AppName;
     ThisVersion   = _ThisVers;
     UrlLinq       = _UrlLinq;
     swMsg         = _sw;
     notifyIcon    = notify;
     panelProgress = panel;
     labelProgress = labelU;
 }
 public CheckUpdates(string _AppName, string _ThisVers, string _UrlLinq, SwMsgDwnldUpt _sw, MetroFramework.Controls.MetroProgressBar _progressBar, NotifyIcon notify, Label labelU)
 {
     progressBar         = _progressBar;
     AppName             = _AppName;
     ThisVersion         = _ThisVers;
     UrlLinq             = _UrlLinq;
     swMsg               = _sw;
     notifyIcon          = notify;
     labelProgress       = labelU;
     GetRemoteVerLinq    = LinkGenerator() + GetRemoteVerLinq;
     GetReleaseNotesLinq = LinkGenerator() + GetReleaseNotesLinq;
 }
 private static string WhatNewVer(SwMsgDwnldUpt swMsgDwnld)
 {
     try
     {
         XmlDocument docUpdates = new XmlDocument();
         docUpdates.Load(GetReleaseNotesLinq);
         return(docUpdates.GetElementsByTagName(AppName)[0].InnerText);
     }
     catch (Exception ex)
     {
         //swMsgDwnld(ex.Message, "Can't get release notes", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return("\nError.\nCan't load update notes");
     }
 }
Beispiel #5
0
 public Form1()
 {
     InitializeComponent();
     form1             = this;
     this.StyleManager = mSM;
     ds        = messageBoxCaller;
     mSM.Style = MetroFramework.MetroColorStyle.Purple;
     mSM.Theme = MetroFramework.MetroThemeStyle.Dark;
     comboVersion.SelectedIndex = 0;
     MsgDwnldUpt = messageBoxCaller;
     messaged    = messageBoxCaller;
     installer   = new Installer(ref form1, messaged, progressProg);
     CheckUpdate = new CheckUpdates("EasyVysorPro", Application.ProductVersion, Constants.vysorServerDownload,
                                    MsgDwnldUpt, progressProg, notifyIcon1, panelUpdateDownloading, labelUpdate);
 }