Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool CheckSave()
        {
            if (_CurrentSelectedGuid.IsNullOrEmpty())
            {
                Wrapper.ShowDialog("请选择要切换的窗体");
                return(false);
            }
            if (_CurrentSelectedGuid.Equals(_PageGuid))
            {
                Wrapper.ShowDialog("自己不能切换到自己,你是否要重置刷新一下页面的内容?是的话请设置页面刷新即可");
                return(false);
            }

            string eventName    = string.Format("{0}", CurrentApiSelector.Name);
            string _controlName = string.Format("{0}", this.EventControlName);
            var    xml          = IDesignFramework.GetCurrentXmlTemplate();

            if (null == xml.EventLinkItem)
            {
                xml.EventLinkItem = new List <EventLinkInfo>();
            }
            //-->事件
            var eli = xml.EventLinkItem.Where(p => p.ControlName == _controlName && p.EventName == EventName).GetFirst <EventLinkInfo>();

            if (null == eli)
            {
                eli = new EventLinkInfo();
                xml.EventLinkItem.Add(eli);
            }
            eli.ControlName = _controlName;
            eli.EventName   = this.EventName;
            if (null == eli.Item)
            {
                eli.Item = new List <ControlActivityInfo>();
            }
            //-->行为
            var cai = eli.Item.Where(p => p.ControlName.IsNotEmpty() &&
                                     p.ControlName.Equals(_controlName) &&
                                     p.EventName.IsNotEmpty() &&
                                     p.EventName.Equals(eventName)).GetFirst <ControlActivityInfo>();

            if (null == cai)
            {
                cai = new ControlActivityInfo();
                eli.Item.Add(cai);
            }
            //-->保存操作。
            cai.ActivityName = this.ActivityName;
            cai.ActivityType = this.ActivityType;
            cai.ControlName  = _controlName;
            cai.EventName    = eventName;
            var _guid = this.IDesignFramework.GetCurrentXmlTemplate().BaseInfo.PageGUID;

            cai.Description = "切换窗体" + _guid;
            cai.PageGuid    = string.Format("{0},{1}", _CurrentSelectedGuid, _guid);
            IDesignFramework.UpdateCurrentTemplate();
            return(true);
        }
        bool UpdateMetaDataInfo()
        {
            var fields = this.lboxFields.Tag as List <MetaDataColumnInfo>;

            if (null == fields || 0 == fields.Count)
            {
                Wrapper.ShowDialog("字符参数为空");
                return(false);
            }
            var          dt  = fields[0];
            MetaDataInfo mdi = new MetaDataInfo();

            //-->克隆出数据。
            mdi.Item          = fields.CloneList <MetaDataColumnInfo>();
            mdi.table_comment = dt.table_comment;
            mdi.table_name    = dt.table_name;
            mdi.table_type    = dt.table_type;
            foreach (var data in mdi.Item)
            {
                data.table_comment = string.Empty;
                data.table_name    = string.Empty;
                data.table_type    = string.Empty;
            }
            var xml = IDesignFramework.GetCurrentXmlTemplate();
            var ci  = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName);

            if (null == ci)
            {
                Wrapper.ShowDialog("找不着控件信息。");
                return(false);
            }
            ci.MetaData   = ci.MetaData.IsNullOrEmpty() ? _TableName : ci.MetaData;
            ci.ColumnName = ci.ColumnName.IsNullOrEmpty() ? _SaveField : ci.ColumnName;

            ci.ControlDataSourceTableName = mdi.table_name;
            //-->判断tableName是否已经增加了
            MetaDataInfo old_mdi = IDesignFramework.GetMetaDataInfoByTableName(mdi.table_name);

            if (null == old_mdi)
            {
                xml.MetaDataItem.Add(mdi);
            }
            else
            {
                //-->判断列是否已经存在。
                foreach (var column in mdi.Item)
                {
                    var col = old_mdi.Item.Where(p => p.column_name.Equals(column.column_name)).GetFirst <MetaDataColumnInfo>();
                    if (null != col)
                    {
                        old_mdi.Item.Remove(col);
                    }
                    old_mdi.Item.Add(column);
                }
            }
            IDesignFramework.UpdateCurrentTemplate();
            return(true);
        }
