Exemplo n.º 1
0
        private void Init()
        {
            SaveFileDialog = new SaveFileDialog();
            ApplyFilterOptions();
            string initialDirectory = null;

            try {
                conf.ValidateAndCorrectOutputFileAsFullpath();
                initialDirectory = Path.GetDirectoryName(conf.OutputFileAsFullpath);
            } catch {
                LOG.WarnFormat("OutputFileAsFullpath was set to {0}, ignoring due to problem in path.", conf.OutputFileAsFullpath);
            }

            if (!string.IsNullOrEmpty(initialDirectory) && Directory.Exists(initialDirectory))
            {
                SaveFileDialog.InitialDirectory = initialDirectory;
            }
            else if (Directory.Exists(conf.OutputFilePath))
            {
                SaveFileDialog.InitialDirectory = conf.OutputFilePath;
            }
            // The following property fixes a problem that the directory where we save is locked (bug #2899790)
            SaveFileDialog.RestoreDirectory = true;
            SaveFileDialog.OverwritePrompt  = true;
            SaveFileDialog.CheckPathExists  = false;
            SaveFileDialog.AddExtension     = true;
            ApplySuggestedValues();
        }