-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add window for showing server information
- Loading branch information
1 parent
ce1c2bc
commit fbd5692
Showing
7 changed files
with
141 additions
and
10 deletions.
There are no files selected for viewing
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
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
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,46 @@ | ||
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.ContextMenu.ServerInformation" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.ContextMenu" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" | ||
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.ContextMenu" | ||
d:DataContext="{d:DesignInstance Type=models:ServerInformationViewModel}" | ||
mc:Ignorable="d" | ||
Title="Server information" | ||
MinWidth="0" | ||
MinHeight="0" | ||
Width="400" | ||
Height="230" | ||
ResizeMode="NoResize" | ||
Background="{ui:ThemeResource ApplicationBackgroundBrush}" | ||
ExtendsContentIntoTitleBar="True" | ||
WindowStartupLocation="CenterScreen"> | ||
<Grid> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<ui:TitleBar Grid.Row="0" Grid.ColumnSpan="2" Padding="8" x:Name="RootTitleBar" Title="Server information" ShowMinimize="False" ShowMaximize="False" CanMaximize="False" KeyboardNavigation.TabNavigation="None" Icon="pack://application:,,,/Bloxstrap.ico" /> | ||
|
||
<StackPanel Grid.Row="1" Margin="12"> | ||
<TextBlock Text="Instance ID" FontSize="16" FontWeight="Medium" /> | ||
<TextBlock Text="{Binding InstanceId, Mode=OneWay}" /> | ||
|
||
<TextBlock Margin="0,16,0,0" Text="Server location" FontSize="16" FontWeight="Medium" /> | ||
<TextBlock Text="{Binding ServerLocation, Mode=OneWay}" /> | ||
</StackPanel> | ||
|
||
<Border Grid.Row="2" Margin="0,10,0,0" Padding="15" Background="{ui:ThemeResource SolidBackgroundFillColorSecondaryBrush}"> | ||
<StackPanel Orientation="Horizontal" FlowDirection="LeftToRight" HorizontalAlignment="Right"> | ||
<Button MinWidth="100" Content="Copy instance ID" Command="{Binding CopyInstanceIdCommand, Mode=OneTime}" /> | ||
<Button Margin="12,0,0,0" MinWidth="100" Content="Close" Command="{Binding CloseWindowCommand, Mode=OneTime}" /> | ||
</StackPanel> | ||
</Border> | ||
</Grid> | ||
</Grid> | ||
</ui:UiWindow> |
30 changes: 30 additions & 0 deletions
30
Bloxstrap/UI/Elements/ContextMenu/ServerInformation.xaml.cs
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,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
using Bloxstrap.UI.ViewModels.ContextMenu; | ||
|
||
namespace Bloxstrap.UI.Elements.ContextMenu | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ServerInformation.xaml | ||
/// </summary> | ||
public partial class ServerInformation | ||
{ | ||
public ServerInformation(RobloxActivity activityWatcher) | ||
{ | ||
DataContext = new ServerInformationViewModel(this, activityWatcher); | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
Bloxstrap/UI/ViewModels/ContextMenu/ServerInformationViewModel.cs
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,34 @@ | ||
using System.Windows.Input; | ||
|
||
using CommunityToolkit.Mvvm.Input; | ||
|
||
using Bloxstrap.UI.Elements.ContextMenu; | ||
|
||
namespace Bloxstrap.UI.ViewModels.ContextMenu | ||
{ | ||
internal class ServerInformationViewModel : NotifyPropertyChangedViewModel | ||
{ | ||
private readonly ServerInformation _window; | ||
private readonly RobloxActivity _activityWatcher; | ||
|
||
public string InstanceId => _activityWatcher.ActivityJobId; | ||
public string ServerLocation { get; private set; } = "Loading, please wait..."; | ||
|
||
public ICommand CopyInstanceIdCommand => new RelayCommand(CopyInstanceId); | ||
public ICommand CloseWindowCommand => new RelayCommand(_window.Close); | ||
|
||
public ServerInformationViewModel(ServerInformation window, RobloxActivity activityWatcher) | ||
{ | ||
_window = window; | ||
_activityWatcher = activityWatcher; | ||
|
||
Task.Run(async () => | ||
{ | ||
ServerLocation = await _activityWatcher.GetServerLocation(); | ||
OnPropertyChanged(nameof(ServerLocation)); | ||
}); | ||
} | ||
|
||
private void CopyInstanceId() => Clipboard.SetText(InstanceId); | ||
} | ||
} |