Ejemplo n.º 1
0
        private void newAppButton_Click(object sender, EventArgs e)
        {
            if (xdata != null)
            {
                addNewXDataForm addNewXDataForm = new addNewXDataForm(xdata);
                Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(addNewXDataForm);

                if (addNewXDataForm.AppName == null ||
                    addNewXDataForm.Param == null ||
                    addNewXDataForm.Value == null)
                {
                    //do nothing
                }
                else
                {
                    string appname = addNewXDataForm.AppName;
                    if (!XData.IsAppExist(appname))
                    {
                        XData.RegisterApp(addNewXDataForm.AppName);
                    }

                    xdata.CreateXData(appname, addNewXDataForm.Param, addNewXDataForm.Value);//内部

                    //xdata.setCurrentAppName(appname);//设置当前appname

                    int index = this.appNamesComboBox.SelectedIndex + 1;
                    this.appNamesComboBox.Items.Insert(index, appname);//在原有的数据后面加入
                    this.appNamesComboBox.SelectedIndex = index;
                }
            }
            else
            {
                MessageBox.Show("必须选择一个实体!");
                this.selectButton.Focus();
            }
        }
Ejemplo n.º 2
0
        private void newAppButton_Click(object sender, EventArgs e)
        {
 
            if (xdata != null)
            {
                addNewXDataForm addNewXDataForm = new addNewXDataForm(xdata);
                Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(addNewXDataForm);

                if (addNewXDataForm.AppName == null ||
                    addNewXDataForm.Param == null ||
                    addNewXDataForm.Value == null)
                {
                    //do nothing
                }
                else
                {
                    string appname = addNewXDataForm.AppName;
                    if (!XData.IsAppExist(appname))
                    {
                        XData.RegisterApp(addNewXDataForm.AppName);
                    }

                    xdata.CreateXData(appname, addNewXDataForm.Param, addNewXDataForm.Value);//内部

                    //xdata.setCurrentAppName(appname);//设置当前appname

                    int index = this.appNamesComboBox.SelectedIndex+1;
                    this.appNamesComboBox.Items.Insert(index, appname);//在原有的数据后面加入
                    this.appNamesComboBox.SelectedIndex = index;
                }
            }
            else
            {
                MessageBox.Show("必须选择一个实体!");
                this.selectButton.Focus();
            }
        }