Ejemplo n.º 1
0
        /// <summary>
        /// Checks for any ClickOnce updates.
        /// </summary>
        private void CheckForUpdates()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;
                deployment.CheckForUpdateCompleted += CheckForUpdateCompleted;
                deployment.UpdateProgressChanged   += UpdateProgressChanged;
                deployment.UpdateCompleted         += UpdateCompleted;

                try
                {
                    deployment.CheckForUpdateAsync();
                }
                catch (Exception ex)
                {
                    if (ex is InvalidOperationException ||
                        ex is InvalidDeploymentException ||
                        ex is DeploymentDownloadException)
                    {
                        // Swallow.
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void UpdateApplication()
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         ADUpdateAsync.CheckForUpdateAsync();
     }
 }
Ejemplo n.º 3
0
        public static void checkForUpdate(Boolean isManualCheck = false)
        {
            Settings.Instance.Proxy.Configure();
            if (System.Diagnostics.Debugger.IsAttached)
            {
                return;
            }

            Program.isManualCheck = isManualCheck;
            if (isManualCheck)
            {
                MainForm.Instance.btCheckForUpdate.Text = "Checking...";
            }

            if (isClickOnceInstall())
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                if (isManualCheck || ad.TimeOfLastUpdateCheck < DateTime.Now.AddDays(-1))
                {
                    log.Debug("Checking for ClickOnce update...");
                    ad.CheckForUpdateCompleted -= new CheckForUpdateCompletedEventHandler(checkForUpdate_completed);
                    ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(checkForUpdate_completed);
                    ad.CheckForUpdateAsync();
                }
            }
            else
            {
                BackgroundWorker bwUpdater = new BackgroundWorker();
                bwUpdater.WorkerReportsProgress      = false;
                bwUpdater.WorkerSupportsCancellation = false;
                bwUpdater.DoWork             += new DoWorkEventHandler(checkForZip);
                bwUpdater.RunWorkerCompleted += new RunWorkerCompletedEventHandler(checkForZip_completed);
                bwUpdater.RunWorkerAsync();
            }
        }
Ejemplo n.º 4
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         ad.CheckForUpdateAsync();
     }
     catch { }
 }
Ejemplo n.º 5
0
        public static void InstallUpdateSyncWithInfo()
        {
            if (alreadyCheckingForUpdate)
            {
                return;
            }
            else
            {
                alreadyCheckingForUpdate = true;
            }

            var daysSinceLastUpdate = (DateTime.Now - _lastUpdateCheck).Days;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                if (updateAvailable)
                {
                    UpdateCheckInfo       info = null;
                    ApplicationDeployment ad   = ApplicationDeployment.CurrentDeployment;

                    try
                    {
                        info = ad.CheckForDetailedUpdate();
                    }
                    catch
                    {
                        return;
                    }
                    finally
                    {
                        _lastUpdateCheck = DateTime.Now;
                    }

                    if (info.UpdateAvailable || true)
                    {
                        try
                        {
                            ad.Update();
                            System.Windows.Application.Current.Shutdown();
                            System.Windows.Forms.Application.Restart();
                        }
                        catch
                        {
                            return;
                        }
                    }
                }
                else
                {
                    ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                    ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(CheckForUpdateCompleted);
                    ad.CheckForUpdateAsync();

                    _lastUpdateCheck = DateTime.Now;
                }
            }
        }
Ejemplo n.º 6
0
 public virtual void Update()
 {
     try {
         _Deployment.CheckForUpdateAsync();
     }
     catch (Exception exc) {
         _Logger.WarnException("Update failed!", exc);
     }
 }
Ejemplo n.º 7
0
        private void CheckForUpdatesAsync()
        {
            if (deployment != null)
            {
                btnInstallUpdate.Enabled = btnSearchAgain.Enabled = false;
                lblStatus.Text           = Properties.Resources.CheckingForUpdates;

                deployment.CheckForUpdateAsync();
            }
        }
Ejemplo n.º 8
0
        public static void Weeee()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                //ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);

                ad.CheckForUpdateAsync();
            }
        }
