Ejemplo n.º 1
0
        public void Delete()
        {
            Cell cell = fpInterfaces_Sheet1.ActiveCell;

            if (cell == null)
            {
                return;
            }
            ISystemValueImplementor iSystemValueImplementor = fpInterfaces_Sheet1.Rows[cell.Row.Index].Tag as ISystemValueImplementor;

            //如果为非空的接口设置,才弹出确认删除询问。
            if (iSystemValueImplementor.DllName != string.Empty && iSystemValueImplementor.ClassName != string.Empty)
            {
                DialogResult dr = MessageBox.Show("确认要删除 " + iSystemValueImplementor.DllName + " 下的 " + iSystemValueImplementor.ClassName + " 吗?", "删除ISystemValue", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr != DialogResult.Yes)
                {
                    return;
                }
            }
            if (interfaceSetting.ISystemValueImplementorList.Contains(iSystemValueImplementor))
            {
                interfaceSetting.ISystemValueImplementorList.Remove(iSystemValueImplementor);
            }
            fpInterfaces_Sheet1.Rows.Remove(cell.Row.Index, 1);
            SendInterfaceToGlobalValue();
            if (Changed != null)
            {
                Changed(this, null);
            }
        }
Ejemplo n.º 2
0
        private void fpInterfaces_ButtonClicked(object sender, EditorNotifyEventArgs e)
        {
            DialogResult dr = openFileDialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                string      dllName  = openFileDialog.SafeFileName;
                List <Type> typeList = null;
                typeList = ReflectionManager.GetTypesByInterfaceWithOutAbstract(dllName, InterfaceType, TypeOfType.Class);
                if (typeList == null || typeList.Count == 0)
                {
                    return;
                }
                SetHyperLinkCellTypeCellText(fpInterfaces_Sheet1.Cells[e.Row, e.Column], dllName);
                ISystemValueImplementor iSystemValueImplementor = fpInterfaces_Sheet1.Rows[e.Row].Tag as ISystemValueImplementor;
                iSystemValueImplementor.DllName = dllName;
                string[] types = new string[typeList.Count];
                for (int i = 0; i < typeList.Count; i++)
                {
                    types[i] = typeList[i].FullName;
                }
                comboBoxCellType.Items = types;
                fpInterfaces_Sheet1.Cells[e.Row, 1].CellType = comboBoxCellType.Clone() as FarPoint.Win.Spread.CellType.ComboBoxCellType;
                fpInterfaces_Sheet1.Cells[e.Row, 1].Locked   = false;
            }
        }
Ejemplo n.º 3
0
        public void Add()
        {
            ISystemValueImplementor iSystemValueImplementor = new ISystemValueImplementor();

            //添加至FP。此时先不将iSystemValueImplementor添加至interfaceSetting.ISystemValueImplementorList中。在FP的EditChange进行添加。
            //因为只有在选择一个完成的接口实现类之后才会触发EditChange事件,此时再将新添加的接口实现类添加至interfaceSetting.ISystemValueImplementorList才有意义。
            Add(iSystemValueImplementor);
            if (Changed != null)
            {
                Changed(this, null);
            }
        }
Ejemplo n.º 4
0
 private void fpInterfaces_EditChange(object sender, EditorNotifyEventArgs e)
 {
     if (e.Column == 1)
     {
         ISystemValueImplementor iSystemValueImplementor = fpInterfaces_Sheet1.Rows[e.Row].Tag as ISystemValueImplementor;
         iSystemValueImplementor.ClassName = fpInterfaces_Sheet1.Cells[e.Row, 1].Text;
         if (!interfaceSetting.ISystemValueImplementorList.Contains(iSystemValueImplementor))
         {
             interfaceSetting.ISystemValueImplementorList.Add(iSystemValueImplementor);
         }
         SendInterfaceToGlobalValue();
     }
 }
Ejemplo n.º 5
0
        private void Add(ISystemValueImplementor iSystemValueImplementor)
        {
            fpInterfaces_Sheet1.Rows.Count++;
            int lastRowIndex = fpInterfaces_Sheet1.Rows.Count - 1;

            fpInterfaces_Sheet1.Rows[lastRowIndex].Tag = iSystemValueImplementor;
            if (iSystemValueImplementor.DllName == string.Empty)
            {
                fpInterfaces_Sheet1.Cells[lastRowIndex, 0].Value = "单击选择文件";
            }
            else
            {
                fpInterfaces_Sheet1.Cells[lastRowIndex, 0].Value = iSystemValueImplementor.DllName;
            }
            fpInterfaces_Sheet1.Cells[lastRowIndex, 1].Value = iSystemValueImplementor.ClassName;
            Cell cell = fpInterfaces_Sheet1.Cells[lastRowIndex, 0];

            SetHyperLinkCellTypeCellText(cell, cell.Value.ToString());
        }