From fa17a1442614eace8b643a7b41734940ad12a2bd Mon Sep 17 00:00:00 2001 From: WeylonSantana Date: Thu, 1 Aug 2024 13:18:23 -0300 Subject: [PATCH] rename private methods --- .../Interface/Menu/MainMenuWindow.cs | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/Intersect.Client/Interface/Menu/MainMenuWindow.cs b/Intersect.Client/Interface/Menu/MainMenuWindow.cs index 78ca1e2cd8..48b39641ec 100644 --- a/Intersect.Client/Interface/Menu/MainMenuWindow.cs +++ b/Intersect.Client/Interface/Menu/MainMenuWindow.cs @@ -32,14 +32,14 @@ public MainMenuWindow(Canvas canvas, MainMenu mainMenu) : base(canvas, Strings.M IsTabable = true, Text = Strings.MainMenu.Credits, }; - _buttonCredits.Clicked += ButtonCreditsOnClicked; + _buttonCredits.Clicked += _buttonCredits_Clicked; _buttonExit = new Button(this, nameof(_buttonExit)) { IsTabable = true, Text = Strings.MainMenu.Exit, }; - _buttonExit.Clicked += ButtonExitOnClicked; + _buttonExit.Clicked += _buttonExit_Clicked; _buttonLogin = new Button(this, nameof(_buttonLogin)) { @@ -48,7 +48,7 @@ public MainMenuWindow(Canvas canvas, MainMenu mainMenu) : base(canvas, Strings.M IsTabable = true, Text = Strings.MainMenu.Login, }; - _buttonLogin.Clicked += ButtonLoginOnClicked; + _buttonLogin.Clicked += _buttonLogin_Clicked; _buttonRegister = new Button(this, nameof(_buttonRegister)) { @@ -57,14 +57,14 @@ public MainMenuWindow(Canvas canvas, MainMenu mainMenu) : base(canvas, Strings.M IsTabable = true, Text = Strings.MainMenu.Register, }; - _buttonRegister.Clicked += ButtonRegisterOnClicked; + _buttonRegister.Clicked += _buttonRegister_Clicked; _buttonSettings = new Button(this, nameof(_buttonSettings)) { IsTabable = true, Text = Strings.MainMenu.Settings, }; - _buttonSettings.Clicked += ButtonSettingsOnClicked; + _buttonSettings.Clicked += _buttonSettings_Clicked; if (!string.IsNullOrEmpty(Strings.MainMenu.SettingsTooltip)) { @@ -77,12 +77,12 @@ public MainMenuWindow(Canvas canvas, MainMenu mainMenu) : base(canvas, Strings.M IsVisible = ClientContext.IsSinglePlayer, Text = Strings.MainMenu.Start, }; - _buttonStart.Clicked += ButtonStartOnClicked; + _buttonStart.Clicked += _buttonStart_Clicked; } - private void ButtonCreditsOnClicked(Base sender, ClickedEventArgs arguments) => _mainMenu.SwitchToWindow(); + private void _buttonCredits_Clicked(Base sender, ClickedEventArgs arguments) => _mainMenu.SwitchToWindow(); - private static void ButtonExitOnClicked(Base sender, ClickedEventArgs arguments) + private static void _buttonExit_Clicked(Base sender, ClickedEventArgs arguments) { Log.Info("User clicked exit button."); Globals.IsRunning = false; @@ -90,7 +90,7 @@ private static void ButtonExitOnClicked(Base sender, ClickedEventArgs arguments) #region Login - private void ButtonLoginOnClicked(Base sender, ClickedEventArgs arguments) + private void _buttonLogin_Clicked(Base sender, ClickedEventArgs arguments) { if (Networking.Network.InterruptDisconnectsIfConnected()) { @@ -99,32 +99,32 @@ private void ButtonLoginOnClicked(Base sender, ClickedEventArgs arguments) else { _buttonLogin.IsDisabled = Globals.WaitingOnServer; - AddLoginEvents(); + _addLoginEvents(); Networking.Network.TryConnect(); } } - private void AddLoginEvents() + private void _addLoginEvents() { - MainMenu.ReceivedConfiguration += LoginConnected; - Networking.Network.Socket.ConnectionFailed += LoginConnectionFailed; - Networking.Network.Socket.Disconnected += LoginDisconnected; + MainMenu.ReceivedConfiguration += _loginConnected; + Networking.Network.Socket.ConnectionFailed += _loginConnectionFailed; + Networking.Network.Socket.Disconnected += _loginDisconnected; } - private void RemoveLoginEvents() + private void _removeLoginEvents() { - MainMenu.ReceivedConfiguration -= LoginConnected; - Networking.Network.Socket.ConnectionFailed -= LoginConnectionFailed; - Networking.Network.Socket.Disconnected -= LoginDisconnected; + MainMenu.ReceivedConfiguration -= _loginConnected; + Networking.Network.Socket.ConnectionFailed -= _loginConnectionFailed; + Networking.Network.Socket.Disconnected -= _loginDisconnected; } - private void LoginConnectionFailed(INetworkLayerInterface nli, ConnectionEventArgs args, bool denied) => RemoveLoginEvents(); + private void _loginConnectionFailed(INetworkLayerInterface nli, ConnectionEventArgs args, bool denied) => _removeLoginEvents(); - private void LoginDisconnected(INetworkLayerInterface nli, ConnectionEventArgs args) => RemoveLoginEvents(); + private void _loginDisconnected(INetworkLayerInterface nli, ConnectionEventArgs args) => _removeLoginEvents(); - private void LoginConnected(object? sender, EventArgs eventArgs) + private void _loginConnected(object? sender, EventArgs eventArgs) { - RemoveLoginEvents(); + _removeLoginEvents(); _mainMenu.SwitchToWindow(); } @@ -132,7 +132,7 @@ private void LoginConnected(object? sender, EventArgs eventArgs) #region Register - private void ButtonRegisterOnClicked(Base sender, ClickedEventArgs arguments) + private void _buttonRegister_Clicked(Base sender, ClickedEventArgs arguments) { if (Networking.Network.InterruptDisconnectsIfConnected()) { @@ -141,40 +141,40 @@ private void ButtonRegisterOnClicked(Base sender, ClickedEventArgs arguments) else { _buttonRegister.IsDisabled = Globals.WaitingOnServer; - AddRegisterEvents(); + _addRegisterEvents(); Networking.Network.TryConnect(); } } - private void AddRegisterEvents() + private void _addRegisterEvents() { - MainMenu.ReceivedConfiguration += RegisterConnected; - Networking.Network.Socket.ConnectionFailed += RegisterConnectionFailed; - Networking.Network.Socket.Disconnected += RegisterDisconnected; + MainMenu.ReceivedConfiguration += _registerConnected; + Networking.Network.Socket.ConnectionFailed += _registerConnectionFailed; + Networking.Network.Socket.Disconnected += _registerDisconnected; } - private void RemoveRegisterEvents() + private void _removeRegisterEvents() { - MainMenu.ReceivedConfiguration -= RegisterConnected; - Networking.Network.Socket.ConnectionFailed -= RegisterConnectionFailed; - Networking.Network.Socket.Disconnected -= RegisterDisconnected; + MainMenu.ReceivedConfiguration -= _registerConnected; + Networking.Network.Socket.ConnectionFailed -= _registerConnectionFailed; + Networking.Network.Socket.Disconnected -= _registerDisconnected; } - private void RegisterConnectionFailed(INetworkLayerInterface nli, ConnectionEventArgs args, bool denied) => RemoveRegisterEvents(); + private void _registerConnectionFailed(INetworkLayerInterface nli, ConnectionEventArgs args, bool denied) => _removeRegisterEvents(); - private void RegisterDisconnected(INetworkLayerInterface nli, ConnectionEventArgs args) => RemoveRegisterEvents(); + private void _registerDisconnected(INetworkLayerInterface nli, ConnectionEventArgs args) => _removeRegisterEvents(); - private void RegisterConnected(object? sender, EventArgs eventArgs) + private void _registerConnected(object? sender, EventArgs eventArgs) { - RemoveRegisterEvents(); + _removeRegisterEvents(); _mainMenu.SwitchToWindow(); } #endregion Register - private void ButtonSettingsOnClicked(Base sender, ClickedEventArgs arguments) => _mainMenu.SettingsButton_Clicked(); + private void _buttonSettings_Clicked(Base sender, ClickedEventArgs arguments) => _mainMenu.SettingsButton_Clicked(); - private void ButtonStartOnClicked(Base sender, ClickedEventArgs arguments) + private void _buttonStart_Clicked(Base sender, ClickedEventArgs arguments) { Hide(); Networking.Network.TryConnect();