-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updated to Awesomium 1.7.4 - Updated the Function to Append the Formatted Text to the Serverlist. It now supports Obfuscated Text - Added a AspectRatioLayoutDecorator - Replaced Mods download Progressbar with a Progressdialog - The Progress of the Library download is shown between every Libary - Fixed Forge Download Link - Updated Versions Download. It now compares the Hash - Changed the Serverlist Font - rebuild performance counter setting from system backup in the Setup. Fixes #54 - Added a Progressdialog for the Tools Download. Closes #43
- Loading branch information
Showing
21 changed files
with
543 additions
and
190 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Imports System.Windows | ||
|
||
Public Class AspectRatioLayoutDecorator | ||
Inherits Decorator | ||
Public Shared ReadOnly AspectRatioProperty As DependencyProperty = DependencyProperty.Register("AspectRatio", | ||
GetType(Double), | ||
GetType(AspectRatioLayoutDecorator), | ||
New FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.AffectsMeasure), | ||
New ValidateValueCallback(AddressOf ValidateAspectRatio)) | ||
|
||
Private Shared Function ValidateAspectRatio(value As Object) As Boolean | ||
If Not (TypeOf value Is Double) Then | ||
Return False | ||
End If | ||
|
||
Dim aspectRatio = CDbl(value) | ||
Return aspectRatio > 0 AndAlso Not Double.IsInfinity(aspectRatio) AndAlso Not Double.IsNaN(aspectRatio) | ||
End Function | ||
|
||
Public Property AspectRatio() As Double | ||
Get | ||
Return CDbl(GetValue(AspectRatioProperty)) | ||
End Get | ||
Set(value As Double) | ||
SetValue(AspectRatioProperty, value) | ||
End Set | ||
End Property | ||
|
||
Protected Overrides Function MeasureOverride(constraint As Size) As Size | ||
If Child IsNot Nothing Then | ||
constraint = SizeToRatio(constraint, False) | ||
Child.Measure(constraint) | ||
|
||
If Double.IsInfinity(constraint.Width) OrElse Double.IsInfinity(constraint.Height) Then | ||
Return SizeToRatio(Child.DesiredSize, True) | ||
End If | ||
|
||
Return constraint | ||
End If | ||
|
||
' we don't have a child, so we don't need any space | ||
Return New Size(0, 0) | ||
End Function | ||
|
||
Public Function SizeToRatio(size As Size, expand As Boolean) As Size | ||
Dim ratio As Double = AspectRatio | ||
|
||
Dim height As Double = size.Width / ratio | ||
Dim width As Double = size.Height * ratio | ||
|
||
If expand Then | ||
width = Math.Max(width, size.Width) | ||
height = Math.Max(height, size.Height) | ||
Else | ||
width = Math.Min(width, size.Width) | ||
height = Math.Min(height, size.Height) | ||
End If | ||
|
||
Return New Size(width, height) | ||
End Function | ||
|
||
Protected Overrides Function ArrangeOverride(arrangeSize As Size) As Size | ||
If Child IsNot Nothing Then | ||
Dim newSize = SizeToRatio(arrangeSize, False) | ||
|
||
Dim widthDelta As Double = arrangeSize.Width - newSize.Width | ||
Dim heightDelta As Double = arrangeSize.Height - newSize.Height | ||
|
||
Dim top As Double = 0 | ||
Dim left As Double = 0 | ||
|
||
If Not Double.IsNaN(widthDelta) AndAlso Not Double.IsInfinity(widthDelta) Then | ||
left = widthDelta / 2 | ||
End If | ||
|
||
If Not Double.IsNaN(heightDelta) AndAlso Not Double.IsInfinity(heightDelta) Then | ||
top = heightDelta / 2 | ||
End If | ||
|
||
Dim finalRect = New Rect(New Point(left, top), newSize) | ||
Child.Arrange(finalRect) | ||
End If | ||
|
||
Return arrangeSize | ||
End Function | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Public Class BindableRichTextBox | ||
Inherits RichTextBox | ||
'disable the control from ever being able to gain focus: | ||
|
||
|
||
|
||
|
||
Public Shared DocumentProperty As DependencyProperty = DependencyProperty.Register("Document", GetType(FlowDocument), | ||
GetType(BindableRichTextBox), New FrameworkPropertyMetadata(Nothing, | ||
New PropertyChangedCallback(AddressOf OnDocumentChanged))) | ||
|
||
Sub New() | ||
MyBase.New() | ||
Me.IsReadOnly = False | ||
Me.IsDocumentEnabled = True | ||
|
||
End Sub | ||
|
||
Public Shadows Property Document() As FlowDocument | ||
Get | ||
Return DirectCast(Me.GetValue(DocumentProperty), FlowDocument) | ||
End Get | ||
|
||
Set(value As FlowDocument) | ||
Me.SetValue(DocumentProperty, value) | ||
End Set | ||
End Property | ||
|
||
Public Shared Sub OnDocumentChanged(obj As DependencyObject, args As DependencyPropertyChangedEventArgs) | ||
Dim rtb As RichTextBox = DirectCast(obj, RichTextBox) | ||
rtb.Document = DirectCast(args.NewValue, FlowDocument) | ||
End Sub | ||
End Class |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.