Ejemplo n.º 1
0
        private static void OnSelectedPathChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FileFolderEntryBox box = (FileFolderEntryBox)d;

            if (box.updating)
            {
                return;
            }
            using (IDLWrapper newIDL = new IDLWrapper((string)e.NewValue)) {
                IEnumerable <byte> eidl = box.SelectedIDL;
                if (eidl == null)
                {
                    box.updating = true;
                }
                else
                {
                    using (IDLWrapper oldIDL = new IDLWrapper(eidl as byte[] ?? eidl.ToArray())) {
                        // Don't change the IDL if current one has the same path.
                        box.updating = (oldIDL.Path != newIDL.Path);
                    }
                }

                if (box.updating)
                {
                    box.SelectedIDL = newIDL.IDL;
                    box.updating    = false;
                }
            }
            box.Update();
        }
Ejemplo n.º 2
0
        private static void OnSelectedIDLChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FileFolderEntryBox box = (FileFolderEntryBox)d;

            if (box.updating)
            {
                return;
            }
            string newPath = "";

            if (box.SelectedIDL != null)
            {
                IEnumerable <byte> eidl = (IEnumerable <byte>)e.NewValue;
                using (IDLWrapper wrapper = new IDLWrapper(eidl as byte[] ?? eidl.ToArray())) {
                    newPath = wrapper.Path;
                }
            }

            box.updating     = true;
            box.SelectedPath = newPath;
            box.updating     = false;
            box.Update();
        }