Example #1
0
 public MappingForm(MfVault vault, MfObjType objType, List <MfClassPropDef> props, List <PropValue> fileProps)
 {
     InitializeComponent();
     _vault     = vault;
     _objType   = objType;
     _props     = props;
     _fileProps = fileProps;
     AddToolTip();
 }
Example #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _vault = MfVault.GetFromConfig(ConfigPath, _vaultName);
            if (_vault == null) //从配置中加载失败
            {
                _vault = MfVault.GetVault(_vaultName);
            }
            var objTypes = _vault.GetObjectTypes();

            comboBoxObjType.DataSource = objTypes;
            var     lastConfig   = _vault.GetLastMapping();
            var     objTypeIndex = 0;
            MfClass mfClass      = null;

            if (lastConfig != null)
            {
                _currentObjType = lastConfig.ObjType;

                for (var i = 0; i < objTypes.Count; i++)
                {
                    if (_currentObjType.Equals(objTypes[i]))
                    {
                        objTypeIndex = i;
                        break;
                    }
                }
                mfClass = lastConfig.ObjectClass;
            }
            else
            {
                _currentObjType = objTypes[objTypeIndex];
            }
            comboBoxObjType.SelectedIndex = objTypeIndex;
            var mcs        = _vault.GetClasses(_currentObjType.Id);
            var classIndex = 0;

            for (var i = 0; i < mcs.Count; i++)
            {
                comboBoxClasses.Items.Add(mcs[i]);
                if (mfClass != null && mfClass.Equals(mcs[i]))
                {
                    classIndex = i;
                }
            }
            comboBoxClasses.SelectedIndex = classIndex;
            _currentClass = mcs[classIndex];
            this.comboBoxObjType.SelectedIndexChanged += new System.EventHandler(this.comboBoxObjType_SelectedIndexChanged);
            this.comboBoxClasses.SelectedIndexChanged += new System.EventHandler(this.comboBoxClasses_SelectedIndexChanged);
        }
Example #3
0
        private void comboBoxObjType_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentObjType = comboBoxObjType.SelectedItem as MfObjType;
            var csList = _vault.GetClasses(_currentObjType.Id);

            if (comboBoxClasses.Items.Count > 0)
            {
                comboBoxClasses.Items.Clear();
            }
            foreach (var c in csList)
            {
                comboBoxClasses.Items.Add(c);
            }
            comboBoxClasses.SelectedIndex = 0;
        }