public void NotifyClearItems()
 {
     if (UpdateNotifier != null)
     {
         UpdateNotifier.NotifyClearItems();
     }
 }
コード例 #2
0
 internal void ShowUpdateProgress(string title, UpdateNotifier notifier)
 {
     mUpdateProgress = new UpdateProgress(
         notifier, mWkInfo.ClientPath, title, mWorkspaceWindow);
     mUpdateProgress.OnUpdateProgress();
     mSecondsSinceLastProgressUpdate = 0;
 }
 public void NotifyRemoveItem(int index, object oldItem)
 {
     if (UpdateNotifier != null)
     {
         UpdateNotifier.NotifyRemoveItem(index, oldItem);
     }
 }
 public void NotifySetItem(int index, object oldItem, object newItem)
 {
     if (UpdateNotifier != null)
     {
         UpdateNotifier.NotifySetItem(index, oldItem, newItem);
     }
 }
 public void NotifyInsertItem(int index, object newItem)
 {
     if (UpdateNotifier != null)
     {
         UpdateNotifier.NotifyInsertItem(index, newItem);
     }
 }
 public override void Run()
 {
     if (AddInManagerServices.Settings.AutoSearchForUpdates)
     {
         // Initialize UpdateNotifier and let it check for available updates
         var updateNotifier = new UpdateNotifier();
         updateNotifier.StartUpdateLookup();
     }
 }
コード例 #7
0
 internal UpdateProgress(
     UpdateNotifier notifier, string wkPath, string title,
     PlasticGUIClient guiClient)
 {
     mNotifier  = notifier;
     mWkPath    = wkPath;
     mGuiClient = guiClient;
     mGuiClient.Progress.ProgressHeader    = title;
     mGuiClient.Progress.CanCancelProgress = false;
 }
コード例 #8
0
 public EditScene(IMouse mouse, IKeyboard keyboard)
     : base(mouse, keyboard)
 {
     UpdateNotifier                   = new UpdateNotifier();
     UpdateNotifier.ChildAdded       += ChildAdded;
     UpdateNotifier.ChildRemoved     += ChildRemoved;
     UpdateNotifier.ComponentAdded   += ComponentAdded;
     UpdateNotifier.ComponentRemoved += ComponentRemoved;
     UpdateNotifier.ComponentChanged += ComponentChanged;
 }
コード例 #9
0
        async void CheckForUpdates()
        {
            if (!SettingsProvider.Current.Settings.GeneralSettings.CheckForUpdates)
            {
                return;
            }

            UpdateCheckResult result = await Task.Run(() => UpdateNotifier.CheckForUpdate(SettingsProvider.Current.Settings.GeneralSettings.FirstRun));

            OnUpdateCheckComplete(result);
        }
コード例 #10
0
        public MainWindow()
        {
            Db.tmp = true;
            Thread.Sleep(5000);
            _updateNotifier = new();

            InitializeComponent();
            GetDataFromDb();

            _updateNotifier.NotifyDbChanged += GetDataFromDb;
        }
コード例 #11
0
ファイル: UpdateProgress.cs プロジェクト: BaseDorp/TankGame
        internal UpdateProgress(
            UpdateNotifier notifier, string wkPath, string title,
            WorkspaceWindow workspaceWindow)
        {
            mNotifier        = notifier;
            mWkPath          = wkPath;
            mWorkspaceWindow = workspaceWindow;

            mProgressData = new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now);

            mWorkspaceWindow.Progress.ProgressHeader    = title;
            mWorkspaceWindow.Progress.CanCancelProgress = false;
        }
コード例 #12
0
        internal UpdateProgress(
            UpdateNotifier notifier, string wkPath, string title,
            PlasticGUIClient guiClient)
        {
            mNotifier  = notifier;
            mWkPath    = wkPath;
            mGuiClient = guiClient;

            mProgressData = new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now);

            mGuiClient.Progress.ProgressHeader    = title;
            mGuiClient.Progress.CanCancelProgress = false;
        }
コード例 #13
0
        public MainWindow()
        {
            Db.Init();
            InitializeComponent();

            GetDataFromDb();

            _updateNotifier = new();
            _updateNotifier.NotifyDbChanged += GetDataFromDb;
            StateChanged += MainWindow_StateChanged;

            ManageControlsInGrid(AccountsControl);
            ManageControlsInGrid(ClientsControl);
            ManageControlsInGrid(DepositsControl);
            ManageControlsInGrid(TransactionsControl);
        }
