コード例 #1
0
        public void ShowView(Type viewType, ICviParameter parameter = null)
        {
            if (!viewType.IsTypeOf(typeof(ICvItem)))
            {
                return;
            }

            lock (m_activeChilds)
            {
                var _activeItems = GetActivesByType(viewType);
                var _activeItem  = _activeItems.FirstOrDefault();

                if (AllowSecondInst != null)
                {
                    if (_activeItems.Length > 0 && !AllowSecondInst(viewType, _activeItems.Length))
                    {
                        ViewActivate?.Invoke(_activeItem);
                        return;
                    }
                }

                var _lts = m_container.BeginLifetimeScope();
                {
                    _activeItem = _lts.Resolve(viewType) as ICvItem;

                    if (_activeItem == null)
                    {
                        return;
                    }

                    _activeItem.CviClosed = item =>
                    {
                        lock (m_activeChilds)
                        {
                            m_activeChilds.Remove(_activeItem);
                        }
                    };

                    m_activeChilds.Add(_activeItem);
                    ViewShow?.Invoke(_activeItem);
                }
            }
        }
コード例 #2
0
 public void ShowView <T>(ICviParameter parameter = null)
 {
     ShowView(typeof(T), parameter);
 }