Esempio n. 1
0
        //private void OpenHyperlink(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        //{
        //    var p = e.Parameter.ToString();
        //    if (p == "later")
        //    {
        //        Close();
        //    }
        //    else if (p == "ignore")
        //    {
        //        AppSettings.Default.IgnoredVer = _release.NewVerString;
        //        AppSettings.SaveDefault();
        //        Close();
        //    }
        //    else if (p == "update")
        //    {
        //        UpdateWindow updateWindow = new UpdateWindow(_release, _mainWindow);
        //        updateWindow.Show();
        //        Close();
        //    }
        //    else
        //        Process.Start(p);
        //}

        private void Update_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var updateWindow = new UpdateWindow(_release, _mainWindow);

            updateWindow.Show();
            Close();
        }
Esempio n. 2
0
        /// <summary>
        /// This is where we check for updates, once the window is loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Window_ContentRendered(object sender, EventArgs e)
        {
            isRendered = true;

            UpdateCheckProgressBar.Visibility = Visibility.Visible;
            UpdateCheckLabel.Visibility       = Visibility.Visible;

            bool updateAvailable = await Task.Run(() => UpdateChecker.CheckForUpdates());

            isBackgroundUpdateChecking = true;

            if (updateAvailable)
            {
                this.Title = $"{this.Title} [Outdated])";
                string content = $"Found a new version ({UpdateChecker.latest}), currently using {UpdateChecker.current}. Check it out?\n\nChangelog ({UpdateChecker.latest}): {UpdateChecker.changelog}";

                MessageBoxResult result = MessageBox.Show(content, "Update", MessageBoxButton.YesNo, MessageBoxImage.Information);
                if (result == MessageBoxResult.Yes)
                {
                    UpdateWindow uw = new UpdateWindow(UpdateChecker.latest);
                    if (!uw.isClosing)
                    {
                        uw.Show();
                    }
                }
            }
            isBackgroundUpdateChecking = false;

            UpdateCheckProgressBar.Visibility = Visibility.Hidden;
            UpdateCheckLabel.Visibility       = Visibility.Hidden;
        }
Esempio n. 3
0
        private void OpenHyperlink(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            var p = e.Parameter.ToString();

            if (p == "later")
            {
                Close();
            }
            else if (p == "ignore")
            {
                PlayerConfig.Current.IgnoredVer = _release.NewVerString;
                PlayerConfig.SaveCurrent();
                Close();
            }
            else if (p == "update")
            {
                UpdateWindow updateWindow = new UpdateWindow(_release, _mainWindow);
                updateWindow.Show();
                Close();
            }
            else
            {
                Process.Start(p);
            }
        }
Esempio n. 4
0
 private void UpdateBtn_Click(object sender, RoutedEventArgs e)
 {
     if (!WindowHelpers.IsWindowOpen(typeof(UpdateWindow)))
     {
         UpdateWindow updateWindow = new UpdateWindow();
         updateWindow.Show();
     }
 }
Esempio n. 5
0
 public static async Task UpdateLoader(string url)
 {
     if (UpdateWhiteList.Any(url.StartsWith))
     {
         var window = new UpdateWindow(UpdateAction.Loader, url);
         window.Show();
         await window.Update();
     }
 }
Esempio n. 6
0
 public void UpdateMethod()
 {
     if (SelectedMember != null)
     {
         update = new UpdateWindow();
         update.Show();
         Messenger.Default.Send(SelectedMember);
     }
 }
Esempio n. 7
0
 public static async Task UpdateLoader(Tuple <bool, string> versionCheckResult)
 {
     if (versionCheckResult.Item1 &&
         (versionCheckResult.Item2.StartsWith("https://github.com/LeagueSharp/") ||
          versionCheckResult.Item2.StartsWith("https://github.com/joduskame/") ||
          versionCheckResult.Item2.StartsWith("https://github.com/Esk0r/")))
     {
         var window = new UpdateWindow(UpdateAction.Loader, versionCheckResult.Item2);
         window.Show();
         await window.Update();
     }
 }
