Example #1
0
 static void DisconnectServers(Interfaces.IServer localhostServer, Interfaces.IExplorerViewModel explorerViewModel)
 {
     if (explorerViewModel.ConnectControlViewModel != null)
     {
         foreach (var server in explorerViewModel.ConnectControlViewModel.Servers)
         {
             if (server != null && server.DisplayName != localhostServer.DisplayName && server.IsConnected)
             {
                 server.Disconnect();
             }
         }
     }
 }
Example #2
0
        static void DisconnectAllServers(Interfaces.IServer localhostServer, Interfaces.IExplorerViewModel explorerViewModel)
        {
            explorerViewModel.SearchText = string.Empty;

            DisconnectServers(localhostServer, explorerViewModel);

            var environmentViewModels = explorerViewModel.Environments;

            if (environmentViewModels?.Count > 1)
            {
                for (var i = 0; i < environmentViewModels.Count - 1; i++)
                {
                    var remoteEnvironment = environmentViewModels.FirstOrDefault(model => model.ResourceId != Guid.Empty);
                    environmentViewModels.Remove(remoteEnvironment);
                }
            }
        }