コード例 #1
0
        /// <summary>
        /// Direct value field
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="storage"></param>
        /// <param name="value"></param>
        /// <param name="propertyName"></param>
        protected virtual void SetProperty <T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
        {
            // skip if not changed
            if (Equals(storage, value))
            {
                return;
            }

#if DEBUG_TRACE_LOG_ON
            MethodBase info = new StackFrame(3).GetMethod();
            _logger.Debug(string.Format("{0}.{1} -> {2}", info.DeclaringType?.Name, info.Name, propertyName));
#endif
            storage = value;
            OnPropertyChanged(propertyName, storage);
        }
コード例 #2
0
        protected void SetField <T>(ref FilterField <T> storage, object value, [CallerMemberName] string propertyName = null)
        {
            // skip if not changed
            if (storage.ValueEquals(value))
            {
                return;
            }

#if DEBUG_TRACE_LOG_ON
            MethodBase info = new StackFrame(3).GetMethod();
            _logger.Debug(string.Format("{0}.{1} -> {2}", info.DeclaringType.Name, info.Name, propertyName));
#endif

            storage.Value = (T)value;
            OnPropertyChanged(propertyName, storage);
        }
コード例 #3
0
        private void handle_bindingSource_CurrentObjectChanged(object sender, CurrentObjectChangedEventArgs e)
        {
#if DEBUG_TRACE_LOG_ON
            _logger.Debug(string.Format("Form support fire triggers at start"));
#endif

            IModelEntity me = e.Current as IModelEntity;

            if (ReferenceEquals(null, me))
            {
                return; // not correct object for execution
            }
            // check if there is trigger
            _triggers.AllTriggerLists().ForEach(
                l => l.ForEach(
                    o =>
            {
                //tt(o, me, e)
                object v = me.GetModelPropertyValueByName(o.FieldName);
                if (!ReferenceEquals(null, v))
                {
                    _actions[o.ActionType].ForEach(a => FireAction(
                                                       o,
                                                       a,
                                                       e.Current,
                                                       new ModelPropertyChangedEventArgs(
                                                           o.FieldName,
                                                           new ModelPropertyChangedEventArgs.PropertyChangedChainEntry()
                    {
                        Container    = e.Current,
                        PropertyName = o.FieldName,
                        Value        = v
                    }
                                                           )
                                                       ));
                }
            }
                    ));
        }
コード例 #4
0
        public void AttachToGrid(GridControl g)
        {
#if DEBUG_TRACE_LOG_ON
            _logger.Debug("Set-GRID : New");
#endif
            //first disconnect eventual old one
            if (_target != null)
            {
                _target.DataSourceChanged           -= GridDataSourceChanged;
                _target.CustomRowCellEditForEditing -= CustomRowCellEditForEditingHandler;
                _target.ShownEditor             -= EditorShownHandler;
                _target.CustomColumnDisplayText -= CustomColumnDisplayText;
                _target.ListSourceChanged       -= DataController_ListSourceChanged;
                _target.CellValueChanged        -= _target_CellValueChanged;
                _target.ValidatingEditor        -= _target_ValidatingEditor;
            }
            _target = new GridAdapter(g);
            _target.AutoPopulateColumns = true;
            _target.ListSourceChanged  += DataController_ListSourceChanged;
            _target.DataSourceChanged  += GridDataSourceChanged;
            _target.ValidatingEditor   += _target_ValidatingEditor;
            //connect
            _target.DataSource = this;
        }