Example #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // Uses the IWindowsFormsEditorService to display a
            // drop-down UI in the Properties window.
            IWindowsFormsEditorService edSvc =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                // Display an angle selection control and retrieve the value.
                //view.DefaultExt = "ply";
                this.view.Filter =
                    "All Know Files|*.ply;*.byu;*.obj;*.off;*.noff;*.cnoff|Ply Files|*.ply|Byu Files|*.byu|Wave Obj Files|*.obj|Off Files|*.off;*.noff;*.cnoff";
                if (this.view.ShowDialog() == DialogResult.OK)
                {
                    MeshModel model = context.Instance as MeshModel;
                    if (model != null)
                    {
                        model.FilePath = this.view.FileName;
                        LoadingMeshModelDialog modelDlg = new LoadingMeshModelDialog(model);
                        if (modelDlg.ShowDialog() == DialogResult.OK)
                        {
                            return(this.view.FileName);
                        }
                        else
                        {
                            model = new MeshModel();
                        }
                    }
                }
            }
            return("");
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     // Uses the IWindowsFormsEditorService to display a
     // drop-down UI in the Properties window.
     IWindowsFormsEditorService edSvc =
         (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService));
     if (edSvc != null) {
         // Display an angle selection control and retrieve the value.
         //view.DefaultExt = "ply";
         this.view.Filter =
             "All Know Files|*.ply;*.byu;*.obj;*.off;*.noff;*.cnoff|Ply Files|*.ply|Byu Files|*.byu|Wave Obj Files|*.obj|Off Files|*.off;*.noff;*.cnoff";
         if (this.view.ShowDialog() == DialogResult.OK) {
             MeshModel model = context.Instance as MeshModel;
             if (model != null) {
                 model.FilePath = this.view.FileName;
                 LoadingMeshModelDialog modelDlg = new LoadingMeshModelDialog(model);
                 if (modelDlg.ShowDialog() == DialogResult.OK) {
                     return this.view.FileName;
                 } else {
                     model = new MeshModel();
                 }
             }
         }
     }
     return "";
 }