Exemplo n.º 1
0
        public CustomPanelInstanceData CreateObjectPanel(CustomPanelType type, IObjectContainer container)
        {
            PanelState state;

            if (!m_panelStates.TryGetValue(type, out state))
            {
                state = new PanelState();
                m_panelStates[type] = state;
            }
            var createdCount = state.CreatedPanels.Where(p => Object.ReferenceEquals(p.BoundObjectContainer, container)).Count();

            if (createdCount == 0 || type.AllowMultipleInstances)
            {
                var panel = new CustomPanelInstanceData(type, container);
                if (panel != null)
                {
                    state.CreatedPanels.Add(panel);
                    panel.Disposed += Panel_Disposed;
                }
                return(panel);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public CustomPanelInstanceData CreateObjectPanel(CustomPanelType type, string objectReference)
        {
            var foundObject = m_dynamicObjectManager.TryFindObject(objectReference);

            if (foundObject == null)
            {
                PanelState state;
                if (!m_panelStates.TryGetValue(type, out state))
                {
                    state = new PanelState();
                    m_panelStates[type] = state;
                }

                var createdCount = state.CreatedPanels.Where(p => p.TargetObjectReference.Equals(objectReference)).Count();
                if (createdCount == 0 || type.AllowMultipleInstances)
                {
                    var panel = new CustomPanelInstanceData(type);
                    panel.SetObjectReference(objectReference);      // Who's resolving this, then?
                    if (panel != null)
                    {
                        state.CreatedPanels.Add(panel);
                        panel.Disposed += Panel_Disposed;
                    }
                    return(panel);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(CreateObjectPanel(type, foundObject));
            }
        }
Exemplo n.º 3
0
 public PanelCreationOption GetPanelCreationOption(CustomPanelType type, object @object = null)
 {
     return(PanelCreationOption.Possible);
 }
Exemplo n.º 4
0
 public CustomPanelInstanceData CreateStaticPanel(CustomPanelType type)
 {
     throw new NotImplementedException();
 }
 internal CustomPanelInstanceData(CustomPanelType type, IObjectContainer container)
 {
     m_type            = type;
     m_objectContainer = container;
     m_state           = (container.Object != null) ? CustomPanelBindingState.Bound : CustomPanelBindingState.BoundWithoutObject;
 }
 internal CustomPanelInstanceData(CustomPanelType type, string target)
 {
     m_type         = type;
     m_targetObject = target;
     m_state        = CustomPanelBindingState.BoundWithoutObject;
 }
 internal CustomPanelInstanceData(CustomPanelType type)
 {
     m_type  = type;
     m_state = type.IsObjectPanel ? CustomPanelBindingState.NotBound : CustomPanelBindingState.NotBindable;
 }