Exemplo n.º 1
0
        public bool Remove(IServerSession session)
        {
            if (session == null)
            {
                return(false);
            }

            bool exist = false;

            lock (_sessions)
            {
                var unicastAddress = session.UnicastAddress;
                exist = _sessions.RemoveValue(unicastAddress, session);
                if (exist)
                {
                    LeaveAll(session);
                }
            }

            if (exist)
            {
                session.Close();
                ServerEvents.AsyncRaiseClientDisconnectedEvent(_server, session);
            }

            return(exist);
        }
 /// <summary>
 /// 移除属性改变的事件处理器
 /// </summary>
 /// <param name="dp"></param>
 /// <param name="handler"></param>
 public void RemovePropertyChanged(DependencyProperty dp, DependencyPropertyChangedEventHandler handler)
 {
     if (_propertyChangeds == null)
     {
         return;
     }
     _propertyChangeds.RemoveValue(dp, handler);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 离开组播
        /// </summary>
        /// <param name="multicastAddress"></param>
        /// <param name="session"></param>
        public bool Leave(string multicastAddress, IServerSession session)
        {
            lock (_multicastSessions)
            {
                if (!_reverseMulticastSessions.Contains(session, multicastAddress))
                {
                    return(false);
                }

                _multicastSessions.RemoveValue(multicastAddress, session);
                _reverseMulticastSessions.RemoveValue(session, multicastAddress);
            }
            return(true);
        }
Exemplo n.º 4
0
        private DynValue RemoveCallback(object o, ScriptExecutionContext context, CallbackArguments args)
        {
            lock (m_Lock)
            {
                Closure closure = args.AsType(0, string.Format("userdata<{0}>.{1}.remove", EventInfo.DeclaringType, EventInfo.Name),
                                              DataType.Function, false).Function;

                if (m_Callbacks.RemoveValue(o, closure))
                {
                    UnregisterCallback(o);
                }

                return(DynValue.Void);
            }
        }
Exemplo n.º 5
0
 internal void FileUnloaded(ProjectId projectId, FileId id)
 {
     TryRemoveFileModel(id);
     _fileToProjectMap.RemoveValue(id, projectId);
     Client.Send(new ClientMessage.FileUnloaded(projectId, id));
 }