1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 13:16:09 +03:00
ProxySU/ProxySuper.WPF/Views/HomeView.xaml.cs

85 lines
2.4 KiB
C#
Raw Normal View History

2021-05-14 14:07:19 +03:00
using MvvmCross;
using MvvmCross.Navigation;
using MvvmCross.Platforms.Wpf.Views;
using ProxySuper.Core.Models;
using ProxySuper.Core.ViewModels;
2021-05-16 11:29:37 +03:00
using System;
2021-05-25 13:28:37 +03:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
2021-05-14 14:07:19 +03:00
using System.Windows;
namespace ProxySuper.WPF.Views
{
/// <summary>
/// HomeView.xaml 的交互逻辑
/// </summary>
public partial class HomeView : MvxWpfView
{
public HomeView()
{
InitializeComponent();
}
2021-05-16 11:29:37 +03:00
private IMvxNavigationService _navigationService;
public IMvxNavigationService NavigationService
{
get
{
if (_navigationService == null)
{
_navigationService = Mvx.IoCProvider.Resolve<IMvxNavigationService>();
}
return _navigationService;
}
}
2021-05-20 13:32:17 +03:00
public new HomeViewModel ViewModel
2021-05-16 11:29:37 +03:00
{
2021-05-20 13:32:17 +03:00
get { return (HomeViewModel)base.ViewModel; }
2021-05-16 11:29:37 +03:00
}
2021-05-14 14:07:19 +03:00
private void LaunchGitHubSite(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU");
}
2021-05-22 12:14:27 +03:00
ResourceDictionary resource = new ResourceDictionary();
private void SetSimpleChinese(object sender, RoutedEventArgs e)
2021-05-14 14:07:19 +03:00
{
2021-05-22 12:14:27 +03:00
resource.Source = new Uri(@"Resources\Languages\zh_cn.xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries[0] = resource;
2021-05-16 11:29:37 +03:00
}
2021-05-14 14:07:19 +03:00
2021-05-22 12:14:27 +03:00
private void SetEnglish(object sender, RoutedEventArgs e)
2021-05-16 11:29:37 +03:00
{
2021-05-22 12:14:27 +03:00
resource.Source = new Uri(@"Resources\Languages\en.xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries[0] = resource;
2021-05-14 14:07:19 +03:00
}
2021-05-25 13:28:37 +03:00
private void SetTwCN(object sender, RoutedEventArgs e)
{
resource.Source = new Uri(@"Resources\Languages\tw_cn.xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries[0] = resource;
}
private void ShowShareLinks(object sender, RoutedEventArgs e)
{
var checkedRecords = ViewModel.Records.Where(x => x.IsChecked).ToList();
if (checkedRecords.Count == 0)
{
MessageBox.Show("您没有选择任何主机");
return;
}
NavigationService.Navigate<ShareLinkViewModel, List<Record>>(checkedRecords);
}
2021-05-14 14:07:19 +03:00
}
}