Ejemplo n.º 9
0
        private void UpdateApplication()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                ad.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

                ad.CheckForUpdateAsync();
            }
        }
Ejemplo n.º 10
0
 void ZoekAsync()
 {
     btnUpdate.Enabled  = false;
     btnOpnieuw.Enabled = false;
     prev_state         = "";
     lblStatus.Text     = res_frm.GetString("lblStatus.Text");
     if (depl != null)
     {
         depl.CheckForUpdateAsync();
     }
 }
Ejemplo n.º 11
0
        public void radButton6_Click(object sender, EventArgs e)
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                ad.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

                ad.CheckForUpdateAsync();
            }
        }
Ejemplo n.º 12
0
 private void CheckForUpdates()
 {
     UpToDate = false;
     Checking = true;
     UpdateStatus();
     update.Enabled = false;
     AcceptButton   = close;
     mainLabel.Text = "Checking for updates...";
     button.Text    = "Checking for Updates";
     progress.Style = ProgressBarStyle.Marquee;
     deployment.CheckForUpdateAsync();
 }
Ejemplo n.º 13
0
        public UpdateProgress()
        {
            InitializeComponent();

            Text = "Güncelleme kontrol ediliyor...";

            ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

            ad.CheckForUpdateCompleted       += OnCheckForUpdateCompleted;
            ad.CheckForUpdateProgressChanged += OnCheckForUpdateProgressChanged;

            ad.CheckForUpdateAsync();
        }
Ejemplo n.º 14
0
 private void CheckVersion()
 {
     UpdateBar.MainButtonClick += UpdateBar_MainButtonClick;
     // 定时每6小时检查一次
     Repeat.Interval(TimeSpan.FromHours(6), () => UpdateBar.Dispatcher.Invoke(() =>
     {
         if (ApplicationDeployment.IsNetworkDeployed && UpdateAction == null)
         {
             ApplicationDeployment ad    = ApplicationDeployment.CurrentDeployment;
             ad.CheckForUpdateCompleted += Ad_CheckForUpdateCompleted;
             ad.CheckForUpdateAsync();
         }
     }), new CancellationToken());
 }
Ejemplo n.º 15
0
        private void CheckUpdate()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                bool hasApplication = ApplicationDeployment.CurrentDeployment.CheckForUpdate(false);
                if (hasApplication == true)
                {
                    ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                    ad.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                    ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

                    ad.CheckForUpdateAsync();
                }
            }
        }
Ejemplo n.º 16
0
        void UpdateApplication()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                ad.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

                ad.CheckForUpdateAsync();
            }
            else
            {
                //this.Hide();
                //Form1 newfrm = new Form1();
                //newfrm.t_SALJARETableAdapter.Fill(newfrm.pengvinDataset.T_SALJARE);
                //newfrm.ReparationsunderlagTableAdapter.Fill(newfrm.DataSet1.Reparationsunderlag);
                //newfrm.Show();
            }
        }
Ejemplo n.º 17
0
 void ZoekAsync()
 {
     try
     {
         if (depl == null)
         {
             return;
         }
         btnUpdate.Enabled  = false;
         btnOpnieuw.Enabled = false;
         prev_state         = "";
         lblStatus.Text     = Resources.Checking + "...";
         depl.CheckForUpdateAsync();
     }
     catch (Exception ex)
     {
         lblStatus.Text = Resources.SearchFailed + ": " + ex.Message;
     }
 }
Ejemplo n.º 18
0
 private void program_Changed(object sender, FileSystemEventArgs e)
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         DateTime lastWriteTime = File.GetLastWriteTime(e.FullPath);
         if (lastWriteTime != lastRead)
         {
             log.Debug("File Changed: {0}", e.FullPath);
             try
             {
                 ad.CheckForUpdateAsync();
             }
             catch (Exception ex)
             {
                 log.Error(ex.Message);
             }
         }
     }
 }
