Example #1
0
        public Communication.Managed.ConnectionSettings GetConnectionSettings()
        {
            ChannelSettings channelSettings = Channel.GetChannelSettings();

            Communication.Managed.ConnectionSettings connectionSettings = new Communication.Managed.ConnectionSettings(channelSettings, MachineAddress, ObjectUid);
            return(connectionSettings);
        }
Example #2
0
        public void RestoreConnections(IApplicationCollection applications, IConnectionSettingsCollection settings)
        {
            if (settings.RunLocal)
            {
                applications.ConnectLocal(true);
            }
            List <Exception> exceptions = null;

            foreach (IConnectionSettings hostSettings in settings)
            {
                Communication.Managed.ConnectionSettings connectionSettings = hostSettings.GetConnectionSettings();
                try
                {
                    applications.Connect(connectionSettings);
                }
                catch (Exception exception)
                {
                    if (exceptions == null)
                    {
                        exceptions = new List <Exception>();
                    }
                    exceptions.Add(exception);
                }
            }
            if (exceptions != null)
            {
                throw new AggregateException(exceptions);
            }
        }