This commit is contained in:
龙腾猫跃
2026-04-29 05:37:25 +08:00
parent 6aedd20512
commit 67764b393d
113 changed files with 5147 additions and 5865 deletions
@@ -99,7 +99,7 @@ Namespace Controls.Behaviors
Dim pasteText = Forms.Clipboard.GetText()
'将换行符替换为空格(#7825)
If Not tb.AcceptsReturn Then pasteText = pasteText.Replace(vbCrLf, " ").Replace(vbCr, " ").Replace(vbLf, " ")
If Not tb.AcceptsReturn Then pasteText = pasteText.ReplaceLineEndings(" ", mergeMultiple:=True)
Dim start = tb.SelectionStart
+9 -9
View File
@@ -121,17 +121,17 @@
Case 6
Stack.Tag = CType(Stack.Tag, List(Of DlForgeVersionEntry)).OrderByDescending(Function(a) a).ToList
Case 8, 9
Stack.Tag = CType(Stack.Tag, List(Of CompFile)).SortByComparison(Function(a, b) a.ReleaseDate > b.ReleaseDate)
Stack.Tag = CType(Stack.Tag, List(Of ResourceVersion)).SortByComparison(Function(a, b) a.ReleaseDate > b.ReleaseDate)
HasDuplicates =
CType(Stack.Tag, List(Of CompFile)).Distinct(Function(a, b) a.DisplayName = b.DisplayName).Count <>
CType(Stack.Tag, List(Of CompFile)).Count
CType(Stack.Tag, List(Of ResourceVersion)).DistinctBy(Function(a) a.Display).Count <>
CType(Stack.Tag, List(Of ResourceVersion)).Count
End Select
'控件转换
Select Case Type
Case 6
ForgeDownloadListItemPreload(Stack, Stack.Tag, AddressOf ForgeSave_Click, True)
Case 8
CompFilesCardPreload(Stack, Stack.Tag)
PageDownloadResourceDetail.ResourceFilesCardPreload(Stack, Stack.Tag)
End Select
'实现控件虚拟化
For Each Data As Object In Stack.Tag
@@ -149,12 +149,12 @@
Stack.Children.Add(McDownloadListItem(Data, Sub(sender, e) FrmDownloadInstall.MinecraftSelected(sender, e), False))
Case 8
'若存在重复的版本名,则显示文件名而非版本名(#1344)
Stack.Children.Add(CType(Data, CompFile).ToListItem(
AddressOf FrmDownloadCompDetail.Save_Click, BadDisplayName:=HasDuplicates))
Stack.Children.Add(CType(Data, ResourceVersion).ToListItem(
AddressOf FrmDownloadResourceDetail.Save_Click, IsBadDisplay:=HasDuplicates))
Case 9
'若存在重复的版本名,则显示文件名而非版本名(#1344)
Stack.Children.Add(CType(Data, CompFile).ToListItem(
AddressOf FrmDownloadCompDetail.Install_Click, AddressOf FrmDownloadCompDetail.Save_Click, BadDisplayName:=HasDuplicates))
Stack.Children.Add(CType(Data, ResourceVersion).ToListItem(
AddressOf FrmDownloadResourceDetail.Install_Click, AddressOf FrmDownloadResourceDetail.Save_Click, IsBadDisplay:=HasDuplicates))
Case 10
Stack.Children.Add(LiteLoaderDownloadListItem(Data, AddressOf LiteLoaderSave_Click, True))
Case 11
@@ -164,7 +164,7 @@
Case 13
Stack.Children.Add(NeoForgeDownloadListItem(Data, AddressOf NeoForgeSave_Click, True))
Case Else
Log("未知的虚拟化种类:" & Type, LogLevel.Feedback)
Log("未知的虚拟化种类:" & Type, NotifyLevel.MsgBoxAndFeedback)
End Select
Next
Stack.Children.Add(New FrameworkElement With {.Height = 18}) '下边距,同时适应折叠
+4 -13
View File
@@ -22,7 +22,7 @@
End If
If HintText.Length > 0 Then TextBox.HintText = HintText
Catch ex As Exception
Log(ex, "初始化可编辑文本框失败(" & If(Name, "") & ")", LogLevel.Feedback)
Log(ex, "初始化可编辑文本框失败(" & If(Name, "") & ")", NotifyLevel.MsgBoxAndFeedback)
End Try
End Sub
Private _Text As String = SelectedItem
@@ -107,7 +107,7 @@
Try
CType(Template.FindName("PanPopup", Me), Grid).Opacity = FrmMain.Opacity
Catch ex As Exception
Log(ex, "设置下拉框透明度失败", LogLevel.Feedback)
Log(ex, "设置下拉框透明度失败", NotifyLevel.MsgBoxAndFeedback)
End Try
End Sub
Private Sub MyComboBox_DropDownClosed(sender As Object, e As EventArgs) Handles Me.DropDownClosed
@@ -147,25 +147,16 @@
ElseIf Items.Count > NewValue Then
SelectedIndex = NewValue
Else
Log($"[Setting] 尝试显示设置 {SettingService.GetKey(Me)},但没有找到设置值 {NewValue} 的对应项", LogLevel.Debug)
Log($"[Setting] 尝试显示设置 {SettingService.GetKey(Me)},但没有找到设置值 {NewValue} 的对应项", NotifyLevel.DebugModeOnly)
SelectedIndex = -1
SelectedItem = Nothing
'Dim Key As String = SettingService.GetKey(Me)
'Dim DefaultValue = Settings.GetDefault(Key)
'If DefaultValue = NewValue Then
' Log($"[Setting] 尝试显示设置 {Key},但没有找到设置值 {NewValue} 的对应项,这可能是因为程序版本太老了", LogLevel.Hint)
'Else
' Log($"[Setting] 尝试显示设置 {Key},但没有找到设置值 {NewValue} 的对应项,已重置该设置", LogLevel.Debug)
' Settings.Reset(Key)
' RefreshSetting(DefaultValue)
'End If
End If
End Sub
Private Function GetCurrentSetting() As String Implements ISettingControl.GetCurrentSetting
If SelectedItem Is Nothing Then Return Nothing
If TypeOf SelectedItem Is DependencyObject Then
Return Val(If(SettingService.GetValue(SelectedItem), SelectedIndex))
Return If(SettingService.GetValue(SelectedItem), SelectedIndex)
Else
Return SelectedIndex
End If
@@ -1,4 +1,6 @@
Public Class MyIconButton
Imports System.Windows.Shapes
Public Class MyIconButton
'自定义事件
Public Event Click(sender As Object, e As EventArgs)
+3 -3
View File
@@ -143,11 +143,11 @@
Log(ex, $"下载图片失败,使用本地备用图片({Source})")
Return
Catch exx As Exception
Log(ex, $"下载图片失败({Source})", LogLevel.Hint)
Log(exx, $"加载备用图片失败({FallbackSource})", LogLevel.Hint)
Log(ex, $"下载图片失败({Source})", NotifyLevel.AllUsers)
Log(exx, $"加载备用图片失败({FallbackSource})", NotifyLevel.AllUsers)
End Try
Else
Log(ex, $"下载图片失败({Source},备用:{FallbackSource})", LogLevel.Hint)
Log(ex, $"下载图片失败({Source},备用:{FallbackSource})", NotifyLevel.AllUsers)
End If
End Try
End Sub, "MyImage PicLoader " & GetUuid() & "#", ThreadPriority.BelowNormal)
@@ -174,7 +174,7 @@ Public Class MyListItem
Return GetValue(TitleProperty)
End Get
Set(value As String)
SetValue(TitleProperty, value.Replace(vbCr, "").Replace(vbLf, ""))
SetValue(TitleProperty, value.ReplaceLineEndings(""))
End Set
End Property
Public Shared ReadOnly TitleProperty As DependencyProperty = DependencyProperty.Register("Title", GetType(String), GetType(MyListItem))
@@ -198,7 +198,7 @@ Public Class MyListItem
End Get
Set(value As String)
If _Info = value Then Return
value = value.Replace(vbCr, "").Replace(vbLf, "")
value = value.ReplaceLineEndings("")
_Info = value
LabInfo.Text = value
LabInfo.Visibility = If(value = "", Visibility.Collapsed, Visibility.Visible)
@@ -643,7 +643,7 @@ Public Class MyListItem
Dim Entry As New HelpEntry(CustomEvent.GetAbsoluteUrls(CustomEventService.GetEventData(Me), CustomEventService.GetEventType(Me))(0))
Entry.SetToListItem(Me)
Catch ex As Exception
Log(ex, "设置帮助 MyListItem 失败", LogLevel.Msgbox)
Log(ex, "设置帮助 MyListItem 失败", NotifyLevel.MsgBox)
CustomEventService.SetEventType(Me, CustomEvent.EventType.None)
CustomEventService.SetEventData(Me, "")
End Try
@@ -79,7 +79,7 @@ Public Class MyLoading
Do While Ex.InnerException IsNot Nothing
Ex = Ex.InnerException
Loop
LabText.Text = If(Ex.IsNetworkRelated(), "网络环境不佳,请稍后再试,或使用 VPN 改善网络环境", StrTrim(Ex.Message))
LabText.Text = If(Ex.IsNetworkRelated(), "网络环境不佳,请稍后再试,或使用 VPN 改善网络环境", Ex.Message)
End If
Else
LabText.Text = TextError
@@ -26,7 +26,7 @@
ShapeLine.StrokeThickness = GetWPFSize(1)
Catch ex As Exception
Log(ex, "输入弹窗初始化失败", LogLevel.Hint)
Log(ex, "输入弹窗初始化失败", NotifyLevel.AllUsers)
End Try
End Sub
@@ -49,7 +49,7 @@
Log("[Control] 输入弹窗:" & LabTitle.Text)
Catch ex As Exception
Log(ex, "输入弹窗加载失败", LogLevel.Hint)
Log(ex, "输入弹窗加载失败", NotifyLevel.AllUsers)
End Try
End Sub
Private Sub Close()
@@ -35,7 +35,7 @@
Next
Catch ex As Exception
Log(ex, "选择弹窗初始化失败", LogLevel.Hint)
Log(ex, "选择弹窗初始化失败", NotifyLevel.AllUsers)
End Try
End Sub
@@ -56,7 +56,7 @@
Log("[Control] 选择弹窗:" & LabTitle.Text)
Catch ex As Exception
Log(ex, "选择弹窗加载失败", LogLevel.Hint)
Log(ex, "选择弹窗加载失败", NotifyLevel.AllUsers)
End Try
End Sub
Private Sub Close()
@@ -25,7 +25,7 @@
ShapeLine.StrokeThickness = GetWPFSize(1)
Catch ex As Exception
Log(ex, "普通弹窗初始化失败", LogLevel.Hint)
Log(ex, "普通弹窗初始化失败", NotifyLevel.AllUsers)
End Try
End Sub
@@ -47,7 +47,7 @@
Log("[Control] 普通弹窗:" & LabTitle.Text & vbCrLf & LabCaption.Text)
Catch ex As Exception
Log(ex, "普通弹窗加载失败", LogLevel.Hint)
Log(ex, "普通弹窗加载失败", NotifyLevel.AllUsers)
End Try
End Sub
Private Sub Close()
@@ -1,4 +1,5 @@
Imports System.Windows.Markup
Imports System.Windows.Shapes
<ContentProperty("Inlines")>
Public Class MyRadioBox
@@ -99,7 +100,7 @@ Public Class MyRadioBox
End If
Catch ex As Exception
Log(ex, "单选框勾选改变错误", LogLevel.Hint)
Log(ex, "单选框勾选改变错误", NotifyLevel.AllUsers)
End Try
End Sub
Private Sub SyncUI()
@@ -104,7 +104,7 @@ Public Class MyRadioButton
RaiseCustomEvent()
Catch ex As Exception
Log(ex, "单选按钮勾选改变错误", LogLevel.Hint)
Log(ex, "单选按钮勾选改变错误", NotifyLevel.AllUsers)
End Try
End Sub
@@ -27,7 +27,7 @@
AniStart(
AaDouble(
Sub(AnimDelta As Double)
RealOffset = MathClamp(RealOffset + AnimDelta, 0, ExtentHeight - ActualHeight)
RealOffset = (RealOffset + AnimDelta).Clamp(0, ExtentHeight - ActualHeight)
ScrollToVerticalOffset(RealOffset)
End Sub, Delta * DeltaMult, 300,, New AniEaseOutFluent(6)))
End Sub
@@ -1,4 +1,6 @@
Public Class MySlider
Imports System.Windows.Shapes
Public Class MySlider
Implements ISettingControl
'基础
@@ -29,7 +31,7 @@
Set(newValue As Integer)
Try
newValue = MathClamp(newValue, 0, MaxValue)
newValue = newValue.Clamp(0, MaxValue)
If _Value = newValue Then Return
'触发 Preview 事件,修改新值
@@ -61,7 +63,7 @@
If AniControlEnabled = 0 Then RaiseEvent Change(Me, False)
Catch ex As Exception
Log(ex, "滑动条进度改变出错", LogLevel.Hint)
Log(ex, "滑动条进度改变出错", NotifyLevel.AllUsers)
End Try
End Set
End Property
@@ -71,7 +73,7 @@
Dim NewWidth As Double = _Value / MaxValue * (ActualWidth - ShapeDot.Width)
LineFore.Width = Math.Max(0, NewWidth + If(NewWidth < 0.5, 0, 0.5))
LineBack.Width = Math.Max(0, ActualWidth - ShapeDot.Width - NewWidth + If(ActualWidth - ShapeDot.Width - NewWidth < 0.5, 0, 0.5))
SetLeft(ShapeDot, NewWidth)
ShapeDot.Margin = New Thickness(NewWidth, ShapeDot.Margin.Top, ShapeDot.Margin.Right, ShapeDot.Margin.Bottom)
End Sub
'拖动
@@ -89,7 +91,7 @@
AniStop("MySlider KeyPopup " & Uuid)
End Sub
Public Sub DragDoing()
Dim Percent As Double = MathClamp((Mouse.GetPosition(PanMain).X - ShapeDot.Width / 2) / (ActualWidth - ShapeDot.Width), 0, 1)
Dim Percent As Double = ((Mouse.GetPosition(PanMain).X - ShapeDot.Width / 2) / (ActualWidth - ShapeDot.Width)).Clamp(0, 1)
Dim NewValue As Integer = Percent * MaxValue
If Not NewValue = Value Then
Value = NewValue
+1 -1
View File
@@ -228,7 +228,7 @@
'改变文本
RaiseEvent ValidatedTextChanged(sender, e)
Catch ex As Exception
Log(ex, "进行输入验证时出错", LogLevel.Critical)
Log(ex, "进行输入验证时出错", NotifyLevel.MsgBoxAndFeedback)
End Try
End Sub