Esempio n. 8
0
        public static void Update()
        {
            var          webClient    = new WebClient();
            UpdateWindow updateWindow = null;

            try
            {
                var json          = webClient.DownloadString("https://loriswit.com/rlcm/latest.json");
                var latestVersion = new JavaScriptSerializer().Deserialize <Version>(json);

                if (App.Version.Number >= latestVersion.Number)
                {
                    return;
                }

                updateWindow = new UpdateWindow(latestVersion);
                updateWindow.Show();

                var path    = Environment.GetCommandLineArgs().First();
                var oldPath = path + "_tmp.exe";
                var newPath = path + "_" + latestVersion.Number + ".exe";

                // delete temporary files in case they still exist
                File.Delete(newPath);
                File.Delete(oldPath);

                webClient.DownloadFile(latestVersion.Url, newPath);

                // if download succeeded, rename the current program
                File.Move(path, oldPath);
                File.Move(newPath, path);

                // start the new version
                var process = new Process {
                    StartInfo = { FileName = path, Arguments = "--updated" }
                };
                process.Start();

                Application.Current.Shutdown();
            }
            catch (WebException)
            {
                // ignore failed update
            }
            finally
            {
                updateWindow?.Close();
            }
        }
Esempio n. 9
0
        private void CheckUpdate()
        {
            Task.Factory.StartNew(() =>
            {
                var update = new Update();
                UpdateWindow updateWindow = null;

                while (true)
                {
                    try
                    {
                        if ((updateWindow == null || !updateWindow.IsVisible) && update.IsUpdateAvailable)
                        {
                            if (update.IsUpdateAvailable)
                            {
                                update.DownloadUpdate();

                                try
                                {
                                    update.DownloadReleaseNotes();
                                }
                                catch (Exception exc)
                                {
                                    logger.Warn(exc, "Failed to download release notes.");
                                }

                                Dispatcher.Invoke(() =>
                                {
                                    updateWindow = new UpdateWindow()
                                    {
                                        Owner = this
                                    };

                                    updateWindow.SetUpdate(update);
                                    updateWindow.Show();
                                    updateWindow.Focus();
                                });
                            }
                        }
                    }
                    catch (Exception exc)
                    {
                        logger.Error(exc, "Failed to process update.");
                    }

                    Thread.Sleep(4 * 60 * 60 * 1000);
                }
            });
        }
Esempio n. 10
0
        /// <summary>
        /// This is where we check for updates, once the window is loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_ContentRendered(object sender, EventArgs e)
        {
            isRendered = true;
            if (UpdateChecker.CheckForUpdates(out string latest))
            {
                this.Title = $"{this.Title} [Outdated])";
                string content = $"Found a new version ({latest}), currently using {UpdateChecker.current}. Check it out?\n\nChangelog ({latest}): {UpdateChecker.changelog}";

                MessageBoxResult result = MessageBox.Show(content, "Update", MessageBoxButton.YesNo, MessageBoxImage.Information);
                if (result == MessageBoxResult.Yes)
                {
                    UpdateWindow uw = new UpdateWindow(latest);
                    if (!uw.isClosing)
                    {
                        uw.Show();
                    }
                }
            }
        }
Esempio n. 11
0
        public MainWindow()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.Current.SessionEnding          += Current_SessionEnding;

            //Commands
            ShowClickedCommand = new SimpleCommand <object, ShowTileViewModel>(OnShowViewClicked);
            IconClickedCommand = new SimpleCommand <object, object>(IconClicked);
            TerminateCommand   = new SimpleCommand <object, object>(Terminate);

            //Settings & Theme
            _setti = Settings.Instance;

            _currentAccent = ThemeManager.GetAccent(_setti.ThemeAccent);
            _currentTheme  = ThemeManager.GetAppTheme(_setti.ThemeBase);
            CurrentAccent  = _setti.ThemeAccent;

            updateTimer = new Timer();
            //Updater
            _updater = new UpdateWindow("http://dreamcooled.github.io/sjupdater/latest", true, "SjUpdater.exe", "-uf " + Stats.GetVersionString());
            _updater.updateStartedEvent += (a, dsa) =>
            {
                Terminate(null);
                Stats.TrackAction(Stats.TrackActivity.AppUpdate);
            };

            //Start!
            InitializeComponent();
            if (Environment.GetCommandLineArgs().Contains("-nogui"))
            {
                Hide();
            }

            //Initialize view
            _viewModel  = new MainWindowViewModel(_setti.TvShows);
            DataContext = _viewModel;


            //Enhance TreeView with Multiselection Extension
            //Note: We could also pass a observable collection to the first method, and get changes from the CollectionChanged Event on the observablecollection
            //But this way (custom event) we get less Events, which speeds up the GUI
            TreeViewExtensions.SetSelectedItems(ShowTreeView, _selectedEpisodeTreeItems);
            TreeViewExtensions.AddSelectionChangedListener(ShowTreeView, _selectedEpisodeTreeItems_CollectionChanged);

            SwitchPage(0);

            //Autoupdate timer
            if (_setti.UpdateTime > 0) //Autoupdate enabled
            {
                var t = new Timer(_setti.UpdateTime);
                t.Elapsed += t_Elapsed;
                t.Start();
            }

            //Inital update
            Update();

            //Stats

            Stats.StatsUrl    = "http://sjupdater.batrick.de/stats";
            Stats.AllowCustom = !_setti.NoPersonalData;
            Stats.TrackAction(Stats.TrackActivity.AppStart);
            Stats.TrackCustomVariable("Shows", _setti.TvShows.Select(s => s.Name));

            if (_setti.CheckForUpdates)
            {
                _updater.Show(false, true);
                updateTimer          = new Timer(1000 * 60 * 30); // 30 minutes
                updateTimer.Elapsed += (o, args) => Dispatcher.Invoke(() => _updater.Show(false, true));
                updateTimer.Start();
            }
        }
