mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
Binary file not shown.
|
Before Width: | Height: | Size: 345 B |
@@ -1,130 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using FluentIcons.Common;
|
||||
|
||||
namespace LanMountainDesktop.ViewModels;
|
||||
|
||||
public sealed class SuperMiningSettingsPageViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private double _hashRate = 125.6;
|
||||
private string _coinsMined = "0.08923";
|
||||
private int _poolConnections = 98;
|
||||
private double _miningProgress;
|
||||
private string _miningStatus = "正在挖矿中...";
|
||||
private bool _showAprilFoolsHint;
|
||||
private Bitmap? _qrCodeImage;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public Symbol ActionSymbol => Symbol.ArrowDownload;
|
||||
|
||||
public double HashRate
|
||||
{
|
||||
get => _hashRate;
|
||||
set
|
||||
{
|
||||
if (Math.Abs(_hashRate - value) > 0.01)
|
||||
{
|
||||
_hashRate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string CoinsMined
|
||||
{
|
||||
get => _coinsMined;
|
||||
set
|
||||
{
|
||||
if (_coinsMined != value)
|
||||
{
|
||||
_coinsMined = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PoolConnections
|
||||
{
|
||||
get => _poolConnections;
|
||||
set
|
||||
{
|
||||
if (_poolConnections != value)
|
||||
{
|
||||
_poolConnections = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public double MiningProgress
|
||||
{
|
||||
get => _miningProgress;
|
||||
set
|
||||
{
|
||||
if (Math.Abs(_miningProgress - value) > 0.1)
|
||||
{
|
||||
_miningProgress = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string MiningStatus
|
||||
{
|
||||
get => _miningStatus;
|
||||
set
|
||||
{
|
||||
if (_miningStatus != value)
|
||||
{
|
||||
_miningStatus = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowAprilFoolsHint
|
||||
{
|
||||
get => _showAprilFoolsHint;
|
||||
set
|
||||
{
|
||||
if (_showAprilFoolsHint != value)
|
||||
{
|
||||
_showAprilFoolsHint = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Bitmap? QrCodeImage
|
||||
{
|
||||
get => _qrCodeImage;
|
||||
set
|
||||
{
|
||||
if (_qrCodeImage != value)
|
||||
{
|
||||
_qrCodeImage = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadQrCodeImage()
|
||||
{
|
||||
try
|
||||
{
|
||||
var assets = AssetLoader.Open(new System.Uri("avares://LanMountainDesktop/Assets/mining_qrcode.png"));
|
||||
QrCodeImage = new Bitmap(assets);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
@@ -1,271 +0,0 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:LanMountainDesktop.ViewModels"
|
||||
xmlns:controls="using:LanMountainDesktop.Controls"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
xmlns:fi="using:FluentIcons.Avalonia.Fluent"
|
||||
x:Class="LanMountainDesktop.Views.SettingsPages.SuperMiningSettingsPage"
|
||||
x:DataType="vm:SuperMiningSettingsPageViewModel">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="Border.mining-hero-card">
|
||||
<Setter Property="Background" Value="{DynamicResource AdaptiveSurfaceRaisedBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource AdaptiveGlassPanelBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="24" />
|
||||
<Setter Property="ClipToBounds" Value="True" />
|
||||
<Setter Property="Margin" Value="0,0,0,18" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Border.mining-stats-card">
|
||||
<Setter Property="Background" Value="{DynamicResource AdaptiveSurfaceRaisedBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource AdaptiveGlassPanelBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="16" />
|
||||
<Setter Property="Padding" Value="16" />
|
||||
<Setter Property="Margin" Value="0,0,0,12" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.mining-title">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0,0,0,8" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.mining-subtitle">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Opacity" Value="0.7" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.mining-stats-value">
|
||||
<Setter Property="FontSize" Value="28" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Foreground" Value="#4CAF50" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.mining-stats-label">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Opacity" Value="0.7" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="Border.qr-container">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="CornerRadius" Value="12" />
|
||||
<Setter Property="Padding" Value="16" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0,16,0,16" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="ProgressBar.mining-progress">
|
||||
<Setter Property="Height" Value="8" />
|
||||
<Setter Property="CornerRadius" Value="4" />
|
||||
<Setter Property="Margin" Value="0,8,0,0" />
|
||||
<Setter Property="Foreground" Value="#4CAF50" />
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="0,12,0,24"
|
||||
Spacing="0">
|
||||
|
||||
<Border Classes="mining-hero-card"
|
||||
Padding="24">
|
||||
<StackPanel Spacing="16"
|
||||
HorizontalAlignment="Center">
|
||||
<Grid HorizontalAlignment="Center">
|
||||
<fi:FluentIcon Icon="Savings"
|
||||
IconVariant="Filled"
|
||||
FontSize="64"
|
||||
Foreground="#FFD700" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Classes="mining-title"
|
||||
Text="超级挖矿" />
|
||||
|
||||
<TextBlock Classes="mining-subtitle"
|
||||
Text="开启您的虚拟货币挖矿之旅,轻松获得丰厚收益!" />
|
||||
|
||||
<Grid ColumnDefinitions="*,*,*"
|
||||
Margin="0,8,0,0"
|
||||
ColumnSpacing="12">
|
||||
<Border Classes="mining-stats-card"
|
||||
Grid.Column="0">
|
||||
<StackPanel HorizontalAlignment="Center">
|
||||
<TextBlock Classes="mining-stats-value"
|
||||
Text="{Binding HashRate}"
|
||||
HorizontalAlignment="Center" />
|
||||
<TextBlock Classes="mining-stats-label"
|
||||
Text="算力 MH/s"
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Classes="mining-stats-card"
|
||||
Grid.Column="1">
|
||||
<StackPanel HorizontalAlignment="Center">
|
||||
<TextBlock Classes="mining-stats-value"
|
||||
Text="{Binding CoinsMined}"
|
||||
HorizontalAlignment="Center" />
|
||||
<TextBlock Classes="mining-stats-label"
|
||||
Text="已挖掘"
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Classes="mining-stats-card"
|
||||
Grid.Column="2">
|
||||
<StackPanel HorizontalAlignment="Center">
|
||||
<TextBlock Classes="mining-stats-value"
|
||||
Text="{Binding PoolConnections}"
|
||||
HorizontalAlignment="Center" />
|
||||
<TextBlock Classes="mining-stats-label"
|
||||
Text="矿池连接"
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<ProgressBar Classes="mining-progress"
|
||||
Value="{Binding MiningProgress}"
|
||||
Maximum="100" />
|
||||
|
||||
<TextBlock Text="{Binding MiningStatus}"
|
||||
FontSize="12"
|
||||
Opacity="0.7"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,4,0,0" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<ui:SettingsExpander Header="绑定钱包"
|
||||
Description="扫描下方二维码绑定您的钱包地址"
|
||||
IsExpanded="True">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="QrCode" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpanderItem>
|
||||
<StackPanel HorizontalAlignment="Center"
|
||||
Spacing="12">
|
||||
<Border Classes="qr-container">
|
||||
<Image Source="{Binding QrCodeImage}"
|
||||
Width="200"
|
||||
Height="200"
|
||||
Stretch="Uniform" />
|
||||
</Border>
|
||||
|
||||
<TextBlock Text="请扫码绑定后开始获得虚拟币"
|
||||
FontSize="14"
|
||||
FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
TextAlignment="Center" />
|
||||
|
||||
<TextBlock Text="支持主流钱包:MetaMask、Trust Wallet、imToken等"
|
||||
FontSize="12"
|
||||
Opacity="0.6"
|
||||
HorizontalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Header="挖矿设置"
|
||||
Description="配置您的挖矿参数">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="Settings" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*"
|
||||
ColumnSpacing="16"
|
||||
RowDefinitions="Auto,Auto,Auto"
|
||||
RowSpacing="12">
|
||||
<TextBlock Grid.Row="0"
|
||||
FontWeight="SemiBold"
|
||||
Text="挖矿算法:" />
|
||||
<TextBlock Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Opacity="0.82"
|
||||
Text="Ethash (优化版)" />
|
||||
|
||||
<TextBlock Grid.Row="1"
|
||||
FontWeight="SemiBold"
|
||||
Text="矿池地址:" />
|
||||
<TextBlock Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Opacity="0.82"
|
||||
Text="stratum+tcp://mine.lanmountain.cn:3333" />
|
||||
|
||||
<TextBlock Grid.Row="2"
|
||||
FontWeight="SemiBold"
|
||||
Text="手续费率:" />
|
||||
<TextBlock Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Opacity="0.82"
|
||||
Text="0.1% (超低费率)" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:SettingsExpander Header="收益统计"
|
||||
Description="查看您的挖矿收益">
|
||||
<ui:SettingsExpander.IconSource>
|
||||
<fi:SymbolIconSource Symbol="DataTrending" />
|
||||
</ui:SettingsExpander.IconSource>
|
||||
<ui:SettingsExpanderItem>
|
||||
<Grid ColumnDefinitions="Auto,*"
|
||||
ColumnSpacing="16"
|
||||
RowDefinitions="Auto,Auto,Auto,Auto"
|
||||
RowSpacing="12">
|
||||
<TextBlock Grid.Row="0"
|
||||
FontWeight="SemiBold"
|
||||
Text="今日收益:" />
|
||||
<TextBlock Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Foreground="#4CAF50"
|
||||
FontWeight="Bold"
|
||||
Text="+0.00234 ETH" />
|
||||
|
||||
<TextBlock Grid.Row="1"
|
||||
FontWeight="SemiBold"
|
||||
Text="本周收益:" />
|
||||
<TextBlock Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Foreground="#4CAF50"
|
||||
FontWeight="Bold"
|
||||
Text="+0.01678 ETH" />
|
||||
|
||||
<TextBlock Grid.Row="2"
|
||||
FontWeight="SemiBold"
|
||||
Text="总收益:" />
|
||||
<TextBlock Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Foreground="#4CAF50"
|
||||
FontWeight="Bold"
|
||||
Text="+0.08923 ETH" />
|
||||
|
||||
<TextBlock Grid.Row="3"
|
||||
FontWeight="SemiBold"
|
||||
Text="预计下次支付:" />
|
||||
<TextBlock Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Opacity="0.82"
|
||||
Text="约 12 小时后" />
|
||||
</Grid>
|
||||
</ui:SettingsExpanderItem>
|
||||
</ui:SettingsExpander>
|
||||
|
||||
<ui:InfoBar Title="愚人节快乐!"
|
||||
Message="这只是一个玩笑功能,没有真实的挖矿行为。感谢您使用阑山桌面!"
|
||||
Severity="Informational"
|
||||
IsOpen="{Binding ShowAprilFoolsHint}"
|
||||
IsClosable="False"
|
||||
Margin="0,12,0,0" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using Avalonia.Threading;
|
||||
using LanMountainDesktop.PluginSdk;
|
||||
using LanMountainDesktop.ViewModels;
|
||||
|
||||
namespace LanMountainDesktop.Views.SettingsPages;
|
||||
|
||||
[SettingsPageInfo(
|
||||
"super-mining",
|
||||
"超级挖矿",
|
||||
SettingsPageCategory.About,
|
||||
IconKey = "Savings",
|
||||
SortOrder = 35,
|
||||
TitleLocalizationKey = "settings.supermining.title",
|
||||
DescriptionLocalizationKey = "settings.supermining.description",
|
||||
HidePageTitle = true)]
|
||||
public partial class SuperMiningSettingsPage : SettingsPageBase
|
||||
{
|
||||
private readonly DispatcherTimer _updateTimer;
|
||||
private readonly Random _random = new();
|
||||
private int _tickCount;
|
||||
|
||||
public SuperMiningSettingsPage()
|
||||
: this(new SuperMiningSettingsPageViewModel())
|
||||
{
|
||||
}
|
||||
|
||||
public SuperMiningSettingsPage(SuperMiningSettingsPageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
|
||||
ViewModel.LoadQrCodeImage();
|
||||
|
||||
_updateTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(1)
|
||||
};
|
||||
_updateTimer.Tick += OnUpdateTimerTick;
|
||||
|
||||
Unloaded += OnUnloaded;
|
||||
}
|
||||
|
||||
public SuperMiningSettingsPageViewModel ViewModel { get; }
|
||||
|
||||
public override void OnNavigatedTo(object? parameter)
|
||||
{
|
||||
base.OnNavigatedTo(parameter);
|
||||
_updateTimer.Start();
|
||||
}
|
||||
|
||||
private void OnUnloaded(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
_updateTimer.Stop();
|
||||
}
|
||||
|
||||
private void OnUpdateTimerTick(object? sender, EventArgs e)
|
||||
{
|
||||
_tickCount++;
|
||||
|
||||
ViewModel.HashRate = 125.6 + _random.NextDouble() * 10 - 5;
|
||||
ViewModel.MiningProgress = (ViewModel.MiningProgress + 1) % 100;
|
||||
|
||||
if (_tickCount % 5 == 0)
|
||||
{
|
||||
var baseCoins = 0.08923;
|
||||
var increment = _random.NextDouble() * 0.00001;
|
||||
ViewModel.CoinsMined = (baseCoins + increment).ToString("F5");
|
||||
}
|
||||
|
||||
ViewModel.PoolConnections = _random.Next(95, 100);
|
||||
|
||||
var statuses = new[]
|
||||
{
|
||||
"正在挖矿中...",
|
||||
"矿池连接稳定",
|
||||
"正在提交份额...",
|
||||
"算力优化中...",
|
||||
"收益计算中..."
|
||||
};
|
||||
ViewModel.MiningStatus = statuses[_tickCount % statuses.Length];
|
||||
|
||||
if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
|
||||
{
|
||||
ViewModel.ShowAprilFoolsHint = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -734,7 +734,6 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
||||
"Info" => Symbol.Info,
|
||||
"ArrowSync" => Symbol.ArrowSync,
|
||||
"Hourglass" => Symbol.Hourglass,
|
||||
"Savings" => Symbol.Savings,
|
||||
_ => Symbol.Settings
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user