public ObjectProperties(object obj, bool readOnly, Action action)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            DataContext = obj;
            InitializeComponent();
            if (action != null)
            {
                Loaded += (sender, e) => OnLoaded(action);
            }
            Title = obj + " Properties";
            if (obj != null)
            {
                var roa = AssemblyUtilities.GetAttribute <ReadOnlyAttribute>(obj.GetType());
                PGrid.IsReadOnly = roa != null && roa.IsReadOnly;
            }

            if (readOnly)
            {
                PGrid.IsReadOnly = true;
            }

            PGrid.SelectedObject = obj;
            if (PGrid.IsReadOnly)
            {
                Cancel.Content = "Close";
                OK.Visibility  = Visibility.Hidden;
            }
        }
Esempio n. 2
0
            public Asm(Assembly asm)
            {
                Name = asm.FullName;
                if (!AssemblyUtilities.IsDynamic(asm))
                {
                    try
                    {
                        Location = asm.Location;
                    }
                    catch
                    {
                        // do nothing
                    }
                }

                if (string.IsNullOrEmpty(Location))
                {
                    Location = " ";
                }
                AssemblyFileVersionAttribute vatt = AssemblyUtilities.GetAttribute <AssemblyFileVersionAttribute>(asm);

                if (vatt != null)
                {
                    Version = vatt.Version;
                }
                else
                {
                    AssemblyVersionAttribute att = AssemblyUtilities.GetAttribute <AssemblyVersionAttribute>(asm);
                    if (att != null)
                    {
                        Version = att.Version;
                    }
                }
                InformationalVersion = AssemblyUtilities.GetInformationalVersion(asm);
                if (string.IsNullOrEmpty(Version))
                {
                    Version = InformationalVersion;
                }
                CompileDate = AssemblyUtilities.GetLinkerTimestamp(asm);
            }