Esempio n. 12
0
        public static async Task <UpdateResponse> UpdateCore(string leagueOfLegendsFilePath, bool showMessages)
        {
            if (Directory.Exists(Path.Combine(Directories.CurrentDirectory, "iwanttogetbanned")))
            {
                return(new UpdateResponse(CoreUpdateState.Operational, Utility.GetMultiLanguageText("NotUpdateNeeded")));
            }

            try
            {
                var leagueMd5 = Utility.Md5Checksum(leagueOfLegendsFilePath);
                var wr        = WebRequest.Create(string.Format(CoreVersionCheckURL, leagueMd5));
                wr.Timeout = 4000;
                wr.Method  = "GET";
                var response = await wr.GetResponseAsync();

                using (var stream = response.GetResponseStream())
                {
                    if (stream != null)
                    {
                        var ser        = new DataContractJsonSerializer(typeof(UpdateInfo));
                        var updateInfo = (UpdateInfo)ser.ReadObject(stream);

                        if (updateInfo.version == "0")
                        {
                            var message = Utility.GetMultiLanguageText("WrongVersion") + leagueMd5;

                            if (showMessages)
                            {
                                MessageBox.Show(message);
                            }

                            return(new UpdateResponse(CoreUpdateState.Maintenance, message));
                        }

                        if (updateInfo.version != Utility.Md5Checksum(Directories.CoreFilePath) &&
                            updateInfo.url.StartsWith("https://github.com/joduskame/"))
                        {
                            try
                            {
                                var result = CoreUpdateState.Unknown;

                                await Application.Current.Dispatcher.Invoke(
                                    async() =>
                                {
                                    var window = new UpdateWindow(UpdateAction.Core, updateInfo.url);
                                    window.Show();

                                    if (await window.Update())
                                    {
                                        result = CoreUpdateState.Operational;
                                    }
                                });

                                return(new UpdateResponse(result, Utility.GetMultiLanguageText("UpdateSuccess")));
                            }
                            catch (Exception e)
                            {
                                var message = Utility.GetMultiLanguageText("FailedToDownload") + e;

                                if (showMessages)
                                {
                                    MessageBox.Show(message);
                                }

                                return(new UpdateResponse(CoreUpdateState.Unknown, message));
                            }
                            finally
                            {
                                if (File.Exists(UpdateZip))
                                {
                                    File.Delete(UpdateZip);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                return(new UpdateResponse(CoreUpdateState.Unknown, Utility.GetMultiLanguageText("UpdateUnknown")));
            }

            return(new UpdateResponse(CoreUpdateState.Operational, Utility.GetMultiLanguageText("NotUpdateNeeded")));
        }
Esempio n. 13
0
        public static async Task <UpdateResponse> UpdateCore(string path, bool showMessages)
        {
            if (Directory.Exists(Path.Combine(Directories.CurrentDirectory, "iwanttogetbanned")))
            {
                return(new UpdateResponse(CoreUpdateState.Operational, Utility.GetMultiLanguageText("NotUpdateNeeded")));
            }

            try
            {
                if (!WebService.IsAuthenticated)
                {
                    Utility.Log(LogStatus.Error, "WebService authentication failed");
                    return(new UpdateResponse(CoreUpdateState.Unknown, "WebService authentication failed"));
                }

                var outdated           = false;
                var leagueChecksum     = Utility.Md5Checksum(path);
                var coreChecksum       = Utility.Md5Checksum(Directories.CoreFilePath);
                var coreBridgeChecksum = Utility.Md5Checksum(Directories.CoreBridgeFilePath);
                var coreRequest        = await WebService.RequestCore(leagueChecksum);

                var core = coreRequest.Result;

                if (coreRequest.Outcome == OutcomeType.Failure)
                {
                    return(new UpdateResponse(
                               CoreUpdateState.Maintenance,
                               Utility.GetMultiLanguageText("WrongVersion") + Environment.NewLine + leagueChecksum));
                }

                if (!File.Exists(Directories.CoreFilePath) || !File.Exists(Directories.CoreBridgeFilePath))
                {
                    outdated = true;
                }

                if (!string.IsNullOrEmpty(core.HashCore) && core.HashCore != coreChecksum)
                {
                    outdated = true;
                }

                if (!string.IsNullOrEmpty(core.HashCoreBridge) && core.HashCoreBridge != coreBridgeChecksum)
                {
                    outdated = true;
                }

                if (outdated && UpdateWhiteList.Any(u => core.Url.StartsWith(u)))
                {
                    try
                    {
                        var result = CoreUpdateState.Unknown;

                        await Application.Current.Dispatcher.Invoke(
                            async() =>
                        {
                            var window = new UpdateWindow(UpdateAction.Core, core.Url);
                            window.Show();

                            if (await window.Update())
                            {
                                result = CoreUpdateState.Operational;
                            }
                        });

                        return(new UpdateResponse(result, Utility.GetMultiLanguageText("UpdateSuccess")));
                    }
                    catch (Exception e)
                    {
                        var message = Utility.GetMultiLanguageText("FailedToDownload") + e;

                        if (showMessages)
                        {
                            MessageBox.Show(message);
                        }

                        return(new UpdateResponse(CoreUpdateState.Unknown, message));
                    }
                    finally
                    {
                        if (File.Exists(UpdateZip))
                        {
                            File.Delete(UpdateZip);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Utility.Log(LogStatus.Error, e.Message);
            }

            return(new UpdateResponse(CoreUpdateState.Operational, Utility.GetMultiLanguageText("NotUpdateNeeded")));
        }
Esempio n. 14
0
 protected void UploadWin(object sender, DirectEventArgs e)
 {
     upload_uid.Text = e.ExtraParams["uid"].ToString();
     UYearMonth.Text = e.ExtraParams["month"].ToString();
     UpdateWindow.Show();
 }
Esempio n. 15
0
        public static async Task <UpdateResponse> UpdateCore(string path, bool showMessages)
        {
            if (Directory.Exists(Path.Combine(Directories.CurrentDirectory, "iwanttogetbanned")))
            {
                return(new UpdateResponse(CoreUpdateState.Operational, Utility.GetMultiLanguageText("NotUpdateNeeded")));
            }

            try
            {
                if (!WebService.Client.IsAuthenticated)
                {
                    Utility.Log(LogStatus.Error, "UpdateCore", "WebService authentication failed", Logs.MainLog);
                    return(new UpdateResponse(CoreUpdateState.Unknown, "WebService authentication failed"));
                }

                var leagueChecksum = Utility.Md5Checksum(path);
                var coreChecksum   = Utility.Md5Checksum(Directories.CoreFilePath);
                var core           = WebService.Client.Core(leagueChecksum);

                if (core == null)
                {
                    return(new UpdateResponse(
                               CoreUpdateState.Maintenance,
                               Utility.GetMultiLanguageText("WrongVersion") + Environment.NewLine + leagueChecksum));
                }

                if (core.HashCore != coreChecksum && (core.Url.StartsWith("https://github.com/joduskame/") || core.Url.StartsWith("https://github.com/LeagueSharp/")))
                {
                    try
                    {
                        var result = CoreUpdateState.Unknown;

                        await Application.Current.Dispatcher.Invoke(
                            async() =>
                        {
                            var window = new UpdateWindow(UpdateAction.Core, core.Url);
                            window.Show();

                            if (await window.Update())
                            {
                                result = CoreUpdateState.Operational;
                            }
                        });

                        return(new UpdateResponse(result, Utility.GetMultiLanguageText("UpdateSuccess")));
                    }
                    catch (Exception e)
                    {
                        var message = Utility.GetMultiLanguageText("FailedToDownload") + e;

                        if (showMessages)
                        {
                            MessageBox.Show(message);
                        }

                        return(new UpdateResponse(CoreUpdateState.Unknown, message));
                    }
                    finally
                    {
                        if (File.Exists(UpdateZip))
                        {
                            File.Delete(UpdateZip);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Utility.Log(LogStatus.Error, "UpdateCore", e.Message, Logs.MainLog);
            }

            return(new UpdateResponse(CoreUpdateState.Operational, Utility.GetMultiLanguageText("NotUpdateNeeded")));
        }
        public void UpdateProdutoFinanceiro(object objRelayCommand)
        {
            UpdateWindow updateWindow = new UpdateWindow((IProdutoFinanceiro)objRelayCommand);

            updateWindow.Show();
        }
Esempio n. 17
0
 private void ChangeLogButtonClicked(object sender, RoutedEventArgs e)
 {
     _updater.Show(true, false);
 }
Esempio n. 18
0
 public static void Show(WindowType windowType)
 {
     try
     {
         if (windowType.Equals(WindowType.About))
         {
             if (aboutForm == null || aboutForm.IsDisposed)
             {
                 aboutForm  = new AboutWindow(aboutPanel);
                 aboutPanel = aboutForm;
             }
             aboutForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ActiveDirectoryImport))
         {
             if (adimportForm == null || adimportForm.IsDisposed)
             {
                 adimportForm  = new ActiveDirectoryImportWindow(adimportPanel);
                 adimportPanel = adimportForm;
             }
             adimportPanel.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Options))
         {
             using (var optionsForm = new frmOptions())
             {
                 optionsForm.ShowDialog(frmMain.Default.pnlDock);
             }
         }
         else if (windowType.Equals(WindowType.SSHTransfer))
         {
             sshtransferForm  = new SSHTransferWindow(sshtransferPanel);
             sshtransferPanel = sshtransferForm;
             sshtransferForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Update))
         {
             if (updateForm == null || updateForm.IsDisposed)
             {
                 updateForm  = new UpdateWindow(updatePanel);
                 updatePanel = updateForm;
             }
             updateForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Help))
         {
             if (helpForm == null || helpForm.IsDisposed)
             {
                 helpForm  = new HelpWindow(helpPanel);
                 helpPanel = helpForm;
             }
             helpForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ExternalApps))
         {
             if (externalappsForm == null || externalappsForm.IsDisposed)
             {
                 externalappsForm  = new ExternalToolsWindow(externalappsPanel);
                 externalappsPanel = externalappsForm;
             }
             externalappsForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.PortScan))
         {
             portscanForm  = new PortScanWindow(portscanPanel);
             portscanPanel = portscanForm;
             portscanForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.UltraVNCSC))
         {
             if (ultravncscForm == null || ultravncscForm.IsDisposed)
             {
                 ultravncscForm  = new UltraVNCWindow(ultravncscPanel);
                 ultravncscPanel = ultravncscForm;
             }
             ultravncscForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.ComponentsCheck))
         {
             if (componentscheckForm == null || componentscheckForm.IsDisposed)
             {
                 componentscheckForm  = new ComponentsCheckWindow(componentscheckPanel);
                 componentscheckPanel = componentscheckForm;
             }
             componentscheckForm.Show(frmMain.Default.pnlDock);
         }
         else if (windowType.Equals(WindowType.Announcement))
         {
             if (AnnouncementForm == null || AnnouncementForm.IsDisposed)
             {
                 AnnouncementForm  = new AnnouncementWindow(AnnouncementPanel);
                 AnnouncementPanel = AnnouncementForm;
             }
             AnnouncementForm.Show(frmMain.Default.pnlDock);
         }
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddExceptionStackTrace("App.Runtime.Windows.Show() failed.", ex);
     }
 }
        private void StartUi(IAppVersion newVersion)
        {
            UpdateWindow window = new UpdateWindow(newVersion, this._localVersion);

            Dispatcher.CurrentDispatcher.Invoke((Action)(() => { window.Show(); }));
        }