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) {
             TriangleModel model = context.Instance as TriangleModel;
             if (model != null) {
                 model.Path = this.view.FileName;
                 LoadingModelDialog modelDlg = new LoadingModelDialog(model);
                 if (modelDlg.ShowDialog() == DialogResult.OK) {
                     return this.view.FileName;
                 } else {
                     model = new TriangleModel();
                 }
             }
         }
     }
     return "";
 }
 public LoadingModelDialog(TriangleModel triangleModel)
 {
     this.InitializeComponent();
     this.DialogResult = DialogResult.Cancel;
     this.triangleModel = triangleModel;
     if (triangleModel.Path != null && File.Exists(triangleModel.Path)) {
         triangleModel.OnElementLoaded += this.triangleModel_OnElementLoaded;
         triangleModel.OnInitBuild += this.triangleModel_OnInitBuild;
         triangleModel.OnEndBuild += this.triangleModel_OnEndBuild;
     } else {
         this.Close();
     }
 }
Beispiel #3
0
        public TriangleModel GetModel()
        {
            TriangleModel triangle = new TriangleModel(m_ax, m_ay, m_bx, m_by, m_cx, m_cy);

            return(triangle);
        }
Beispiel #4
0
 public TriangleView(TriangleModel triangleModel)
 {
     InitializeComponent();
     this.DataContext = triangleModel;
 }