예제 #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || provider == null)
            {
                return(base.EditValue(context, provider, value));
            }

            string filePath         = value as string;
            string initialDirectory = null;

            if (!string.IsNullOrEmpty(filePath))
            {
                filePath = Helpers.ExpandFolderVariables(filePath, true);
                string directoryPath = Path.GetDirectoryName(filePath);

                if (!string.IsNullOrEmpty(directoryPath) && Directory.Exists(directoryPath))
                {
                    initialDirectory = directoryPath;
                }
            }

            filePath = ImageHelpers.OpenImageFileDialog(null, initialDirectory);

            if (!string.IsNullOrEmpty(filePath))
            {
                value = Helpers.GetVariableFolderPath(filePath, true);
            }

            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context == null || provider == null)
     {
         return(base.EditValue(context, provider, value));
     }
     using (FolderSelectDialog dlg = new FolderSelectDialog())
     {
         dlg.Title = Resources.DirectoryNameEditor_EditValue_Browse_for_a_folder___;
         if (dlg.ShowDialog())
         {
             value = Helpers.GetVariableFolderPath(dlg.FileName);
         }
     }
     return(value);
 }
예제 #3
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || provider == null)
            {
                return(base.EditValue(context, provider, value));
            }

            string filePath = ImageHelpers.OpenImageFileDialog();

            if (!string.IsNullOrEmpty(filePath))
            {
                value = Helpers.GetVariableFolderPath(filePath);
            }

            return(value);
        }