コード例 #1
0
 private void CheckForUpdateCallback(IAsyncResult result)
 {
     try
     {
         var func = (Func <ApplicationUpdate>)result.AsyncState;
         ApplicationUpdate update = func.EndInvoke(result);
         if (update != null)
         {
             if (NewVersionAvailable(update.Version))
             {
                 ShowUpdate(update);
             }
             else if (_userInvoked)
             {
                 Owner.Invoke(new Action(() => _messageBoxView.ShowInformation(Owner, String.Format(CultureInfo.CurrentCulture,
                                                                                                    "{0} is already up-to-date.", Application.NameAndVersion), Owner.Text)), null);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ErrorFormat(ex, "{0}", ex.Message);
         if (_userInvoked)
         {
             string message = String.Format(CultureInfo.CurrentCulture, "{0} encountered the following error while checking for an update:{1}{1}{2}.",
                                            Application.NameAndVersion, Environment.NewLine, ex.Message);
             Owner.Invoke(new Action(() => _messageBoxView.ShowError(Owner, message, Owner.Text)), null);
         }
     }
     finally
     {
         CheckInProgress = false;
     }
 }
コード例 #2
0
        private void btnMoveColorUp_Click(object sender, EventArgs e)
        {
            if (lstColors.SelectedIndex == -1)
            {
                _messageBoxView.ShowInformation(this, "No Color Selected.", Text);
                return;
            }

            if (lstColors.SelectedIndex == 0)
            {
                return;
            }

            int   index     = lstColors.SelectedIndex;
            Color moveColor = _graphColors[index];

            _graphColors.RemoveAt(index);
            _graphColors.Insert(index - 1, moveColor);
            UpdateGraphColorsBinding();
            lstColors.SelectedIndex = index - 1;
        }
コード例 #3
0
        public void DeleteWorkUnitClick()
        {
            var entry = _model.SelectedHistoryEntry;

            if (entry == null)
            {
                _messageBoxView.ShowInformation(_view, "No work unit selected.", Core.Application.NameAndVersion);
            }
            else
            {
                var result = _messageBoxView.AskYesNoQuestion(_view, "Are you sure?  This operation cannot be undone.", Core.Application.NameAndVersion);
                if (result == DialogResult.Yes)
                {
                    _model.DeleteHistoryEntry(entry);
                }
            }
        }
コード例 #4
0
        public void ClientsViewCachedLogClick()
        {
            // Check for SelectedSlot, and get out if not found
            if (_gridModel.SelectedSlot == null)
            {
                return;
            }

            string logFilePath = Path.Combine(_prefs.Get <string>(Preference.CacheDirectory), _gridModel.SelectedSlot.Settings.CachedFahLogFileName());

            if (File.Exists(logFilePath))
            {
                HandleProcessStartResult(_processStarter.ShowCachedLogFile(logFilePath));
            }
            else
            {
                string message = String.Format(CultureInfo.CurrentCulture, "The log file for '{0}' does not exist.",
                                               _gridModel.SelectedSlot.Settings.Name);
                _messageBoxView.ShowInformation(_view, message, _view.Text);
            }
        }