Sql Script to Build Empty VE-PROMS Database
Use new settings (ConvertTo and ExecutableMode) New Settings Use new setting (PDF Folder) Use and Control new settings
This commit is contained in:
111
PROMS/DataLoader/UIFileNameEditor.cs
Normal file
111
PROMS/DataLoader/UIFileNameEditor.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
//using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DataLoader
|
||||
{
|
||||
|
||||
public class UIFilenameEditor : System.Drawing.Design.UITypeEditor
|
||||
{
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
|
||||
{
|
||||
if (context != null && context.Instance != null)
|
||||
{
|
||||
if (!context.PropertyDescriptor.IsReadOnly)
|
||||
{
|
||||
return UITypeEditorEditStyle.Modal;
|
||||
}
|
||||
}
|
||||
return UITypeEditorEditStyle.None;
|
||||
}
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
|
||||
{
|
||||
if (context == null || provider == null || context.Instance == null)
|
||||
{
|
||||
return base.EditValue(provider, value);
|
||||
}
|
||||
FileDialog fileDlg;
|
||||
if (context.PropertyDescriptor.Attributes[typeof(SaveFileAttribute)] == null)
|
||||
{
|
||||
fileDlg = new OpenFileDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
fileDlg = new SaveFileDialog();
|
||||
}
|
||||
fileDlg.Title = "Select " + context.PropertyDescriptor.DisplayName;
|
||||
fileDlg.FileName = (string)value;
|
||||
FileDialogFilterAttribute filterAtt = (FileDialogFilterAttribute)context.PropertyDescriptor.Attributes[typeof(FileDialogFilterAttribute)];
|
||||
if (filterAtt != null)
|
||||
{
|
||||
fileDlg.Filter = filterAtt.Filter;
|
||||
}
|
||||
if (fileDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = fileDlg.FileName;
|
||||
}
|
||||
fileDlg.Dispose();
|
||||
return value;
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class FileDialogFilterAttribute : Attribute
|
||||
{
|
||||
private string _filter;
|
||||
|
||||
public string Filter
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._filter;
|
||||
}
|
||||
}
|
||||
public FileDialogFilterAttribute(string filter)
|
||||
{
|
||||
this._filter = filter;
|
||||
}
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class SaveFileAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
public enum FileDialogType
|
||||
{
|
||||
LoadFileDialog,
|
||||
SaveFileDialog
|
||||
}
|
||||
}
|
||||
public class UIFolderEditor : System.Drawing.Design.UITypeEditor
|
||||
{
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
|
||||
{
|
||||
if (context != null && context.Instance != null)
|
||||
{
|
||||
if (!context.PropertyDescriptor.IsReadOnly)
|
||||
{
|
||||
return UITypeEditorEditStyle.Modal;
|
||||
}
|
||||
}
|
||||
return UITypeEditorEditStyle.None;
|
||||
}
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
|
||||
{
|
||||
if (context == null || provider == null || context.Instance == null)
|
||||
{
|
||||
return base.EditValue(provider, value);
|
||||
}
|
||||
FolderBrowserDialog folderDlg=new FolderBrowserDialog();
|
||||
folderDlg.SelectedPath = (string)value;
|
||||
if (folderDlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = folderDlg.SelectedPath;
|
||||
}
|
||||
folderDlg.Dispose();
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user