Пример #1
0
 private static string ShowFileDialog(FileDialogPresenter dialog, string initialDirectory, string fileName, string extension, string filter)
 {
     if (!String.IsNullOrEmpty(initialDirectory))
     {
         dialog.InitialDirectory = initialDirectory;
     }
     if (!String.IsNullOrEmpty(fileName))
     {
         dialog.FileName = fileName;
     }
     dialog.DefaultExt = extension;
     dialog.Filter     = filter;
     return(dialog.ShowDialog() == DialogResult.OK ? dialog.FileName : null);
 }
Пример #2
0
        public void FileSaveAsClick(FileDialogPresenter saveFile)
        {
            if (ClientConfiguration.Count == 0)
            {
                return;
            }

            saveFile.DefaultExt = _settingsManager.FileExtension;
            saveFile.Filter     = _settingsManager.FileTypeFilters;
            if (saveFile.ShowDialog() == DialogResult.OK)
            {
                WriteClientConfiguration(saveFile.FileName, saveFile.FilterIndex);
            }
        }
Пример #3
0
 public void FileOpenClick(FileDialogPresenter openFile)
 {
     if (CheckForConfigurationChanges())
     {
         openFile.DefaultExt       = _settingsManager.FileExtension;
         openFile.Filter           = _settingsManager.FileTypeFilters;
         openFile.FileName         = _settingsManager.FileName;
         openFile.RestoreDirectory = true;
         if (openFile.ShowDialog() == DialogResult.OK)
         {
             ClearConfiguration();
             LoadConfigFile(openFile.FileName, openFile.FilterIndex);
         }
     }
 }
Пример #4
0
        private bool ShowSaveFileView(FileDialogPresenter saveFile)
        {
            if (Model.SelectedUpdateFile is null)
            {
                return(false);
            }

            saveFile.FileName = Model.SelectedUpdateFile.Name;
            if (saveFile.ShowDialog(Dialog) == DialogResult.OK)
            {
                Model.SelectedUpdateFileLocalFilePath = saveFile.FileName;
                return(true);
            }

            return(false);
        }
 internal void ExportClick(FileDialogPresenter saveFile, IList <IFileSerializer <List <WorkUnitRow> > > serializers)
 {
     saveFile.Filter = serializers.GetFileTypeFilters();
     if (saveFile.ShowDialog() == DialogResult.OK)
     {
         try
         {
             var serializer = serializers[saveFile.FilterIndex - 1];
             serializer.Serialize(saveFile.FileName, Model.Repository.Fetch(Model.SelectedWorkUnitQuery, Model.BonusCalculation).ToList());
         }
         catch (Exception ex)
         {
             Logger.Error(ex.Message, ex);
             MessageBox.ShowError(Form, String.Format(CultureInfo.CurrentCulture,
                                                      "The history data export failed.{0}{0}{1}", Environment.NewLine, ex.Message), Core.Application.NameAndVersion);
         }
     }
 }