Ejemplo n.º 19
0
        //Command line interface
        internal void InitFromCommandLineArguments(string[] Args)
        {
            //Args is made up of:
            //0: %base file path
            //1: %bname
            //2: %mine
            //3: %yname

            cvsBlocks         = new CollectionViewSource();
            cvsBlocks.Filter += new FilterEventHandler(cvsBlocks_Filter);
            if ((Args != null) && (Args.Count() > 3))
            {
                LeftProjectPath  = Args[0];
                RightProjectPath = Args[2];

                if (Args[1].Contains(":"))
                {
                    _LeftProjectExtendedName = "(" + Args[1].Remove(Args[1].IndexOf(":")).Trim() + ")";
                }
                if (Args[3].Contains(":"))
                {
                    _RightProjectExtendedName = "(" + Args[3].Remove(Args[3].IndexOf(":")).Trim() + ")";
                }
            }
            EventFire.LogEvent += new EventHandler <EventArgs <LogEvent> >(S7Model_LogEvent);
            dispatcher          = Dispatcher.CurrentDispatcher;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                try
                {
                    ad.CheckForUpdateAsync();
                }
                catch (Exception e)
                {
                    EventFire.Error(e.ToString());
                }
            }
        }
Ejemplo n.º 20
0
        public void UpdateApplication()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

                //Clear existing event hooks
                ad.CheckForUpdateProgressChanged -= new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);
                ad.CheckForUpdateCompleted       -= new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);

                //Add event hooks
                ad.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

                ad.CheckForUpdateAsync();
            }
            else
            {
                UpdateButton.IsEnabled = true;
            }
        }
