예제 #1
0
        public bool CheckSourceMissing()
        {
            if (ResourceModel != null && _environment != null)
            {
                var    resourceModel = ResourceModel;
                string srcId;
                var    workflowXml = resourceModel?.WorkflowXaml;
                try
                {
                    var xe = workflowXml?.Replace("&", "&").ToXElement();
                    srcId = xe?.AttributeSafe("SourceID");
                }
                catch (XmlException xe)
                {
                    Dev2Logger.Error(xe);
                    srcId = workflowXml.ExtractXmlAttributeFromUnsafeXml("SourceID=\"");
                }

                Guid sourceId;
                if (Guid.TryParse(srcId, out sourceId))
                {
                    SourceId = sourceId;
                    var sourceResource = _environment.ResourceRepository.LoadContextualResourceModel(sourceId);
                    if (sourceResource == null)
                    {
                        ValidationMemoManager.UpdateLastValidationMemoWithSourceNotFoundError();
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #2
0
        void UpdateDesignerAfterResourceLoad(IServerRepository serverRepository)
        {
            if (!IsDeleted)
            {
                MappingManager.InitializeMappings();
                ValidationMemoManager.InitializeLastValidationMemo(_environment);
                if (IsItemDragged.Instance.IsDragged)
                {
                    Expand();
                    IsItemDragged.Instance.IsDragged = false;
                }
            }
            var environmentModel = serverRepository.Get(EnvironmentID);

            if (EnvironmentID == Guid.Empty)
            {
                environmentModel = serverRepository.ActiveServer;
            }
            if (environmentModel?.Connection?.WebServerUri != null)
            {
                var servUri = new Uri(environmentModel.Connection.WebServerUri.ToString());
                var host    = servUri.Host;
                if (!host.Equals(FriendlySourceName, StringComparison.InvariantCultureIgnoreCase))
                {
                    FriendlySourceName = host;
                }
            }

            InitializeProperties();
            if (_environment != null)
            {
                _environment.AuthorizationServiceSet += OnEnvironmentOnAuthorizationServiceSet;
                AuthorizationServiceOnPermissionsChanged(null, null);
            }
            IsLoading = false;
            if (ResourceModel == null)
            {
                ValidationMemoManager.UpdateLastValidationMemoWithSourceNotFoundError();
            }
        }