コード例 #14
0
ファイル: Core.cs プロジェクト: Chemsorly/ConducThor
        public override void Initialize()
        {
            //init updater
            _updateNotifier = new UpdateNotifier();
            _updateNotifier.PropertyChanged += (sender, args) => OnPropertyChanged(nameof(VersionStatus));

            //forward signalr manager
            _signalrmanager = new SignalRManager();
            _signalrmanager.NewClientEvent          += delegate(Client client) { NewClientEvent?.Invoke(client); };
            _signalrmanager.ClientDisconnectedEvent += delegate(Client client) { ClientDisconnectedEvent?.Invoke(client); };
            _signalrmanager.ClientUpdatedEvent      += delegate(Client client) { ClientUpdatedEvent?.Invoke(client); };
            _signalrmanager.NewLogMessageEvent      += NotifyNewLogMessageEvent;
            _signalrmanager.NewConsoleLogMessage    += delegate(Client pClient, string message) { NewConsoleLogMessage?.Invoke(pClient, message); };
            _signalrmanager.WorkRequestedEvent      += SignalrmanagerOnWorkRequestedEvent;
            _signalrmanager.ResultsReceivedEvent    += SignalrmanagerOnResultsReceivedEvent;
            _signalrmanager.Initialize();

            //create command manager
            _commandManager = new CommandManager();
            _commandManager.NewLogMessageEvent += NotifyNewLogMessageEvent;
            _commandManager.Initialize();

            base.Initialize();
        }
コード例 #15
0
 void IWorkspaceWindow.ShowUpdateProgress(string title, UpdateNotifier notifier)
 {
     mDeveloperProgressOperationHandler.ShowUpdateProgress(title, mUpdateNotifierForTesting ?? notifier);
 }
コード例 #16
0
 public void SetUpdateNotifierForTesting(UpdateNotifier updateNotifier)
 {
     mUpdateNotifierForTesting = updateNotifier;
 }
コード例 #17
0
 internal void SetUpdateNotifierForTesting(UpdateNotifier updateNotifier)
 {
     mUpdateNotifierForTesting = updateNotifier;
 }
コード例 #18
0
        /// <summary>
        /// Downloads updated versions of each file that is outdated.
        /// </summary>
        /// <exception cref="DeploymentManifestException">
        /// if the deployment manifest has not yet been loaded
        /// </exception>
        private bool UpdateFiles()
        {
            // Ensure the deployment manifest has been loaded
            if (DeploymentManifest == null)
            {
                throw new DeploymentManifestException();
            }

            // First, load the application manifest from the deployment manifest
            DeploymentManifest.LoadApplicationManifest();

            // Start a list of file downloaders the will be obtained from
            // the application manifest.
            _FileDownloaders = new List <FileDownloader>();
            _Saved           = new List <FileDownloader>();

            // Then, iterate through each downloadable file, determine if
            // an update is required for it, and download a new version
            // if necessary.
            foreach (IDownloadableFile file in
                     DeploymentManifest.ApplicationManifest.DownloadableFiles)
            {
                FileDownloader download = file.GetDownloader();
                download.Completed += new EventHandler(download_Completed);
                download.Cancelled += new EventHandler(download_Cancelled);
                download.Error     += new EventHandler <ExceptionEventArgs>(download_Error);
                download.Saved     += new EventHandler(download_Saved);

                log.Debug("Retrieved a downloader for '" + download.DestinationName + "'...");
                _FileDownloaders.Add(download);
            }

            log.Debug("Determining total download size...");

            // Determine the file patterns that are preserved (never overwritten)
            // during the update process...
            List <string> preservedPatterns    = new List <string>();
            DDayUpdateConfigurationSection cfg = ConfigurationManager.GetSection("DDay.Update")
                                                 as DDayUpdateConfigurationSection;

            if (cfg != null)
            {
                foreach (KeyValuePairConfigurationElement kvpe in cfg.Preserve)
                {
                    if (!string.IsNullOrEmpty(kvpe.Value))
                    {
                        preservedPatterns.Add(kvpe.Value);
                    }
                }
            }

            // Determine the preserved status of each file downloader.
            // Preserved files will not be downloaded
            foreach (FileDownloader downloader in _FileDownloaders)
            {
                downloader.DeterminePreservedStatus(preservedPatterns.ToArray());
            }

            // Determine the total size in bytes of updates to be made
            long totalSize = 0;

            foreach (FileDownloader downloader in _FileDownloaders)
            {
                totalSize += downloader.DownloadSize;
            }

            log.Debug("Total download size is " + totalSize + " bytes; notifying GUI...");

            // Notify of the total update size in bytes
            if (UpdateNotifier != null)
            {
                UpdateNotifier.NotifyTotalUpdateSize(totalSize);
            }

            // Setup an event to synchronize with...
            _DownloadEvent = new AutoResetEvent(false);

            log.Debug("Downloading each file to be updated...");

            // Download each file
            foreach (FileDownloader downloader in _FileDownloaders)
            {
                if (!CancelledOrError)
                {
                    // Download the new copy of the file
                    downloader.Download(UpdateNotifier);

                    // Wait for the item to be downloaded
                    _DownloadEvent.WaitOne();
                }
                else
                {
                    break;
                }
            }

            log.Info("File downloads finished.");
            return(true);
        }