Ejemplo n.º 21
0
        public void UpdateApplicationAsync()
        {
            try
            {
                if (ApplicationDeployment.IsNetworkDeployed)
                {
                    ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
                    LogMessage("AutoUpdate: Checking for updates at " + ad.UpdateLocation.ToString());
                    LogMessage("AutoUpdate: Current application deployment version: " + ad.CurrentVersion.ToString());
                    ad.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
                    ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

                    ad.CheckForUpdateAsync();
                }
                else
                {
                    LogMessage("AutoUpdate: Application is not running as part of a ClickOnce deployment");
                }
            }
            catch (DeploymentDownloadException dde)
            {   // This exception occurs if a network error or disk error occurs when downloading the deployment.
                LogMessage("AutoUpdate: The application cannot check for the existence of a new version at this time. Please check your network connection, or try again later. Error: " + dde.Message);
                return;
            }
            catch (InvalidDeploymentException ide)
            {
                LogMessage("AutoUpdate: The application cannot check for an update. Either the app is not running under ClickOnce, or the ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message);
                return;
            }
            catch (InvalidOperationException ioe)
            {
                LogMessage("AutoUpdate: This application cannot check for an update. This most often happens if the application is already in the process of updating. Error: " + ioe.Message);
                return;
            }
            catch (Exception ex)
            {
                LogMessage("AutoUpdate: An unexpected exception occurred while checking for an update: " + ex.ToString());
                return;
            }
        }
Ejemplo n.º 22
0
        private void UpdateApplication()
        {
            //ถ้าเป็นการรันโปรแกรมจากการติดตั้งด้วย ClickOnce
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                //ประกาศตัวแปร checkUpdate เป็นประเภท ApplicationDeployment
                //กำหนดค่าให้มันเป็น CurrentDeployment ตัวที่ Deploy ล่าสุด
                ApplicationDeployment checkUpdate = ApplicationDeployment.CurrentDeployment;

                //สร้าง Event checkUpdate_CheckForUpdateCompleted
                checkUpdate.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(checkUpdate_CheckForUpdateCompleted);

                //สร้างEvent checkUpdate_CheckForUpdateProgressChanged
                checkUpdate.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(checkUpdate_CheckForUpdateProgressChanged);

                //เรียกเมธอด CheckForUpdateAsync:ตรวจสอบเวอร์ชั่นใหม่บนเซอร์ฟเวอร์
                checkUpdate.CheckForUpdateAsync();

                //เรียกเมธอด แสดง ProgrssBar
                showProgrssBar();
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Once we have made our first release on GitHub, this can be removed.
 /// Until then, let's keep the code just in case another CodePlex release is needed.
 /// </summary>
 private void legacyCodeplexCheck()
 {
     if (Program.IsClickOnceInstall)
     {
         ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
         if (isManualCheck || ad.TimeOfLastUpdateCheck < DateTime.Now.AddDays(-1))
         {
             log.Debug("Checking for ClickOnce update...");
             ad.CheckForUpdateCompleted -= new CheckForUpdateCompletedEventHandler(checkForUpdate_completed);
             ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(checkForUpdate_completed);
             ad.CheckForUpdateAsync();
         }
     }
     else
     {
         BackgroundWorker bwUpdater = new BackgroundWorker();
         bwUpdater.WorkerReportsProgress      = false;
         bwUpdater.WorkerSupportsCancellation = false;
         bwUpdater.DoWork             += new DoWorkEventHandler(checkForZip);
         bwUpdater.RunWorkerCompleted += new RunWorkerCompletedEventHandler(checkForZip_completed);
         bwUpdater.RunWorkerAsync();
     }
 }
Ejemplo n.º 24
0
        public static void UpdateApplication()
        {
            if (!ApplicationDeployment.IsNetworkDeployed)
            {
                XtraMessageBox.Show("The application is not network deployed and can't be updated online.",
                                    "Unavailable", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (RestartRequired)
            {
                XtraMessageBox.Show("The application needs to be restarted!", "Restart", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                return;
            }

            if (UpdateRunning)
            {
                return;
            }

            UpdateRunning = true;
            HCMIS.CheckForUpdateAsync();
        }
Ejemplo n.º 25
0
        public void Launch()
        {
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 1);
            int Number = 0;

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                deployment = ApplicationDeployment.CurrentDeployment;
                deployment.UpdateCompleted         += new System.ComponentModel.AsyncCompletedEventHandler(deployment_UpdateCompleted);
                deployment.UpdateProgressChanged   += deployment_UpdateProgressChanged;
                deployment.CheckForUpdateCompleted += deployment_CheckForUpdateCompleted;
                try
                {
                    deployment.CheckForUpdateAsync();
                }
                catch (InvalidOperationException e)
                {
                    Debug.WriteLine(e.ToString());
                }
            }

            foreach (WinForms.Screen s in WinForms.Screen.AllScreens)
            {
                MainWindow m = new MainWindow(this)
                {
                    WindowStartupLocation = WindowStartupLocation.Manual,
                    Left               = s.WorkingArea.Left,
                    Top                = s.WorkingArea.Top,
                    Width              = s.WorkingArea.Width,
                    Height             = s.WorkingArea.Height,
                    WindowStyle        = WindowStyle.None,
                    ResizeMode         = ResizeMode.NoResize,
                    Topmost            = true,
                    AllowsTransparency = Settings.Default.TransparentBackground,
                    Background         = (Settings.Default.TransparentBackground ? new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)) : Brushes.WhiteSmoke),
                    Name               = "Window" + Number++.ToString()
                };

                figuresUserControlQueue[m.Name] = new List <UserControl>();

                m.Show();
                m.MouseLeftButtonDown += HandleMouseLeftButtonDown;
                m.MouseWheel          += HandleMouseWheel;
                m.WindowState          = WindowState.Maximized;
                windows.Add(m);
            }

            //Only show the info label on the FIRST monitor.
            windows[0].infoLabel.Visibility = Visibility.Visible;

            //Startup sound
            Win32Audio.PlayWavResourceYield("EditedJackPlaysBabySmash.wav");

            string[] args = Environment.GetCommandLineArgs();
            string   ext  = System.IO.Path.GetExtension(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

            if (ApplicationDeployment.IsNetworkDeployed && (ApplicationDeployment.CurrentDeployment.IsFirstRun || ApplicationDeployment.CurrentDeployment.UpdatedVersion != ApplicationDeployment.CurrentDeployment.CurrentVersion))
            {
                //if someone made us a screensaver, then don't show the options dialog.
                if ((args != null && args[0] != "/s") && String.CompareOrdinal(ext, ".SCR") != 0)
                {
                    ShowOptionsDialog();
                }
            }
#if !false
            timer.Start();
#endif
        }
 public void CheckForUpdateAsync()
 {
     _deployment.CheckForUpdateAsync();
 }