1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-24 06:06:07 +03:00
ProxySU/ProxySuper.WPF/Views/HomeView.xaml.cs

106 lines
3.4 KiB
C#
Raw Normal View History

2021-05-14 14:07:19 +03:00
using MvvmCross;
using MvvmCross.Navigation;
2022-11-20 18:00:16 +03:00
using MvvmCross.Platforms.Wpf.Presenters.Attributes;
2021-05-14 14:07:19 +03:00
using MvvmCross.Platforms.Wpf.Views;
2022-11-20 18:00:16 +03:00
using MvvmCross.ViewModels;
2021-05-14 14:07:19 +03:00
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;
2021-05-14 14:07:19 +03:00
using System.Windows;
namespace ProxySuper.WPF.Views
{
2022-11-20 18:00:16 +03:00
[MvxContentPresentation]
[MvxViewFor(typeof(HomeViewModel))]
2021-05-14 14:07:19 +03:00
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-29 06:43:06 +03:00
private void LaunchUseRootSite(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/%E8%B0%B7%E6%AD%8C%E4%BA%91%E5%BC%80%E5%90%AFroot%E8%B4%A6%E6%88%B7%E4%B8%8E%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95");
}
private void LaunchCertQuestion(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/%E5%B8%B8%E8%A7%81%E8%AF%81%E4%B9%A6%E7%94%B3%E8%AF%B7%E5%A4%B1%E8%B4%A5%E9%97%AE%E9%A2%98");
}
private void LaunchPrivateKeyQuestion(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU/wiki/PrivateKey%E8%BD%AC%E6%8D%A2");
}
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-29 06:43:06 +03:00
2021-07-08 13:37:32 +03:00
private void GetRoot(object sender, RoutedEventArgs e)
{
NavigationService.Navigate<EnableRootViewModel>();
}
2021-05-29 06:43:06 +03:00
2021-05-14 14:07:19 +03:00
}
}