예제 #1
0
        public void UpdateBindings()
        {
            ViewModels = ViewModelProvider.Viewmodels;

            if (_srcView != null)
            {
                var props = _srcView.GetType().GetProperties(/*BindingFlags.DeclaredOnly |*/ BindingFlags.Instance | BindingFlags.Public);

                SrcEvents = props
                            .Where(p => p.PropertyType.IsSubclassOf(typeof(UnityEventBase)) &&
                                   !p.GetCustomAttributes(typeof(ObsoleteAttribute), true).Any())
                            .Select(p => p.Name).ToList();

                if (!string.IsNullOrEmpty(SrcEventName))
                {
                    _srcEventProp = _srcView.GetType().GetProperty(SrcEventName);
                }
            }

            if (!string.IsNullOrEmpty(ViewModelName))
            {
                var methods = ViewModelProvider.GetViewModelMethods(ViewModelName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);

                DstMethods = methods.Where(m => !m.IsSpecialName && !m.GetCustomAttributes(typeof(ObsoleteAttribute), true).Any()).Select(e => e.Name).ToList();;
            }


            if (!string.IsNullOrEmpty(DstMethodName))
            {
                _method = ViewModelProvider.GetViewModelType(ViewModelName).GetMethod(DstMethodName);
            }
        }