コード例 #1
0
        /// <summary>
        /// 标记出有警告的行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridViewEvent_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            foreach (DataGridViewRow dr in this.dataGridViewEvent.Rows)
            {
                //dr有可能为null?忘记为什么要判断了
                if (dr != null)
                {
                    IWarningable warningable = dr.DataBoundItem as IWarningable;
                    if (warningable == null)
                    {
                        continue;
                    }

                    //检查警告
                    warningable.CheckWarning();

                    if (warningable.Warning.ExistWarning)
                    {
                        dr.DefaultCellStyle.BackColor          = UIHelper.DataGridViewRowBackColorWarning;
                        dr.DefaultCellStyle.SelectionBackColor = UIHelper.DataGridViewSelectedRowBackColorWarning;
                        dr.DefaultCellStyle.ForeColor          = UIHelper.DataGridViewRowForeColorWarning;
                        dr.DefaultCellStyle.SelectionForeColor = UIHelper.DataGridViewSelectedRowForeColorWarning;
                    }
                    else
                    {
                        dr.DefaultCellStyle.BackColor          = UIHelper.DataGridViewRowBackColorNormal;
                        dr.DefaultCellStyle.SelectionBackColor = UIHelper.DataGridViewSelectedRowBackColorNormal;
                        dr.DefaultCellStyle.ForeColor          = UIHelper.DataGridViewRowForeColorNormal;
                        dr.DefaultCellStyle.SelectionForeColor = UIHelper.DataGridViewSelectedRowForeColorNormal;
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 从当前事件对象中提取IEventEditorSupport接口
        /// 然后取出编辑面板节点加到树中
        /// </summary>
        private void CreateEventEditorSupport()
        {
            this._eventEditorSupport = this.Event as IEventEditorSupport;

            this._eventEditorSupport.EditorAdapter.EventCollection = this.EventList;

            this.treeViewParameter.Nodes.Clear();

            #region 如果有警告,显示警告信息

            ////如果有警告,显示警告信息
            IWarningable warningable = this.Event as IWarningable;
            if (warningable != null)
            {
                if (warningable.Warning.ExistWarning)
                {
                    UserControlWarningView warningView = new UserControlWarningView();
                    warningView.ShowWarning(warningable.Warning);

                    TreeNode warningNode = this.treeViewParameter.AddNode(
                        String.Format(Language.Current.FormEventEditor_WarningNode, warningable.Warning.WarningCount), warningView);
                    warningNode.ImageIndex         = EditorTreeNodeIcons.Warning;
                    warningNode.SelectedImageIndex = EditorTreeNodeIcons.Warning;
                }
            }

            #endregion

            this.AddParameterTreeNode(_eventEditorSupport.EditorAdapter.EditorNode);

            this.treeViewParameter.ExpandAll();
            this.treeViewParameter.SelectedNode = GetTreeNode(_eventEditorSupport.EditorAdapter.DefaultNode);
        }
コード例 #3
0
 public static void CheckWarning(FormElementDataListEntityDev entity)
 {
     entity.Warning.Clear();
     if (String.IsNullOrEmpty(entity.DataEntityId) == false)
     {
         DataEntity dataEntity = _dataEntityComponentService.GetDataEntity(entity.DataEntityId);
         if (dataEntity == null)
         {
             entity.Warning.AddWarningSign(entity, Language.Current.EntityDev_FormElementDataListEntityDev_DataEntityNotExist);
         }
     }
     foreach (UIElementDataListColumnEntityAbstract dc in entity.DataColumns)
     {
         IWarningable columnWarning = dc as IWarningable;
         if (columnWarning == null)
         {
             continue;
         }
         columnWarning.CheckWarning();
         if (columnWarning.Warning.ExistWarning)
         {
             entity.Warning.AddWarningSign(columnWarning.Warning);
         }
     }
     WarningCheckerHelper.EventsValidate(entity);
 }
コード例 #4
0
        public static DataTable GetDataTable(EventCollection list, EntityBase entity)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Id");
            dt.Columns.Add("Event");
            dt.Columns.Add("EventTime");
            dt.Columns.Add("EventTimeName");
            dt.Columns.Add("Name");
            dt.Columns.Add("Code");
            dt.Columns.Add("Warning", typeof(bool));
            if (list == null)
            {
                return(dt);
            }
            DataRow dr;

            foreach (EventBase even in list)
            {
                dr                  = dt.NewRow();
                dr["Id"]            = even.Id;
                dr["Event"]         = EventDevTypes.Instance.GetName(even);
                dr["EventTime"]     = even.EventTime;
                dr["EventTimeName"] = (entity as IEventSupport).GetEventTimeName(even.EventTime);
                dr["Name"]          = even.Name;
                dr["Code"]          = even.Code;
                IWarningable warningable = even as IWarningable;
                if (warningable != null)
                {
                    dr["Warning"] = warningable.Warning.ExistWarning;
                }
                dt.Rows.Add(dr);
            }
            return(dt);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity">实体对象,将从此对象中提取其所支持的事件</param>
        /// <param name="eventBase">要编辑的事件</param>
        public FormEventEditor(EntityBase hostEntity, EventBase eventBase)
        {
            InitializeComponent();

            Unity.ApplyResource(this);
            ApplyLanguageResource();

            availableEvents.DisplayMember     = EventProvideAttribute.Property_Name;
            availableEvents.DescriptionMember = EventProvideAttribute.Property_Description;

            availableEventTimes.DisplayMember = EventTimeAbstract.Property_Name;
            availableEventTimes.LayoutMode    = ListViewLayoutMode.Standard;

            //初始化imageList
            //如果修改这里,注意修改 EditorTreeNodeIcons
            this.imageListParameter.Images.Add(IconsLibrary.EmptyIcon);
            this.imageListParameter.Images.Add(IconsLibrary.Property);
            this.imageListParameter.Images.Add(IconsLibrary.Right);
            this.imageListParameter.Images.Add(IconsLibrary.Method);
            this.imageListParameter.Images.Add(IconsLibrary.Error2);

            this._entity = hostEntity;
            this.Event   = eventBase;

            //CheckWarning
            if (this.Event != null)
            {
                IWarningable warningable = this.Event as IWarningable;
                if (warningable != null)
                {
                    warningable.CheckWarning();
                }
            }
        }
コード例 #6
0
        public void AddWarningSign(IWarningable target, string message)
        {
            WarningSign warningSign = new WarningSign(target)
            {
                Message = message
            };

            _warnings.Add(warningSign);
        }
コード例 #7
0
        /// <summary>
        /// 对FormEntity 进行CheckWarning,并将警告数量显示在警告按钮上
        /// </summary>
        public void CheckWarning()
        {
            //this.FormEntity.CheckWarning();
            IWarningable warningable = this.WindowEntity as IWarningable;

            if (warningable != null)
            {
                warningable.CheckWarning();
            }
        }
コード例 #8
0
        public static void CheckWarning(CallUIElementMethodDev entity)
        {
            entity.Warning.Clear();
            IWarningable callEventWarningable = entity.CallEvent as IWarningable;

            if (callEventWarningable != null)
            {
                callEventWarningable.CheckWarning();
                if (callEventWarningable.Warning.ExistWarning)
                {
                    entity.Warning.AddWarningSign(callEventWarningable.Warning.Warnings);
                }
            }
        }
コード例 #9
0
        private void Edit()
        {
            if (dataGridViewEvent.SelectedRows.Count != 1)
            {
                return;
            }

            EventBase even  = this.dataGridViewEvent.SelectedRows[0].DataBoundItem as EventBase;
            int       index = this.EventList.IndexOf(even);

            //保持当前事件对象的副本,用于在编辑事件之后,进行Compare提取差异
            EventBase oldEvent = even.Clone() as EventBase;

            //FormEventEditor.Event编辑后还是原对象的引用,在原对象基础上修改的
            FormEventEditor formEventSet = new FormEventEditor(this._hostEntity, even);

            //这里暂时还能用using,因为窗体释放时,会把事件的编辑面板也释放掉,要另外处理这个问题
            //using (FormEventEditor formEventSet = new FormEventEditor(this._entity, even))
            //{
            formEventSet.FormEntity = this.FormEntity;
            formEventSet.EventList  = this.EventList;

            if (formEventSet.ShowDialog() == DialogResult.OK)
            {
                //CheckWarning
                IWarningable warningable = formEventSet.Event as IWarningable;
                if (warningable != null)
                {
                    warningable.CheckWarning();
                }

                _eventBindingList.ResetItem(index);

                EventUpdate();

                if (this.OnEdited != null)
                {
                    CollectionEditEventArgs args = new CollectionEditEventArgs(this.EventList,
                                                                               CollectionEditType.Edit, index, formEventSet.Event);
                    args.Members.Inject(ObjectCompare.Compare(oldEvent, formEventSet.Event));
                    OnEdited(this, args);
                }
            }
            //}
        }
コード例 #10
0
 public static void CheckWarning(FormEntityDev entity)
 {
     entity.Warning.Clear();
     foreach (UIElement element in entity.Elements)
     {
         IWarningable elementWarning = element as IWarningable;
         if (elementWarning == null)
         {
             continue;
         }
         elementWarning.CheckWarning();
         if (elementWarning.Warning.ExistWarning)
         {
             entity.Warning.AddWarningSign(elementWarning.Warning);
         }
     }
     WarningCheckerHelper.EventsValidate(entity);
 }
コード例 #11
0
        public static void EventsValidate(IWarningable entity)
        {
            IEventSupport eventSupport = entity as IEventSupport;

            if (eventSupport != null)
            {
                foreach (EventBase _event in eventSupport.Events)
                {
                    IWarningable eventWarning = _event as IWarningable;
                    if (eventWarning == null)
                    {
                        continue;
                    }
                    eventWarning.CheckWarning();
                    if (eventWarning.Warning.ExistWarning)
                    {
                        entity.Warning.AddWarningSign(eventWarning.Warning);
                    }
                }
            }
        }
コード例 #12
0
 public WarningSign(IWarningable host)
 {
     _host = host;
 }
コード例 #13
0
 public static void CheckEventWarning(IWarningable entity)
 {
 }