Use file-scoped namespace
This commit is contained in:
@@ -5,3 +5,7 @@
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.cs]
|
||||
|
||||
# Namespace preferences
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace Mopups.Interfaces
|
||||
namespace Mopups.Interfaces;
|
||||
|
||||
public interface IPopupNavigation
|
||||
{
|
||||
public interface IPopupNavigation
|
||||
{
|
||||
event EventHandler<PopupPage> Pushing;
|
||||
|
||||
event EventHandler<PopupPage> Pushed;
|
||||
@@ -21,5 +21,4 @@ namespace Mopups.Interfaces
|
||||
Task PopAllAsync();
|
||||
|
||||
Task RemovePageAsync(PopupPage page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace Mopups.Interfaces
|
||||
namespace Mopups.Interfaces;
|
||||
|
||||
public interface IPopupPlatform
|
||||
{
|
||||
public interface IPopupPlatform
|
||||
{
|
||||
Task AddAsync(PopupPage page);
|
||||
|
||||
Task RemoveAsync(PopupPage page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using AsyncAwaitBestPractices;
|
||||
using Mopups.Services;
|
||||
|
||||
namespace Mopups.Pages
|
||||
namespace Mopups.Pages;
|
||||
|
||||
public partial class PopupPage : ContentPage
|
||||
{
|
||||
public partial class PopupPage : ContentPage
|
||||
{
|
||||
|
||||
public event EventHandler? BackgroundClicked;
|
||||
|
||||
@@ -74,5 +74,4 @@ namespace Mopups.Pages
|
||||
MopupService.Instance.RemovePageAsync(this).SafeFireAndForget();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Android.Views;
|
||||
|
||||
namespace Mopups.Droid.Gestures
|
||||
namespace Mopups.Droid.Gestures;
|
||||
|
||||
internal class MopupGestureDetectorListener : GestureDetector.SimpleOnGestureListener
|
||||
{
|
||||
internal class MopupGestureDetectorListener : GestureDetector.SimpleOnGestureListener
|
||||
{
|
||||
public event EventHandler<MotionEvent>? Clicked;
|
||||
|
||||
public override bool OnSingleTapUp(MotionEvent? e)
|
||||
@@ -12,5 +12,4 @@ namespace Mopups.Droid.Gestures
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
|
||||
using Mopups.Pages;
|
||||
|
||||
using Mopups.Pages;
|
||||
namespace Mopups.Droid.Extension;
|
||||
|
||||
namespace Mopups.Droid.Extension
|
||||
internal static class PlatformExtension
|
||||
{
|
||||
internal static class PlatformExtension
|
||||
{
|
||||
public static IViewHandler GetOrCreateHandler(this VisualElement bindable)
|
||||
{
|
||||
try
|
||||
{
|
||||
return bindable.Handler ??= new PopupPageHandler();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ using Mopups.Interfaces;
|
||||
using Mopups.Pages;
|
||||
using Mopups.Services;
|
||||
|
||||
namespace Mopups.Droid.Implementation
|
||||
namespace Mopups.Droid.Implementation;
|
||||
|
||||
public class AndroidMopups : IPopupPlatform
|
||||
{
|
||||
public class AndroidMopups : IPopupPlatform
|
||||
{
|
||||
|
||||
private static FrameLayout? DecoreView => Platform.CurrentActivity.Window.DecorView as FrameLayout;
|
||||
|
||||
@@ -88,5 +88,4 @@ namespace Mopups.Droid.Implementation
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform;
|
||||
using Mopups.Droid.Gestures;
|
||||
|
||||
namespace Mopups.Pages
|
||||
namespace Mopups.Pages;
|
||||
|
||||
public class PopupPageHandler : ContentViewHandler
|
||||
{
|
||||
public class PopupPageHandler : ContentViewHandler
|
||||
{
|
||||
private readonly MopupGestureDetectorListener _gestureDetectorListener;
|
||||
private readonly GestureDetector _gestureDetector;
|
||||
private DateTime _downTime;
|
||||
@@ -30,7 +30,7 @@ namespace Mopups.Pages
|
||||
ForceHandlerPauseWaitForVirtualView();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ namespace Mopups.Pages
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
@@ -216,13 +216,10 @@ namespace Mopups.Pages
|
||||
|
||||
//base.OnLayout(changed, l, t, r, b);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Mopups.Interfaces;
|
||||
|
||||
namespace Mopups.Services
|
||||
namespace Mopups.Services;
|
||||
|
||||
public static class MopupService
|
||||
{
|
||||
public static class MopupService
|
||||
{
|
||||
static IPopupNavigation? _customNavigation;
|
||||
static readonly Lazy<IPopupNavigation> implementation = new(() => CreatePopupNavigation(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace Mopups.Services
|
||||
|
||||
internal static Exception NotImplementedInReferenceAssembly() =>
|
||||
new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
|
||||
using AsyncAwaitBestPractices;
|
||||
|
||||
|
||||
using AsyncAwaitBestPractices;
|
||||
using Mopups.Interfaces;
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace Mopups.Services
|
||||
namespace Mopups.Services;
|
||||
|
||||
public class PopupNavigation : IPopupNavigation
|
||||
{
|
||||
public class PopupNavigation : IPopupNavigation
|
||||
{
|
||||
private readonly object _locker = new();
|
||||
|
||||
public IReadOnlyList<PopupPage> PopupStack => _popupStack;
|
||||
@@ -112,5 +109,4 @@ namespace Mopups.Services
|
||||
Popped?.Invoke(this, page);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
|
||||
//using Demo.Pages;
|
||||
|
||||
//using Demo.Pages;
|
||||
using SampleMaui.CSharpMarkup;
|
||||
|
||||
using Application = Microsoft.Maui.Controls.Application;
|
||||
|
||||
[assembly: XamlCompilation(XamlCompilationOptions.Skip)]
|
||||
namespace SampleMaui
|
||||
namespace SampleMaui;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
MainPage = new MainPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
|
||||
using Mopups.Pages;
|
||||
using Mopups.Pages;
|
||||
using Mopups.Services;
|
||||
using ScrollView = Microsoft.Maui.Controls.ScrollView;
|
||||
|
||||
namespace SampleMaui.CSharpMarkup;
|
||||
|
||||
namespace SampleMaui.CSharpMarkup
|
||||
public partial class LoginPage : PopupPage
|
||||
{
|
||||
public partial class LoginPage : PopupPage
|
||||
{
|
||||
public Frame FrameContainer { get; set; }
|
||||
public Image DotNetBotImage { get; set; }
|
||||
|
||||
public Entry UsernameEntry { get; set; }
|
||||
public Entry PasswordEntry { get; set; }
|
||||
|
||||
public Microsoft.Maui.Controls.Button LoginButton { get; set; }
|
||||
public Button LoginButton { get; set; }
|
||||
protected void BuildContent()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
this.Content = new ScrollView
|
||||
{
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
@@ -51,6 +45,7 @@ namespace SampleMaui.CSharpMarkup
|
||||
};
|
||||
return FrameContainer;
|
||||
}
|
||||
|
||||
private StackLayout GenerateFrameContainerContent()
|
||||
{
|
||||
var frameContainerContent = new StackLayout
|
||||
@@ -77,8 +72,8 @@ namespace SampleMaui.CSharpMarkup
|
||||
{
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
Placeholder = "Username",
|
||||
PlaceholderColor = Microsoft.Maui.Graphics.Color.FromHex("#FF9CDAF1"),
|
||||
TextColor = Microsoft.Maui.Graphics.Color.FromHex("#FF7DBBE6")
|
||||
PlaceholderColor = Color.FromHex("#FF9CDAF1"),
|
||||
TextColor = Color.FromHex("#FF7DBBE6")
|
||||
};
|
||||
|
||||
PasswordEntry = new Entry
|
||||
@@ -86,18 +81,14 @@ namespace SampleMaui.CSharpMarkup
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
IsPassword = true,
|
||||
Placeholder = "Password",
|
||||
PlaceholderColor = Microsoft.Maui.Graphics.Color.FromHex("#FF9CDAF1"),
|
||||
TextColor = Microsoft.Maui.Graphics.Color.FromHex("#FF7DBBE6")
|
||||
PlaceholderColor = Color.FromHex("#FF9CDAF1"),
|
||||
TextColor = Color.FromHex("#FF7DBBE6")
|
||||
};
|
||||
|
||||
LoginButton = new Button
|
||||
{
|
||||
Command = new Command(() => MopupService.Instance.PopAllAsync())
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
//frameContainerContent.Add(DotNetBotImage);
|
||||
frameContainerContent.Add(UsernameEntry);
|
||||
@@ -106,5 +97,4 @@ namespace SampleMaui.CSharpMarkup
|
||||
|
||||
return frameContainerContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
|
||||
using Mopups.Pages;
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace SampleMaui.CSharpMarkup
|
||||
namespace SampleMaui.CSharpMarkup;
|
||||
|
||||
public partial class LoginPage : PopupPage
|
||||
{
|
||||
public partial class LoginPage : PopupPage
|
||||
{
|
||||
public LoginPage()
|
||||
{
|
||||
BuildContent();
|
||||
|
||||
}
|
||||
|
||||
protected override bool OnBackgroundClicked()
|
||||
{
|
||||
return base.OnBackgroundClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
|
||||
using AsyncAwaitBestPractices.MVVM;
|
||||
using AsyncAwaitBestPractices.MVVM;
|
||||
using Mopups.Pages;
|
||||
using Mopups.Services;
|
||||
using Button = Microsoft.Maui.Controls.Button;
|
||||
using ScrollView = Microsoft.Maui.Controls.ScrollView;
|
||||
|
||||
namespace SampleMaui.CSharpMarkup
|
||||
namespace SampleMaui.CSharpMarkup;
|
||||
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
protected void BuildContent()
|
||||
{
|
||||
BackgroundColor = Color.FromRgb(255, 255, 255);
|
||||
@@ -58,8 +57,4 @@ namespace SampleMaui.CSharpMarkup
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Mopups.Services;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SampleMaui.CSharpMarkup
|
||||
namespace SampleMaui.CSharpMarkup;
|
||||
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
BuildContent();
|
||||
@@ -19,5 +19,4 @@ namespace SampleMaui.CSharpMarkup
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Mopups.Hosting;
|
||||
|
||||
namespace SampleMaui
|
||||
namespace SampleMaui;
|
||||
|
||||
public static class MauiProgram
|
||||
{
|
||||
public static class MauiProgram
|
||||
{
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
@@ -18,5 +18,4 @@ namespace SampleMaui
|
||||
//Work out how to register this as a singleton
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
|
||||
namespace SampleMaui
|
||||
namespace SampleMaui;
|
||||
|
||||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace SampleMaui
|
||||
namespace SampleMaui;
|
||||
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
@@ -16,5 +16,4 @@ namespace SampleMaui
|
||||
{
|
||||
return MauiProgram.CreateMauiApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user