Exemplo n.º 1
0
        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (e.NewValue != null)
            {
                RemoteTreeViewItem selectItem = (RemoteTreeViewItem)e.NewValue;

                if (selectItem.RemoteType != RemoteType.dir)
                {
                    ScrollViewer.Visibility = Visibility.Visible;
                    RemoteItems.GetItemRemoteLink(selectItem.uuid);
                    ScrollViewer.DataContext   = RemoteItems.ItemRemoteLink;
                    TextBox_Password.Password  = RemoteItems.ItemRemoteLink.Password;
                    TextBox_Name.Text          = RemoteItems.ItemRemoteLink.Name;
                    TextBox_Password.IsEnabled = true;

                    _currentSetControl?.UnLoaded();
                    Grid_PrivateKey.Visibility = Visibility.Collapsed;
                    if (selectItem.RemoteType == RemoteType.rdp)
                    {
                        _currentSetControl = PART_SettingRdp;
                    }
                    if (selectItem.RemoteType == RemoteType.ssh)
                    {
                        //加载私钥
                        if (RemoteItems.ItemRemoteLink.PrivateKey == null)
                        {
                            CheckBox_PrivateKey.IsChecked = false;
                        }
                        else
                        {
                            CheckBox_PrivateKey.IsChecked = true;
                        }
                        CheckBox_PrivateKey_Click(null, null);
                        _currentSetControl         = PART_SettingSsh;
                        Grid_PrivateKey.Visibility = Visibility.Visible;
                    }
                    if (selectItem.RemoteType == RemoteType.telnet)
                    {
                        _currentSetControl = PART_SettingTelnet;
                    }
                    Expander_Setting.Content = _currentSetControl;
                    _currentSetControl?.Loaded(RemoteItems.ItemRemoteLink);
                }
                else
                {
                    ScrollViewer.Visibility = Visibility.Collapsed;
                }
            }
        }