You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServerSharingView.xaml.cs 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using ReactiveUI;
  2. using Shadowsocks.WPF.ViewModels;
  3. using System.Reactive.Disposables;
  4. using System.Windows.Input;
  5. namespace Shadowsocks.WPF.Views
  6. {
  7. /// <summary>
  8. /// Interaction logic for ServerSharingView.xaml
  9. /// </summary>
  10. public partial class ServerSharingView
  11. {
  12. public ServerSharingView()
  13. {
  14. InitializeComponent();
  15. this.WhenActivated(disposables =>
  16. {
  17. this.OneWayBind(ViewModel,
  18. viewModel => viewModel.SelectedServerUrlImage,
  19. view => view.qrCodeImage.Source)
  20. .DisposeWith(disposables);
  21. this.OneWayBind(ViewModel,
  22. viewModel => viewModel.Servers,
  23. view => view.serversListBox.ItemsSource)
  24. .DisposeWith(disposables);
  25. this.Bind(ViewModel,
  26. viewModel => viewModel.SelectedServer,
  27. view => view.serversListBox.SelectedItem)
  28. .DisposeWith(disposables);
  29. this.OneWayBind(ViewModel,
  30. viewModel => viewModel.SelectedServerUrl,
  31. view => view.urlTextBox.Text)
  32. .DisposeWith(disposables);
  33. this.BindCommand(ViewModel!,
  34. viewModel => viewModel.CopyLink,
  35. view => view.copyLinkButton)
  36. .DisposeWith(disposables);
  37. });
  38. }
  39. private void urlTextBox_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
  40. {
  41. urlTextBox.SelectAll();
  42. }
  43. }
  44. }