コード例 #19
0
        /// <summary>
        /// Performs an update using the update manager's deployment manifest.
        /// </summary>
        /// <param name="doQuietUpdate">
        /// True if no user-intervention should be allowed,
        /// false otherwise (defaults to false).
        /// </param>
        /// <returns>True if an update was started, false otherwise.</returns>
        public bool Update(bool doQuietUpdate)
        {
            try
            {
                log.Debug("Beginning update process...");

                // Add event handlers for our event notifiers
                if (UpdateNotifier != null)
                {
                    log.Debug("Update Notifier setup as '" + UpdateNotifier.ToString() + "'...");
                    log.Debug("Notifying update notifier that the update is beginning...");

                    // Begin the update process with our notifier
                    UpdateNotifier.BeginUpdate(UpdateManager.DeploymentManifest);
                }

                // Determine if the update is required.  If not, then give the user
                // the option to update or not.
                bool doUpdate = true;

                // NOTE: only give the user the option when a valid current version can
                // be detected (a local deployment manifest exists); otherwise, this is
                // a forced deployment (an install rather than an update)
                if (!doQuietUpdate &&
                    (LocalDeploymentManifest != null) &&
                    (UpdateNotifier != null) &&
                    (
                        (DeploymentManifest.Deployment == null) ||
                        (DeploymentManifest.Deployment.MinimumRequiredVersion == null) ||
                        (DeploymentManifest.Deployment.MinimumRequiredVersion < DeploymentManifest.CurrentPublishedVersion)
                    ))
                {
                    try
                    {
                        // Ensure an application manifest exists for the previous version!
                        // If it doesn't, we won't be able to start the previous version,
                        // and the application will crash if the user selects "update later."
                        if (LocalDeploymentManifest == null)
                        {
                            throw new ManifestException();
                        }
                        LocalDeploymentManifest.LoadApplicationManifest();

                        log.Debug("Update is optional; confirming update with user...");
                        doUpdate = UpdateNotifier.ConfirmDoUpdate();

                        if (doUpdate)
                        {
                            log.Debug("User accepted update.");
                        }
                        else
                        {
                            log.Debug("User declined update.");
                        }
                    }
                    catch (ManifestException)
                    {
                        log.Warn("The application manifest is missing for the previous " +
                                 "version of the application; update is starting automatically...");
                    }
                }

                if (doUpdate)
                {
                    log.Debug("Update is approved. Updating files...");

                    // Copy the previous version, if applicable
                    CopyPreviousVersion();

                    // Update files, if necessary
                    doUpdate = UpdateFiles();
                }

                if (UpdateNotifier != null)
                {
                    // End the update process with our notifier
                    UpdateNotifier.EndUpdate();
                }

                return(doUpdate);
            }
            catch (Exception ex)
            {
                log.Error("Could not perform update.", ex);

                // Notify the update notifier of the exception
                if (UpdateNotifier != null)
                {
                    UpdateNotifier.NotifyException(ex);
                }
            }

            return(false);
        }