Ejemplo n.º 1
0
        public SessionConsole(Process process, Session session)
        {
            InitializeComponent();

            if (session.SendCommands)
            {
                _stayOpen = session.PersistentConsole;
            }
            else
            {
                _stayOpen = session.StartShell;
            }

            SessionConsoleViewModel viewModel = new SessionConsoleViewModel(process, session);

            viewModel.StatusChanged     += DataContext_StatusChanged;
            viewModel.PasswordRequested += DataContext_PasswordRequested;

            DataContext = viewModel;

            if (App.Current.MainWindow is SessionConsole)
            {
                App.Current.MainWindow = null;
            }
        }
Ejemplo n.º 2
0
        private void CloseConsole()
        {
            SessionConsoleViewModel viewModel = DataContext as SessionConsoleViewModel;

            if (viewModel != null)
            {
                viewModel.StatusChanged     -= DataContext_StatusChanged;
                viewModel.PasswordRequested -= DataContext_PasswordRequested;
                viewModel.UnsubscribeStandardDataReceived();
                DataContext = null;
            }

            if (IsLoaded)
            {
                Close();
            }
        }
        public SessionConsole(Process process, Session session)
        {
            InitializeComponent();

            if (session.SendCommands)
                _stayOpen = session.PersistentConsole;
            else
                _stayOpen = session.StartShell;

            SessionConsoleViewModel viewModel = new SessionConsoleViewModel(process, session);
            viewModel.StatusChanged += DataContext_StatusChanged;
            viewModel.PasswordRequested += DataContext_PasswordRequested;

            DataContext = viewModel;

            if (App.Current.MainWindow is SessionConsole)
                App.Current.MainWindow = null;
        }