Пример #3
0
        /// <summary>
        /// 保存
        /// </summary>
        bool SaveOperator()
        {
            if (null == lb_Controls1Function.SelectedItem)
            {
                Wrapper.ShowDialog("方法名称1没有选择");
                return(false);
            }

            CtrlFuctionInfo cfi         = (lb_Controls1Function.SelectedItem as ListBoxItem).Tag as CtrlFuctionInfo;
            string          eventName   = string.Format("{0}", cfi.Name);
            string          controlName = string.Format("{0}", (lb_Controls1.SelectedItem as ListBoxItem).Content);

            var xml = IDesignFramework.GetCurrentXmlTemplate();

            if (null == xml.EventLinkItem)
            {
                xml.EventLinkItem = new List <EventLinkInfo>();
            }
            string _controlName = _GetControlName();
            //-->事件
            var eli = xml.EventLinkItem.Where(p => p.ControlName == _controlName && p.EventName == EventName).GetFirst <EventLinkInfo>();

            if (null == eli)
            {
                eli = new EventLinkInfo();
                xml.EventLinkItem.Add(eli);
            }
            eli.ControlName = _controlName;
            eli.EventName   = this.EventName;
            eli.Item        = new List <ControlActivityInfo>();
            //-->行为
            var cai = eli.Item.Where(p => p.ControlName.Equals(controlName) && p.EventName.Equals(eventName)).GetFirst <ControlActivityInfo>();

            if (null == cai)
            {
                cai = new ControlActivityInfo();
                eli.Item.Add(cai);
            }
            //-->保存操作。
            cai.ActivityName = this.ActivityName;
            cai.ActivityType = this.ActivityType;
            cai.ControlName  = controlName;
            cai.EventName    = eventName;
            cai.Description  = cfi.Description;
            cai.Param        = new List <ParamInfo>();
            foreach (var v in this.sp_Children.Children)
            {
                ParameterSelected select = v as ParameterSelected;
                if (null == select || null == select.ParamForamt)
                {
                    continue;
                }
                cai.Param.Add(select.ParamForamt);
            }
            IDesignFramework.UpdateCurrentTemplate();
            return(true);
        }
