Skip to content

Commit 79db88d

Browse files
committed
Small changes
* Fixed MessageBox being too wide * Added Warning for Admin Mode
1 parent 5d8f4d4 commit 79db88d

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

MultiRPC/Assets/Language/en-gb.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,6 @@
238238
"FluxpointTooltip": "Look at the other services that Fluxpoint offer!",
239239
"NA": "N/A",
240240
"Administrator": "Administrator",
241-
"DiscordClientCheck": "Discord client check. Was checking for {discordProcess} (found: {wasFound})"
241+
"DiscordClientCheck": "Discord client check. Was checking for {discordProcess} (found: {wasFound})",
242+
"AdminWarning": "Running MultiRPC with elevated permissions is NOT recommended and is only intended if you can't get any connection without it (Contact us on the discord server and we'll see if we can fix the connection without elevated permissions).\r\n\r\nNote that it's also NOT recommended to have discord open with elevated permissions, only press 'Ok' if this is the only way for a connection"
242243
}

MultiRPC/UI/App.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Application xmlns="https://github.com/avaloniaui"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:system="clr-namespace:System;assembly=System.Runtime"
4+
Name="MultiRPC"
45
x:Class="MultiRPC.UI.App">
56
<Application.Resources>
67
<system:Double x:Key="TextControlThemeMinHeight">28</system:Double>

MultiRPC/UI/MainWindow.axaml.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ public MainWindow() : this(new MainPage())
4444
ToolTipText = Language.GetText(LanguageText.HideMultiRPC),
4545
Command = new TrayCommand()
4646
};
47-
TrayIcon.SetIcons(this, new TrayIcons { trayIcon });
48-
Closing += (sender, args) =>
49-
{
50-
TrayIcon.GetIcons(this)[0].IsVisible = false;
51-
};
47+
Closing += (sender, args) => trayIcon.IsVisible = false;
5248

5349
Language.LanguageChanged += (sender, args) => ChangeTrayIconText(trayIcon);
5450
this.GetObservable(WindowStateProperty).Subscribe(x =>

MultiRPC/UI/MessageBox.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
6+
MaxWidth="410"
67
x:Class="MultiRPC.UI.MessageBox">
78
<Grid RowDefinitions="* Auto" ColumnDefinitions="Auto *">
89
<Image IsVisible="False" x:Name="imgStatus" Margin="21,18,0,0" Width="32" Height="32" HorizontalAlignment="Left" VerticalAlignment="Top"/>

MultiRPC/UI/MessageBox.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private static async Task<MessageBoxResult> Show(string messageBoxText, string m
150150
{
151151
SizeToContent = SizeToContent.WidthAndHeight,
152152
MinHeight = page.MinHeight + 30,
153-
MinWidth = page.MinWidth,
153+
MaxWidth = 410,
154154
Title = messageBoxTitle,
155155
CanResize = true,
156156
WindowStartupLocation = WindowStartupLocation.CenterOwner,

MultiRPC/UI/Pages/Settings/AboutSettingsTab.axaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.ComponentModel;
33
using System.Diagnostics;
44
using System.Reflection;
5+
using System.Runtime.InteropServices;
56
using System.Threading.Tasks;
67
using Avalonia;
78
using Avalonia.Controls;
@@ -11,7 +12,9 @@
1112
using MultiRPC.Discord;
1213
using MultiRPC.Extensions;
1314
using MultiRPC.UI.Controls;
15+
using MultiRPC.Utils;
1416
using TinyUpdate.Core.Extensions;
17+
using TinyUpdate.Core.Helper;
1518

1619
namespace MultiRPC.UI.Pages.Settings
1720
{
@@ -26,6 +29,9 @@ public AboutSettingsTab()
2629
public bool IsDefaultPage => true;
2730
public void Initialize(bool loadXaml)
2831
{
32+
//TODO: Remove Windows check when we add cross platform support for gaining admin mode
33+
btnAdmin.IsEnabled = !AdminUtil.IsAdmin && OSHelper.ActiveOS == OSPlatform.Windows;
34+
2935
tblName.Text += Assembly.GetEntryAssembly().GetSemanticVersion();
3036
var madeByLang = new Language(LanguageText.MadeBy);
3137
madeByLang.TextObservable.Subscribe(x => tblMadeBy.Text = x + ": " + Constants.AppDeveloper);
@@ -83,7 +89,15 @@ private void BtnDonate_OnClick(object? sender, RoutedEventArgs e)
8389
//TODO: Make cross platform
8490
private async void BtnAdmin_OnClick(object? sender, RoutedEventArgs e)
8591
{
86-
//TODO: Add warning
92+
if (await MessageBox.Show(
93+
Language.GetText(LanguageText.AdminWarning),
94+
Language.GetText(LanguageText.MultiRPC),
95+
MessageBoxButton.OkCancel,
96+
MessageBoxImage.Warning) != MessageBoxResult.Ok)
97+
{
98+
return;
99+
}
100+
87101
try
88102
{
89103
var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase.Replace(".dll", ".exe")) //Net Core tell's us the location of the dll, not the exe so we point it back to the exe

0 commit comments

Comments
 (0)