예제 #1
0
        private static object GetChildAtPath(IMBBindingList bindingList, BindingPath path)
        {
            BindingPath subPath = path.SubPath;

            if (subPath == (BindingPath)null)
            {
                return((object)bindingList);
            }
            if (bindingList.Count > 0)
            {
                int int32 = Convert.ToInt32(subPath.FirstNode);
                if (int32 >= 0 && int32 < bindingList.Count)
                {
                    object binding = bindingList[int32];
                    switch (binding)
                    {
                    case ViewModel _:
                        return((binding as ViewModel).GetViewModelAtPath(subPath));

                    case IMBBindingList _:
                        return(ViewModel.GetChildAtPath(binding as IMBBindingList, subPath));
                    }
                }
            }
            return((object)null);
        }
        public void DecrementIfRelatedWith(BindingPath path, int startIndex)
        {
            BindingPath referencePath = path;
            int         result;

            if (!this.IsRelatedWith(referencePath) || referencePath.Nodes.Length >= this.Nodes.Length || (!int.TryParse(this.Nodes[referencePath.Nodes.Length], out result) || result < startIndex))
            {
                return;
            }
            --result;
            this.Nodes[referencePath.Nodes.Length] = result.ToString();
        }
예제 #3
0
        public object GetViewModelAtPath(BindingPath path)
        {
            BindingPath subPath = path.SubPath;

            if (!(subPath != (BindingPath)null))
            {
                return((object)this);
            }
            PropertyInfo property = this.GetProperty(subPath.FirstNode);

            if (property != (PropertyInfo)null)
            {
                object obj = property.GetGetMethod().InvokeWithLog((object)this, (object[])null);
                switch (obj)
                {
                case ViewModel viewModel2:
                    return(viewModel2.GetViewModelAtPath(subPath));

                case IMBBindingList _:
                    return(ViewModel.GetChildAtPath(obj as IMBBindingList, subPath));
                }
            }
            return((object)null);
        }
 public BindingPath Append(BindingPath bindingPath) => new BindingPath(this.Nodes, bindingPath.Nodes);
 public bool IsRelatedWith(BindingPath referencePath) => BindingPath.IsRelatedWithPath(this.Path, referencePath);
 public static bool IsRelatedWithPath(string path, BindingPath referencePath) => referencePath.Path.StartsWith(path);
        public override bool Equals(object obj)
        {
            BindingPath bindingPath = obj as BindingPath;

            return(!(bindingPath == (BindingPath)null) && this.Path == bindingPath.Path);
        }
예제 #8
0
 public object GetViewModelAtPath(BindingPath path, bool isList) => this.GetViewModelAtPath(path);