Пример #4
0
        /// <summary>
        /// 弹出窗体
        /// </summary>
        /// <returns></returns>
        public bool CheckSave()
        {
            if (_PageGuid.IsNullOrEmpty())
            {
                Wrapper.ShowDialog("请选择要弹出的页面");
                return(false);
            }
            //-->判断是否是当前的页面?
            if (this.IDesignFramework.GetCurrentXmlTemplate().BaseInfo.PageGUID.Equals(_PageGuid))
            {
                Wrapper.ShowDialog("不能弹出当前页面,请选择其它弹出页面。");
                return(false);
            }

            string eventName    = string.Format("{0}", CurrentApiSelector.Name);
            string _controlName = string.Format("{0}", this.EventControlName);
            var    xml          = IDesignFramework.GetCurrentXmlTemplate();

            if (null == xml.EventLinkItem)
            {
                xml.EventLinkItem = new List <EventLinkInfo>();
            }
            //-->事件
            var eli = xml.EventLinkItem.Where(p => p.ControlName == _controlName && p.EventName == EventName).GetFirst <EventLinkInfo>();

            if (null == eli)
            {
                eli = new EventLinkInfo();
                xml.EventLinkItem.Add(eli);
            }
            eli.ControlName = _controlName;
            eli.EventName   = this.EventName;
            if (null == eli.Item)
            {
                eli.Item = new List <ControlActivityInfo>();
            }
            //-->行为
            var cai = eli.Item.Where(p => p.ControlName.Equals(_controlName) && p.EventName.Equals(eventName)).GetFirst <ControlActivityInfo>();

            if (null == cai)
            {
                cai = new ControlActivityInfo();
                eli.Item.Add(cai);
            }
            //-->保存操作。
            cai.ActivityName = this.ActivityName;
            cai.ActivityType = this.ActivityType;
            cai.ControlName  = _controlName;
            cai.EventName    = eventName;
            cai.Description  = "弹出窗体" + _PageGuid;
            cai.PageGuid     = _PageGuid;
            //-->参数,初始化弹出窗体的时候,要有参数

            IDesignFramework.UpdateCurrentTemplate();
            return(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool CheckSave()
        {
            string eventName    = string.Format("{0}", CurrentApiSelector.Name);
            string _controlName = string.Format("{0}", this.EventControlName);
            var    xml          = IDesignFramework.GetCurrentXmlTemplate();

            if (null == xml.EventLinkItem)
            {
                xml.EventLinkItem = new List <EventLinkInfo>();
            }
            //-->事件
            var eli = xml.EventLinkItem.Where(p => p.ControlName == _controlName && p.EventName == EventName).GetFirst <EventLinkInfo>();

            if (null == eli)
            {
                eli = new EventLinkInfo();
                xml.EventLinkItem.Add(eli);
            }
            eli.ControlName = _controlName;
            eli.EventName   = this.EventName;
            if (null == eli.Item)
            {
                eli.Item = new List <ControlActivityInfo>();
            }
            //-->行为
            var cai = eli.Item.Where(p => p.ControlName.Equals(_controlName) && p.EventName.Equals(eventName)).GetFirst <ControlActivityInfo>();

            if (null == cai)
            {
                cai = new ControlActivityInfo();
                eli.Item.Add(cai);
            }
            //-->保存操作。
            cai.ActivityName = this.ActivityName;
            cai.ActivityType = this.ActivityType;
            cai.ControlName  = _controlName;
            cai.EventName    = eventName;
            var _guid = this.IDesignFramework.GetCurrentXmlTemplate().BaseInfo.PageGUID;

            cai.Description = "关闭窗体" + _guid;
            cai.PageGuid    = _guid;
            //-->参数,初始化弹出窗体的时候,要有参数

            IDesignFramework.UpdateCurrentTemplate();
            return(true);
        }
        void UpdateDesignPage()
        {
            string eventName   = string.Format("{0}", CurrentApiSelector.Name);
            string controlName = string.Format("{0}", this.EventControlName);

            //-->保存操作。
            _CurrentActivityInfo.ActivityName = this.ActivityName;
            _CurrentActivityInfo.ActivityType = this.ActivityType;
            _CurrentActivityInfo.ControlName  = controlName;
            _CurrentActivityInfo.EventName    = eventName;
            _CurrentActivityInfo.Description  = CurrentApiSelector.Description;
            _CurrentActivityInfo.Param        = new List <ParamInfo>();
            foreach (var v in _DictResult)
            {
                string[]  arrayItem = v.Key.Split('|');
                ParamInfo pi        = new ParamInfo();
                pi.TargetCtrlName  = arrayItem[0];
                pi.TargetFieldName = arrayItem[1];
                pi.TargetFieldType = v.Value;

                _CurrentActivityInfo.Param.Add(pi);
            }
            if (0 <= _CurrentActivityInfoIndex)
            {
                _CurrentControlEventInfo.Item.RemoveAt(_CurrentActivityInfoIndex);
            }
            else
            {
                _CurrentActivityInfoIndex = 0;
            }
            _CurrentControlEventInfo.Item.Add(_CurrentActivityInfo);
            if (0 <= _CurrentControlEventIndex)
            {
                _XmlTemplate_Source.EventLinkItem.RemoveAt(_CurrentControlEventIndex);
            }
            else
            {
                _CurrentActivityInfoIndex = 0;
            }
            _XmlTemplate_Source.EventLinkItem.Add(_CurrentControlEventInfo);

            IDesignFramework.GetCurrentXmlTemplate().EventLinkItem = _XmlTemplate_Source.EventLinkItem;
            IDesignFramework.UpdateCurrentTemplate();
        }
Пример #7
0
        void UpdateDesignPage()
        {
            string eventName   = string.Format("{0}", CurrentApiSelector.Name);
            string controlName = string.Format("{0}", ct.SelectedControlInfo.Name);

            //-->保存操作。
            _CurrentActivityInfo.ActivityName = this.ActivityName;
            _CurrentActivityInfo.ActivityType = this.ActivityType;
            _CurrentActivityInfo.ControlName  = controlName;
            _CurrentActivityInfo.EventName    = eventName;
            _CurrentActivityInfo.Description  = CurrentApiSelector.Description;
            _CurrentActivityInfo.Param        = new List <ParamInfo>();
            foreach (var v in this.sp_Children.Children)
            {
                ParameterSelected select = v as ParameterSelected;
                if (null == select || null == select.ParamForamt)
                {
                    continue;
                }
                _CurrentActivityInfo.Param.Add(select.ParamForamt);
            }
            if (0 <= _CurrentActivityInfoIndex)
            {
                _CurrentControlEventInfo.Item.RemoveAt(_CurrentActivityInfoIndex);
            }
            else
            {
                _CurrentActivityInfoIndex = 0;
            }
            _CurrentControlEventInfo.Item.Add(_CurrentActivityInfo);
            if (0 <= _CurrentControlEventIndex)
            {
                _XmlTemplate.EventLinkItem.RemoveAt(_CurrentControlEventIndex);
            }
            else
            {
                _CurrentControlEventIndex = 0;
            }
            _XmlTemplate.EventLinkItem.Add(_CurrentControlEventInfo);

            IDesignFramework.GetCurrentXmlTemplate().EventLinkItem = _XmlTemplate.EventLinkItem;
            IDesignFramework.UpdateCurrentTemplate();
        }
        /// <summary>
        /// 查检是否保存
        /// </summary>
        public bool CheckSave()
        {
            if (null == _CurrentDataTable)
            {
                Wrapper.ShowDialog("请选择绑定的表。");
                return(false);
            }
            //-->给控件属性赋值
            //-->判断是否选择了。如果没有选择的话,就不要这条记录
            var dt = _CurrentDataTable[0];
            //-->xml 控件信息设置
            var xml = IDesignFramework.GetCurrentXmlTemplate();
            var ci  = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName);

            if (null != ci)
            {
                ci.MetaData   = dt.table_name;
                ci.ColumnName = string.Join("|", from p in _CurrentDataTable
                                            where p.IsChoose == true
                                            select p.column_name);
                //ci.ControlDataSourceTableName = dt.table_name;
            }
            //-->xaml  控件属性
            var columns = from p in _CurrentDataTable
                          where p.IsChoose == true
                          select string.Format("{0}{1}{2}{1}{4}",
                                               p.column_comment, ConstantCollection.Separator_Wavy_line,
                                               p.column_name, ConstantCollection.Separator_Wavy_line,
                                               p.data_type);

            string fields = string.Join(",", columns);
            string result = string.Format("{0}{1}{2}", dt.table_name, ConstantCollection.Separator_Sub_section_number, fields);

            //foreach (var data in _CurrentDataTable)
            //{
            //    data.IsChoose = false;
            //    data.IsHide = false;
            //}
            AddTableToXml(xml, _CurrentDataTable);
            IDesignFramework.UpdateCurrentTemplate();
            _EvaluationContent = new XElement("DataSource", result);
            return(true);
        }
        /// <summary>
        /// 增加控件绑定事件
        /// </summary>
        void AddCtrlBindEvent(XmlTemplate xml)
        {
            var _cc = ParseControlConfig.GetControlConfig(CurrentSelectedSetEventControl.GetType().Name);
            var _be = _cc.Events.Where(p => p.Name.Equals(this.EventName)).GetFirst <BindEvent>();

            EventBindInfo _ebi = new EventBindInfo();

            _ebi.ControlName = this.EventControlName;
            _ebi.Item        = new List <CtrlBindEventInfo>();

            CtrlBindEventInfo _cbei = new CtrlBindEventInfo();

            _cbei.EventName        = this.EventName;
            _cbei.AssemblyName     = _be.AssemblyName;
            _cbei.BindFunctionName = _be.BindFunctionName;
            _ebi.Item.Add(_cbei);

            xml.EventBindItem.Add(_ebi);
            IDesignFramework.UpdateCurrentTemplate();
        }
Пример #10
0
        void tv_MetaData_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            var tv     = sender as TreeView;
            var item   = tv.SelectedItem as TreeViewItem;
            var column = item.Tag as MetaDataColumnInfo;

            if (null == column)
            {
                Wrapper.ShowDialog("请选择一张表的字段。");
                return;
            }

            var ci = IDesignFramework.GetControlInfoByControlName(CurrentSelectedControlName);

            ci.ColumnName = column.column_name;
            ci.Comment    = column.column_comment;
            ci.MetaData   = ((tv.GetParentItem(tv.SelectedItem) as TreeViewItem).Tag as MetaDataInfo).table_name;

            EvaluationContent = new XElement("DataSource", string.Format("{0}|{1}|{2}", ci.MetaData, ci.ColumnName, ci.Comment));
            IDesignFramework.UpdateCurrentTemplate();
        }
        bool UpdateXml()
        {
            if (null == metadata_username)
            {
                Wrapper.ShowDialog("请选择要关联的用户名字段!");
                return(false);
            }
            if (null == metadata_password)
            {
                Wrapper.ShowDialog("请选择要关联的密码字段!");
                return(false);
            }

            var fields = xtnTableField.Fields;

            if (null == fields || 0 == fields.Count)
            {
                Wrapper.ShowDialog("字符参数为空");
                return(false);
            }
            var dt  = fields[0];
            var mdi = new MetaDataInfo();

            //-->克隆出数据。
            mdi.Item          = fields.CloneList <MetaDataColumnInfo>();
            mdi.table_comment = dt.table_comment;
            mdi.table_name    = dt.table_name;
            mdi.table_type    = dt.table_type;
            foreach (var data in mdi.Item)
            {
                data.table_comment = string.Empty;
                data.table_name    = string.Empty;
                data.table_type    = string.Empty;
            }
            var xml = IDesignFramework.GetCurrentXmlTemplate();
            var ci  = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName);

            if (null == ci)
            {
                Wrapper.ShowDialog("找不着控件信息。");
                return(false);
            }

            ci.MetaData   = ci.MetaData.IsNullOrEmpty() ? _TableName : ci.MetaData;
            ci.ColumnName = string.Format("{0}|{1}", _UserField, _PasswordField);

            ci.ControlDataSourceTableName = mdi.table_name;
            //-->判断tableName是否已经增加了
            var old_mdi = IDesignFramework.GetMetaDataInfoByTableName(mdi.table_name);

            if (null == old_mdi)
            {
                xml.MetaDataItem.Add(mdi);
            }
            IDesignFramework.UpdateCurrentTemplate();

            string value = string.Format("{0}|{1}|{2}", this.xtnTableField.TableName, _UserField, _PasswordField);

            _EvaluationContent = new XElement("DataAssociated", value);

            return(true);
        }