public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            FileObject obj = value as FileObject;

            if (obj == null)
            {
                return(value);
            }

            if (obj.ForOpen)
            {
                System.Windows.Forms.OpenFileDialog dlg = new OpenFileDialog();
                dlg.Title           = obj.Title;
                dlg.Filter          = obj.Pattern;
                dlg.FileName        = obj.Filename;
                dlg.CheckFileExists = obj.CheckFileExists;
                dlg.CheckPathExists = true;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    obj.Filename = dlg.FileName;
                    return(obj);
                }
            }
            else
            {
                System.Windows.Forms.SaveFileDialog dlg = new SaveFileDialog();
                dlg.Title           = obj.Title;
                dlg.Filter          = obj.Pattern;
                dlg.FileName        = obj.Filename;
                dlg.CheckFileExists = obj.CheckFileExists;
                dlg.CheckPathExists = true;
                dlg.OverwritePrompt = true;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    obj.Filename = dlg.FileName;
                    return(obj);
                }
            }
            return(value);
        }
 public NodeDataFile(TreeNode nodeParent)
 {
     _nodes = nodeParent;
     _file  = new FileObject();
     _file.OnFilenameChanged += new EventHandler(_file_OnFilenameChanged);
 }