Пример #1
0
        protected override void InitializeCommands()
        {
            SetScopeCommand = new PresenterCommand
            {
                CanExecuteDelegate = s => true,
                ExecuteDelegate    = s =>
                {
                    string    scope    = (string)s;
                    PnrpScope newScope = PnrpScope.All;

                    switch (scope.ToUpper())
                    {
                    case "ALL":
                        newScope = PnrpScope.All;
                        break;

                    case "GLOBAL":
                        newScope = PnrpScope.Global;
                        break;

                    case "LINKLOCAL":
                        newScope = PnrpScope.LinkLocal;
                        break;
                    }

                    _pnrpService.CurrentScope = newScope;
                }
            };
        }
Пример #2
0
 /// <summary>
 /// Constructs an instance of a Cloud.
 /// This is not public and accessible for internal members only
 /// </summary>
 /// <param name="name">Name of the cloud</param>
 /// <param name="pnrpScope">scope</param>
 /// <param name="scopeId">id ofthe scope</param>
 internal Cloud(string name, PnrpScope pnrpScope, int scopeId)
 {
     Logging.P2PTraceSource.TraceEvent(TraceEventType.Information, 0, "Creating cloud with Name: {0}, PnrpScope: {1}, ScopeID: {2}", name, pnrpScope, scopeId);
     m_CloudName = name;
     m_PnrpScope = pnrpScope;
     m_ScopeId   = scopeId;
 }
Пример #3
0
 private void SetScopedClouds(PnrpScope scope)
 {
     _scopedClouds.Clear();
     foreach (CloudInfo cloud in this.AllClouds)
     {
         if (cloud.Scope == scope || scope == PnrpScope.All)
         {
             _scopedClouds.Add(cloud);
         }
     }
 }
Пример #4
0
        private void SetScopedRegistrations(PnrpScope scope)
        {
            _scopedRegistrations.Clear();

            foreach (PeerNameRegistration reg in _registrations)
            {
                if (scope == PnrpScope.All || reg.Cloud.Scope == PnrpScope.All || reg.Cloud.Scope == scope)
                {
                    _scopedRegistrations.Add(reg);
                }
            }
        }
Пример #5
0
        private void ProcessRegistrations(PnrpScope scope)
        {
            SetScopedClouds(scope);
            SetScopedRegistrations(scope);

            foreach (CloudInfo cloud in this.CloudsInScope)
            {
                cloud.HasRegistrations       = false;
                cloud.HasSecureRegistrations = false;

                var registrations = from r in this.RegistrationsInScope where r.Cloud.Scope == scope || r.Cloud.Scope == PnrpScope.All select r;
                if (registrations.Count() > 0)
                {
                    cloud.HasRegistrations = true;
                }

                var secure = from r in registrations where r.PeerName.IsSecured select r;

                if (secure.Count() > 0)
                {
                    cloud.HasSecureRegistrations = true;
                }
            }
        }
Пример #6
0
 protected Cloud(SerializationInfo info, StreamingContext context)
 {
     m_CloudName = info.GetString("_CloudName");
     m_PnrpScope = (PnrpScope)info.GetValue("_CloudScope", typeof(PnrpScope));
     m_ScopeId   = info.GetInt32("_CloudScopeId");
 }
Пример #7
0
        private void ProcessRegistrations(PnrpScope scope)
        {
            SetScopedClouds(scope);
            SetScopedRegistrations(scope);

            foreach (CloudInfo cloud in this.CloudsInScope)
            {
                cloud.HasRegistrations = false;
                cloud.HasSecureRegistrations = false;

                var registrations = from r in this.RegistrationsInScope where r.Cloud.Scope == scope || r.Cloud.Scope == PnrpScope.All select r;
                if (registrations.Count() > 0)
                    cloud.HasRegistrations = true;

                var secure = from r in registrations where r.PeerName.IsSecured select r;

                if (secure.Count() > 0)
                    cloud.HasSecureRegistrations = true;
            }
        }
Пример #8
0
        private void SetScopedRegistrations(PnrpScope scope)
        {
            _scopedRegistrations.Clear();

            foreach (PeerNameRegistration reg in _registrations)
            {
                if (scope == PnrpScope.All || reg.Cloud.Scope == PnrpScope.All || reg.Cloud.Scope == scope)
                    _scopedRegistrations.Add(reg);
            }

        }
Пример #9
0
 private void SetScopedClouds(PnrpScope scope)
 {
     _scopedClouds.Clear();
     foreach (CloudInfo cloud in this.AllClouds)
     {
         if (cloud.Scope == scope || scope == PnrpScope.All)
             _scopedClouds.Add(cloud);
     }
 }