Beispiel #1
0
        public OrganizationServiceExtentedProxy(OrganizationServiceProxy serviceProxy, ConnectionData connectionData, string currentServiceEndpoint)
        {
            this._serviceProxy  = serviceProxy ?? throw new ArgumentNullException(nameof(serviceProxy));
            this.ConnectionData = connectionData ?? throw new ArgumentNullException(nameof(connectionData));
            this.UrlGenerator   = new ConnectionDataUrlGenerator(this);

            this.CurrentServiceEndpoint = currentServiceEndpoint;

            this.ConnectionData.StoreServiceInUse(serviceProxy);
        }
Beispiel #2
0
        private void LoadConnectionsFromDisk()
        {
            List <ConnectionData> loadedConnections = new List <ConnectionData>();

            loadedConnections.AddRange(this.Connections);
            loadedConnections.AddRange(this.ArchiveConnections);

            foreach (var connection in loadedConnections)
            {
                connection.StopWatchFile();
            }

            this.Connections.Clear();
            this.ArchiveConnections.Clear();

            foreach (var connectionId in this.ConnectionsGuids)
            {
                if (!this.Connections.Any(c => c.ConnectionId == connectionId))
                {
                    ConnectionData connectionData = loadedConnections.FirstOrDefault(c => c.ConnectionId == connectionId);

                    if (connectionData == null)
                    {
                        connectionData = ConnectionData.Get(connectionId);
                    }

                    if (connectionData != null)
                    {
                        connectionData.ConnectionConfiguration = this;
                        connectionData.User = this.Users.FirstOrDefault(u => u.UserId == connectionData.UserId);

                        connectionData.LoadIntellisenseAsync();
                        connectionData.StartWatchFile();

                        this.Connections.Add(connectionData);
                    }
                }
            }

            foreach (var connectionId in this.ArchiveConnectionsGuids)
            {
                if (!this.ArchiveConnections.Any(c => c.ConnectionId == connectionId))
                {
                    ConnectionData connectionData = loadedConnections.FirstOrDefault(c => c.ConnectionId == connectionId);

                    if (connectionData == null)
                    {
                        connectionData = ConnectionData.Get(connectionId);
                    }

                    if (connectionData != null)
                    {
                        connectionData.ConnectionConfiguration = this;
                        connectionData.User = this.Users.FirstOrDefault(u => u.UserId == connectionData.UserId);

                        connectionData.LoadIntellisenseAsync();
                        connectionData.StartWatchFile();

                        this.ArchiveConnections.Add(connectionData);
                    }
                }
            }
        }