コード例 #1
0
        private static void OnConnectionAdded(object sender, ServerConnectionEventArgs e)
        {
            var wb = Workbench.Instance;

            if (wb.ActiveSiteExplorer == null)
            {
                var viewMgr = ServiceRegistry.GetService <ViewContentManager>();

                wb.ActiveSiteExplorer = viewMgr.OpenContent(Strings.Content_SiteExplorer,
                                                            Strings.Content_SiteExplorer,
                                                            ViewRegion.Left,
                                                            () => { return(new SiteExplorer()); });

                wb.ActiveSiteExplorer.ActiveConnectionChanged += new EventHandler(OnActiveConnectionChanged);

                var connMgr = ServiceRegistry.GetService <ServerConnectionManager>();
                var openMgr = ServiceRegistry.GetService <OpenResourceManager>();
                var siteExp = wb.ActiveSiteExplorer;

                var nav = new ResourceIdNavigator(connMgr, openMgr, viewMgr, siteExp, wb);
                wb.AddToolbar("Resource ID Bar", nav.NavigatorToolStrip, ToolbarRegion.Top, true);
            }

            wb.ActiveSiteExplorer.RefreshModel(e.ConnectionName);

            var svc  = ServiceRegistry.GetService <ServerConnectionManager>();
            var conn = svc.GetConnection(e.ConnectionName);

            LoggingService.Info($"There are now {svc.GetConnectionNames().Count} active connections"); //NOXLATE
        }
コード例 #2
0
        private static void OnConnectionRemoved(object sender, ServerConnectionEventArgs e)
        {
            Workbench wb = Workbench.Instance;

            Debug.Assert(wb.ActiveSiteExplorer != null);
            var svc = ServiceRegistry.GetService <ServerConnectionManager>();

            LoggingService.Info($"There are now {svc.GetConnectionNames().Count} active connections");  //NOXLATE
            //Debug.Assert(wb.ActiveSiteExplorer.ConnectionName == name);
        }
コード例 #3
0
 /// <summary>
 /// Handles the <see cref="E:ServerConnectionStarting" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="ServerConnectionEventArgs" /> instance containing the event data.</param>
 private void OnServerConnectionStarting(object sender, ServerConnectionEventArgs args)
 {
     try
     {
         args.ConnectionInfo = CurrentServerInfo;
         ServerConnectionStarting?.Invoke(this, args);
     }
     catch
     {
         //ignored
     }
 }
コード例 #4
0
        /// <summary>
        /// Handles the <see cref="E:ServerConnectionDisconnected" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="ServerConnectionEventArgs" /> instance containing the event data.</param>
        private void OnServerConnectionDisconnected(object sender, ServerConnectionEventArgs args)
        {
            try
            {
                args.ConnectionInfo = CurrentServerInfo;
                PurgeClient();

                ServerConnectionDisconnected?.Invoke(this, args);
            }
            catch
            {
                //ignored
            }
        }
コード例 #5
0
 /// <summary>
 /// Handles the <see cref="E:ServerConnectionSucceeded" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="ServerConnectionEventArgs" /> instance containing the event data.</param>
 public void OnServerConnectionSucceeded(object sender, ServerConnectionEventArgs args)
 {
     try
     {
         args.ConnectionInfo = CurrentServerInfo;
         ServerConnectionSucceeded?.Invoke(this, args);
         HostnameUpdated?.Invoke(this,
                                 new HostnameEventArgs()
         {
             NewHostname = CurrentServerInfo.Hostname, Timestamp = DateTime.Now
         });
         RequestAuth(CurrentServerInfo.Password);
     }
     catch
     {
         // ignored
     }
 }
コード例 #6
0
 private void ExecuteInitialCommand(object sender, ServerConnectionEventArgs e)
 {
     e.Player.CommandManager.ProcessCommandForCharacter(
         CommandFactory.CreateCommandFromAlias("Login"),
         new string[0]);
 }
コード例 #7
0
 private void server_ChannelClientDisconnected(object sender, ServerConnectionEventArgs args)
 {
     // TODO: should auto-reconnect?
 }
コード例 #8
0
 private void server_ChannelClientDisconnected(object sender, ServerConnectionEventArgs args)
 {
 }
コード例 #9
0
 private void OnConnectionAdded(object sender, ServerConnectionEventArgs e)
 {
     UpdateConnectionList();
 }
コード例 #10
0
 private void _server_ChannelClientConnected(object sender, ServerConnectionEventArgs args)
 {
     _server.Receive(256, args.ClientId);
 }
コード例 #11
0
 /// <summary>
 /// Called when a client disconnects.
 /// </summary>
 /// <param name="sender">Object that triggered the event.</param>
 /// <param name="e">Event arguments.</param>
 public abstract void Disconnected(object sender, ServerConnectionEventArgs e);
コード例 #12
0
 protected virtual void OnConnection(ServerConnectionEventArgs args)
 {
     ClientConnected?.Invoke(this, args);
 }
コード例 #13
0
 /// <summary>
 /// Used when a client disconnects.
 /// </summary>
 /// <param name="e">Event arguments containing the client info that disconnected.</param>
 protected virtual void OnDisconnect(ServerConnectionEventArgs e)
 {
     Disconnected?.Invoke(this, e);
 }
コード例 #14
0
 private void server_ChannelClientConnected(object sender, ServerConnectionEventArgs args)
 {
     server.Receive(bufferLength, args.ClientId);
 }
コード例 #15
0
 private void server_ChannelClientConnected(object sender, ServerConnectionEventArgs args)
 {
     server.Receive(bufferLength, args.ClientId);
 }
コード例 #16
0
 private void server_ChannelClientDisconnected(object sender, ServerConnectionEventArgs args)
 {
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: zhouzu/WatsonMesh
 static void PeerDisconnected(object sender, ServerConnectionEventArgs args)
 {
     Console.WriteLine("Peer " + args.PeerNode.IpPort + " disconnected");
 }