internal void ExportClick()
        {
            var serializers = ExportSerializers ?? new List <IFileSerializer <List <HistoryEntry> > >
            {
                new HistoryEntryCsvSerializer()
            };

            var saveFileDialogView = _viewFactory.GetSaveFileDialogView();

            saveFileDialogView.Filter = serializers.GetFileTypeFilters();
            if (saveFileDialogView.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var serializer = serializers[saveFileDialogView.FilterIndex - 1];
                    serializer.Serialize(saveFileDialogView.FileName, _model.FetchSelectedQuery().ToList());
                }
                catch (Exception ex)
                {
                    Logger.ErrorFormat(ex, "{0}", ex.Message);
                    _messageBoxView.ShowError(_view, String.Format(CultureInfo.CurrentCulture,
                                                                   "The history data export failed.{0}{0}{1}", Environment.NewLine, ex.Message), Core.Application.NameAndVersion);
                }
            }
            _viewFactory.Release(saveFileDialogView);
        }
Example #2
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;
     }
 }
        private bool ValidateAcceptance()
        {
            SetPropertyErrorState();
            // Check for error conditions
            if (SettingsModel.NameError ||
                SettingsModel.FahLogFileNameError ||
                SettingsModel.UnitInfoFileNameError ||
                SettingsModel.QueueFileNameError ||
                SettingsModel.ServerError ||
                SettingsModel.PortError ||
                SettingsModel.CredentialsError ||
                SettingsModel.PathEmpty)
            {
                _messageBoxView.ShowError(_settingsView,
                                          "There are validation errors.  Please correct the yellow highlighted fields.",
                                          Core.Application.NameAndVersion);
                return(false);
            }

            if (SettingsModel.PathError)
            {
                if (_messageBoxView.AskYesNoQuestion(_settingsView,
                                                     "There are validation errors.  Do you wish to accept the input anyway?",
                                                     Core.Application.NameAndVersion) == DialogResult.Yes)
                {
                    return(true);
                }

                return(false);
            }

            return(true);
        }
Example #4
0
        public void ConnectClicked()
        {
            if (_messageConnection.Connected)
            {
                return;
            }

            try
            {
                Connect();
            }
            catch (Exception ex)
            {
                _messageBoxView.ShowError(_settingsView, ex.Message, Core.Application.NameAndVersion);
            }
        }
        private void linkDescription_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (linkDescription.Tag == null)
            {
                return;
            }
            string message = _processStarter.ShowWebBrowser(linkDescription.Tag.ToString());

            if (message != null)
            {
                _messageBoxView.ShowError(this, message, Text);
            }
        }
Example #6
0
 private void CheckForAndFireUpdateProcess()
 {
     if (!String.IsNullOrEmpty(_updateLogic.UpdateFilePath))
     {
         Logger.InfoFormat("Firing update file '{0}'...", _updateLogic.UpdateFilePath);
         try
         {
             Process.Start(_updateLogic.UpdateFilePath);
         }
         catch (Exception ex)
         {
             Logger.ErrorFormat(ex, "{0}", ex.Message);
             string message = String.Format(CultureInfo.CurrentCulture,
                                            "Update process failed to start with the following error:{0}{0}{1}",
                                            Environment.NewLine, ex.Message);
             _messageBoxView.ShowError(_view, message, _view.Text);
         }
     }
 }