Beispiel #1
0
        public void RegisterView(IExtension owner, View view)
        {
            if(owner==null)
                throw new ArgumentNullException(nameof(owner));
            if(view==null)
                throw new ArgumentNullException(nameof(view));
            if(_viewsByInternalName.ContainsKey(view.InternalName))
                throw new ArgumentException($"A View with name <{view.InternalName}> is already registered. Make sure Views have a unique name.");
            _viewsByInternalName.Add(view.InternalName,view);
            if (_viewsByExtension.ContainsKey(owner))
            {
                _viewsByExtension[owner].Add(view);
            }
            else
            {
                var views = new List<View> {view};
                _viewsByExtension.Add(owner, views);
            }

            ViewRegistered?.Invoke(this, new ViewRegisteredEventArgs(owner,view));
        }
 public DocumentViewControl(View v)
 {
     View = v;
     Title = v.Name;
     Content = v.Ui;
 }
 internal ViewRegisteredEventArgs(IExtension owner, View view)
 {
     Owner = owner;
     View = view;
 }