mirror of https://github.com/2dust/v2rayN
Remove unnecessary
parent
c9ec34b836
commit
3a06ff8113
|
@ -89,20 +89,6 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
||||||
|
|
||||||
#endregion WhenAnyValue && ReactiveCommand
|
#endregion WhenAnyValue && ReactiveCommand
|
||||||
|
|
||||||
#region AppEvents
|
|
||||||
|
|
||||||
AppEvents.ProfilesRefreshRequested
|
|
||||||
.AsObservable()
|
|
||||||
.ObserveOn(RxApp.MainThreadScheduler)
|
|
||||||
.Subscribe(async _ => await RefreshServersBiz());
|
|
||||||
|
|
||||||
AppEvents.DispatcherStatisticsRequested
|
|
||||||
.AsObservable()
|
|
||||||
.ObserveOn(RxApp.MainThreadScheduler)
|
|
||||||
.Subscribe(UpdateStatistics);
|
|
||||||
|
|
||||||
#endregion AppEvents
|
|
||||||
|
|
||||||
_ = Init();
|
_ = Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,42 +116,6 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
public void UpdateStatistics(ServerSpeedItem update)
|
|
||||||
{
|
|
||||||
if (!_config.GuiItem.EnableStatistics
|
|
||||||
|| (update.ProxyUp + update.ProxyDown) <= 0
|
|
||||||
|| DateTime.Now.Second % 3 != 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var item = ProfileItems.FirstOrDefault(it => it.IndexId == update.IndexId);
|
|
||||||
if (item != null)
|
|
||||||
{
|
|
||||||
item.TodayDown = Utils.HumanFy(update.TodayDown);
|
|
||||||
item.TodayUp = Utils.HumanFy(update.TodayUp);
|
|
||||||
item.TotalDown = Utils.HumanFy(update.TotalDown);
|
|
||||||
item.TotalUp = Utils.HumanFy(update.TotalUp);
|
|
||||||
|
|
||||||
//if (SelectedProfile?.IndexId == item.IndexId)
|
|
||||||
//{
|
|
||||||
// var temp = JsonUtils.DeepCopy(item);
|
|
||||||
// _profileItems.Replace(item, temp);
|
|
||||||
// SelectedProfile = temp;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// _profileItems.Replace(item, JsonUtils.DeepCopy(item));
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanOk()
|
public bool CanOk()
|
||||||
{
|
{
|
||||||
return SelectedProfile != null && !SelectedProfile.IndexId.IsNullOrEmpty();
|
return SelectedProfile != null && !SelectedProfile.IndexId.IsNullOrEmpty();
|
||||||
|
@ -264,13 +214,7 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
||||||
|
|
||||||
//await ConfigHandler.SetDefaultServer(_config, lstModel);
|
//await ConfigHandler.SetDefaultServer(_config, lstModel);
|
||||||
|
|
||||||
var lstServerStat = (_config.GuiItem.EnableStatistics ? StatisticsManager.Instance.ServerStat : null) ?? [];
|
|
||||||
var lstProfileExs = await ProfileExManager.Instance.GetProfileExs();
|
|
||||||
lstModel = (from t in lstModel
|
lstModel = (from t in lstModel
|
||||||
join t2 in lstServerStat on t.IndexId equals t2.IndexId into t2b
|
|
||||||
from t22 in t2b.DefaultIfEmpty()
|
|
||||||
join t3 in lstProfileExs on t.IndexId equals t3.IndexId into t3b
|
|
||||||
from t33 in t3b.DefaultIfEmpty()
|
|
||||||
select new ProfileItemModel
|
select new ProfileItemModel
|
||||||
{
|
{
|
||||||
IndexId = t.IndexId,
|
IndexId = t.IndexId,
|
||||||
|
@ -284,15 +228,6 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
||||||
Subid = t.Subid,
|
Subid = t.Subid,
|
||||||
SubRemarks = t.SubRemarks,
|
SubRemarks = t.SubRemarks,
|
||||||
IsActive = t.IndexId == _config.IndexId,
|
IsActive = t.IndexId == _config.IndexId,
|
||||||
Sort = t33?.Sort ?? 0,
|
|
||||||
Delay = t33?.Delay ?? 0,
|
|
||||||
Speed = t33?.Speed ?? 0,
|
|
||||||
DelayVal = t33?.Delay != 0 ? $"{t33?.Delay}" : string.Empty,
|
|
||||||
SpeedVal = t33?.Speed > 0 ? $"{t33?.Speed}" : t33?.Message ?? string.Empty,
|
|
||||||
TodayDown = t22 == null ? "" : Utils.HumanFy(t22.TodayDown),
|
|
||||||
TodayUp = t22 == null ? "" : Utils.HumanFy(t22.TodayUp),
|
|
||||||
TotalDown = t22 == null ? "" : Utils.HumanFy(t22.TotalDown),
|
|
||||||
TotalUp = t22 == null ? "" : Utils.HumanFy(t22.TotalUp)
|
|
||||||
}).OrderBy(t => t.Sort).ToList();
|
}).OrderBy(t => t.Sort).ToList();
|
||||||
|
|
||||||
// Apply ConfigType filter (include or exclude)
|
// Apply ConfigType filter (include or exclude)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
x:Class="v2rayN.Desktop.Views.ProfilesSelectWindow"
|
x:Class="v2rayN.Desktop.Views.ProfilesSelectWindow"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:conv="using:v2rayN.Desktop.Converters"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||||
|
@ -14,10 +13,6 @@
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Window.Resources>
|
|
||||||
<conv:DelayColorConverter x:Key="DelayColorConverter" />
|
|
||||||
</Window.Resources>
|
|
||||||
|
|
||||||
<DockPanel Margin="8">
|
<DockPanel Margin="8">
|
||||||
<!-- Bottom buttons -->
|
<!-- Bottom buttons -->
|
||||||
<StackPanel
|
<StackPanel
|
||||||
|
@ -95,7 +90,7 @@
|
||||||
Header="{x:Static resx:ResUI.LvServiceType}"
|
Header="{x:Static resx:ResUI.LvServiceType}"
|
||||||
Tag="ConfigType" />
|
Tag="ConfigType" />
|
||||||
|
|
||||||
<DataGridTemplateColumn Tag="Remarks" SortMemberPath="Remarks">
|
<DataGridTemplateColumn SortMemberPath="Remarks" Tag="Remarks">
|
||||||
<DataGridTemplateColumn.Header>
|
<DataGridTemplateColumn.Header>
|
||||||
<TextBlock Text="{x:Static resx:ResUI.LvRemarks}" />
|
<TextBlock Text="{x:Static resx:ResUI.LvRemarks}" />
|
||||||
</DataGridTemplateColumn.Header>
|
</DataGridTemplateColumn.Header>
|
||||||
|
@ -133,49 +128,6 @@
|
||||||
Binding="{Binding SubRemarks}"
|
Binding="{Binding SubRemarks}"
|
||||||
Header="{x:Static resx:ResUI.LvSubscription}"
|
Header="{x:Static resx:ResUI.LvSubscription}"
|
||||||
Tag="SubRemarks" />
|
Tag="SubRemarks" />
|
||||||
|
|
||||||
<DataGridTemplateColumn SortMemberPath="Delay" Tag="DelayVal">
|
|
||||||
<DataGridTemplateColumn.Header>
|
|
||||||
<TextBlock Text="{x:Static resx:ResUI.LvTestDelay}" />
|
|
||||||
</DataGridTemplateColumn.Header>
|
|
||||||
<DataGridTemplateColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock
|
|
||||||
Margin="8,0"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Foreground="{Binding Delay, Converter={StaticResource DelayColorConverter}}"
|
|
||||||
Text="{Binding DelayVal}" />
|
|
||||||
</DataTemplate>
|
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
|
||||||
</DataGridTemplateColumn>
|
|
||||||
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding SpeedVal}"
|
|
||||||
Header="{x:Static resx:ResUI.LvTestSpeed}"
|
|
||||||
Tag="SpeedVal" />
|
|
||||||
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TodayUp}"
|
|
||||||
Header="{x:Static resx:ResUI.LvTodayUploadDataAmount}"
|
|
||||||
Tag="TodayUp" />
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TodayDown}"
|
|
||||||
Header="{x:Static resx:ResUI.LvTodayDownloadDataAmount}"
|
|
||||||
Tag="TodayDown" />
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TotalUp}"
|
|
||||||
Header="{x:Static resx:ResUI.LvTotalUploadDataAmount}"
|
|
||||||
Tag="TotalUp" />
|
|
||||||
<DataGridTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TotalDown}"
|
|
||||||
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}"
|
|
||||||
Tag="TotalDown" />
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:base="clr-namespace:v2rayN.Base"
|
xmlns:base="clr-namespace:v2rayN.Base"
|
||||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
@ -18,13 +17,6 @@
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Window.Resources>
|
|
||||||
<ResourceDictionary>
|
|
||||||
<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
|
|
||||||
<conv:DelayColorConverter x:Key="DelayColorConverter" />
|
|
||||||
</ResourceDictionary>
|
|
||||||
</Window.Resources>
|
|
||||||
|
|
||||||
<DockPanel Margin="{StaticResource Margin8}">
|
<DockPanel Margin="{StaticResource Margin8}">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="{StaticResource Margin4}"
|
Margin="{StaticResource Margin4}"
|
||||||
|
@ -156,55 +148,6 @@
|
||||||
Binding="{Binding SubRemarks}"
|
Binding="{Binding SubRemarks}"
|
||||||
ExName="SubRemarks"
|
ExName="SubRemarks"
|
||||||
Header="{x:Static resx:ResUI.LvSubscription}" />
|
Header="{x:Static resx:ResUI.LvSubscription}" />
|
||||||
<base:MyDGTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding DelayVal}"
|
|
||||||
ExName="DelayVal"
|
|
||||||
Header="{x:Static resx:ResUI.LvTestDelay}"
|
|
||||||
SortMemberPath="Delay">
|
|
||||||
<DataGridTextColumn.ElementStyle>
|
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
||||||
<Setter Property="Foreground" Value="{Binding Delay, Converter={StaticResource DelayColorConverter}}" />
|
|
||||||
</Style>
|
|
||||||
</DataGridTextColumn.ElementStyle>
|
|
||||||
</base:MyDGTextColumn>
|
|
||||||
<base:MyDGTextColumn
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding SpeedVal}"
|
|
||||||
ExName="SpeedVal"
|
|
||||||
Header="{x:Static resx:ResUI.LvTestSpeed}">
|
|
||||||
<DataGridTextColumn.ElementStyle>
|
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
||||||
</Style>
|
|
||||||
</DataGridTextColumn.ElementStyle>
|
|
||||||
</base:MyDGTextColumn>
|
|
||||||
|
|
||||||
<base:MyDGTextColumn
|
|
||||||
x:Name="colTodayUp"
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TodayUp}"
|
|
||||||
ExName="TodayUp"
|
|
||||||
Header="{x:Static resx:ResUI.LvTodayUploadDataAmount}" />
|
|
||||||
<base:MyDGTextColumn
|
|
||||||
x:Name="colTodayDown"
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TodayDown}"
|
|
||||||
ExName="TodayDown"
|
|
||||||
Header="{x:Static resx:ResUI.LvTodayDownloadDataAmount}" />
|
|
||||||
<base:MyDGTextColumn
|
|
||||||
x:Name="colTotalUp"
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TotalUp}"
|
|
||||||
ExName="TotalUp"
|
|
||||||
Header="{x:Static resx:ResUI.LvTotalUploadDataAmount}" />
|
|
||||||
<base:MyDGTextColumn
|
|
||||||
x:Name="colTotalDown"
|
|
||||||
Width="100"
|
|
||||||
Binding="{Binding TotalDown}"
|
|
||||||
ExName="TotalDown"
|
|
||||||
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}" />
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
Loading…
Reference in New Issue