private async Task <CombinedBarcodeResponseItem> FormatTcEntryAsync(TopContainer container,
                                                                            ArchivesSpaceService activeService)
        {
            if (container == null)
            {
                return(new CombinedBarcodeResponseItem());
            }
            var location = await GetContainerLocationDisplayString(container, activeService);

            var resourceManager = new ArchivesSpaceResourceManager(activeService);

            var resource = await resourceManager.GetResourceByIdAsync(container.Collection.First().RefStrippedId);

            var hasSeries      = container.Series.Count > 0;
            var seriesDivision = hasSeries ? container.Series.First().Identifier.FormatSeriesDivision() : "";
            var seriesTitle    = hasSeries ? container.Series.First().DisplayString : "";
            var tcEntry        = new CombinedBarcodeResponseItem
            {
                Origin         = "ArchivesSpace",
                Author         = "",
                BoxNumber      = Helpers.FormatBoxText(container.Indicator),
                CallNumber     = Helpers.FormatCallNumber(container.Collection.First().Identifier),
                Location       = location,
                ResourceTitle  = container.Collection.First().DisplayString,
                ResourceId     = container.Collection.First().RefStrippedId,
                Handle         = resource.EadLocation, //This seems to be null pretty often even if EadId (not a URL) is not
                Restriction    = (container.Restricted ? "Y" : "N"),
                SeriesDivision = seriesDivision,
                SeriesTitle    = seriesTitle
            };

            return(tcEntry);
        }
 public static string GetCallNumberFromTopContainer(TopContainer container)
 {
     if (container == null || container.Collection.Count < 1)
     {
         return("");
     }
     return(FormatCallNumber(container.Collection.First().Identifier));
 }
Пример #3
0
 /// <summary>Creates nested tags and renders them into text writer</summary>
 /// <param name="viewModel">View model required for tag creation</param>
 /// <param name="writer">Destionation of rendering</param>
 public virtual void Render(TViewModel viewModel, TextWriter writer)
 {
     FireOnPreRender();
     CreateTags(viewModel);
     RenderDocType(CurrentDoctype, writer);
     TopContainer.Render(writer, IncludeIndents);
     FireOnPostRender();
 }
Пример #4
0
        private async Task <string> GetContainerLocationDisplayString(TopContainer container, ArchivesSpaceService activeService)
        {
            if (container == null || container.ContainerLocations.Count < 1)
            {
                return("");
            }
            var locId    = container.ContainerLocations.First().RefStrippedId;
            var location = await activeService.GetLocationAsync(locId);

            return(location.Title);
        }
        private async Task <string> GetContainerProfileDisplayString(TopContainer container,
                                                                     ArchivesSpaceService activeService)
        {
            if (container.ContainerProfile == null)
            {
                return("");
            }
            var profileId = container.ContainerProfile.RefStrippedId;
            var profile   = await activeService.GetContainerProfileAsync(profileId);

            return(profile.Name); //preferred to display string due to brevity
        }
Пример #6
0
        public void CreateDefaultGui(MiyagiSystem GuiSystem)
        {
            gConsole         = new GameConsole();
            ctrlPanel        = new ControlPanel();
            cityPanel        = new CityInfoPanel();
            DebugPanel       = new DebugPanel();
            ContextMenu      = new ContextMenu();
            bcWindow         = new BuildingCreationWindow();
            topContainer     = new TopContainer();
            bldgPlacePanel   = new BuildingPlacementPanel();
            weatherInfo      = new WeatherInfoWindow();
            bldgSelectWindow = new BuildingSelectionWindow();

            GuiComponents.AddRange(new IGuiComponent[] { gConsole, topContainer, ctrlPanel, cityPanel, debugPanel, contextMenu, bcWindow, bldgPlacePanel, weatherInfo, bldgSelectWindow });

            Gui = new GUI();
            GuiSystem.GUIManager.GUIs.Add(Gui);

            this.InitGui(Gui);
        }
Пример #7
0
        private async Task <BarcodeResponseItem> FormatEntry(TopContainer container,
                                                             ArchivesSpaceService activeService)
        {
            if (container == null)
            {
                return(new BarcodeResponseItem());
            }
            var location = await GetContainerLocationDisplayString(container, activeService);

            var tcEntry = new BarcodeResponseItem
            {
                Author     = "",
                BoxNumber  = Helpers.FormatBoxText(container.Indicator),
                CallNumber = Helpers.FormatCallNumber(container.Collection.First().Identifier),
                Location   = location,
                Title      = container.Collection.First().DisplayString,
                ResourceId = container.Collection.First().RefStrippedId
            };

            return(tcEntry);
        }
Пример #8
0
        public ViewVariablesPropertyEditor SetProperty(ViewVariablesBlobMembers.MemberData member)
        {
            NameLabel.Text = member.Name;
            var type = Type.GetType(member.Type);

            _bottomLabel.Text = $"Type: {member.TypePretty}";
            ViewVariablesPropertyEditor editor;

            if (type == null)
            {
                // Type is server-side only.
                // Info whether it's reference or value type can be figured out from the sent value.
                if (member.Value is ViewVariablesBlobMembers.ServerValueTypeToken)
                {
                    // Value type, just display it stringified read-only.
                    editor = new ViewVariablesPropertyEditorDummy();
                }
                else
                {
                    // Has to be a reference type at this point.
                    DebugTools.Assert(member.Value is ViewVariablesBlobMembers.ReferenceToken || member.Value == null);
                    editor = _viewVariablesManager.PropertyFor(typeof(object));
                }
            }
            else
            {
                editor = _viewVariablesManager.PropertyFor(type);
            }

            var view = editor.Initialize(member.Value, !member.Editable);

            if (view.SizeFlagsHorizontal != SizeFlags.FillExpand)
            {
                NameLabel.SizeFlagsHorizontal = SizeFlags.FillExpand;
            }

            NameLabel.CustomMinimumSize = new Vector2(150, 0);
            TopContainer.AddChild(view);

            /*
             * _beingEdited = obj;
             * _editedProperty = propertyInfo;
             * DebugTools.Assert(propertyInfo.DeclaringType != null);
             * DebugTools.Assert(propertyInfo.DeclaringType.IsInstanceOfType(obj));
             *
             * var attr = propertyInfo.GetCustomAttribute<ViewVariablesAttribute>();
             * DebugTools.Assert(attr != null);
             * NameLabel.Text = propertyInfo.Name;
             *
             * _bottomLabel.Text = $"Type: {propertyInfo.PropertyType.FullName}";
             *
             * var editor = vvm.PropertyFor(propertyInfo.PropertyType);
             * var value = propertyInfo.GetValue(obj);
             *
             * var view = editor.Initialize(value, attr.Access != VVAccess.ReadWrite);
             * if (view.SizeFlagsHorizontal != SizeFlags.FillExpand)
             * {
             *  NameLabel.SizeFlagsHorizontal = SizeFlags.FillExpand;
             * }
             * NameLabel.CustomMinimumSize = new Vector2(150, 0);
             * TopContainer.AddChild(view);
             * editor.OnValueChanged += v => { propertyInfo.SetValue(obj, v); };
             */
            return(editor);
        }
Пример #9
0
        /**
         * <summary>   Makes the gameobject in the scene visible. Also affects the top-level-container. </summary>
         *
         * <seealso cref="M:TestMod.MUI.MComponent.Show()"/>
         **/

        public override void Show()
        {
            base.Show();
            TopContainer.Show();
        }