Exemplo n.º 1
0
        //[CanBeNull]
        //private IWorkListObserver GetObserverByWorklistName(string name)
        //{

        //}

        public void ShowView([NotNull] string uniqueName)
        {
            IWorkList list = _registry.Get(uniqueName);

            foreach (IWorkListObserver observer in _observers)
            {
                observer.Show(list);
            }
        }
Exemplo n.º 2
0
        public string ShowWorklist([NotNull] WorkEnvironmentBase environment, [NotNull] string path)
        {
            Assert.ArgumentNotNull(environment, nameof(environment));
            Assert.ArgumentNotNullOrEmpty(path, nameof(path));

            IWorkList worklist;

            string name = WorkListUtils.GetName(path).ToLower();

            if (_registry.Exists(name))
            {
                worklist = _registry.Get(name);
            }
            else
            {
                var factory = new XmlBasedWorkListFactory(path, name);

                if (_registry.TryAdd(factory))
                {
                    _msg.Debug($"Add work list {name} from file {path}");
                }

                worklist = _registry.Get(name);
            }

            Assert.NotNull(worklist);

            if (!_viewsByWorklistName.ContainsKey(worklist.Name))
            {
                var item = ProjectItemUtils.Get <WorklistItem>(Path.GetFileName(path));

                if (item == null)
                {
                    Assert.True(ProjectItemUtils.TryAdd(path, out item), $"Cannot add item {path}");
                    Assert.NotNull(item);
                }

                _viewsByWorklistName.Add(worklist.Name, new WorkListObserver(worklist, item));

                Uri uri = WorkListUtils.GetDatasource(GetProject().HomeFolderPath, name,
                                                      environment.FileSuffix);
                FeatureLayer layer = AddLayer(uri, name, item.Name);

                // use item name as layer name (and as view display name as well)
                LayerUtils.ApplyRenderer(layer, environment.GetLayerDocument());
            }

            return(Assert.NotNullOrEmpty(worklist.Name));
        }