зеркало из https://github.com/DeGsoft/maui-linux.git
WPF GTK Set flags (#8446)
* WPF GTK Set flags * Remove collection view flag
This commit is contained in:
Родитель
05842158a0
Коммит
c522540a41
|
@ -21,6 +21,7 @@ namespace Xamarin.Forms.ControlGallery.GTK
|
|||
GtkOpenGL.Init();
|
||||
GtkThemes.Init();
|
||||
Gtk.Application.Init();
|
||||
Forms.SetFlags("CarouselView_Experimental");
|
||||
FormsMaps.Init(string.Empty);
|
||||
Forms.Init();
|
||||
var app = new App();
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Xamarin.Forms.ControlGallery.WPF
|
|||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Forms.SetFlags("CarouselView_Experimental");
|
||||
Xamarin.Forms.Forms.Init();
|
||||
FormsMaps.Init("");
|
||||
LoadApplication(new Controls.App());
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
@ -15,6 +16,10 @@ namespace Xamarin.Forms
|
|||
const string LogFormat = "[{0}] {1}";
|
||||
|
||||
public static bool IsInitialized { get; private set; }
|
||||
static bool FlagsSet { get; set; }
|
||||
|
||||
static IReadOnlyList<string> s_flags;
|
||||
public static IReadOnlyList<string> Flags => s_flags ?? (s_flags = new List<string>().AsReadOnly());
|
||||
|
||||
public static void Init(IEnumerable<Assembly> rendererAssemblies = null)
|
||||
{
|
||||
|
@ -25,9 +30,8 @@ namespace Xamarin.Forms
|
|||
|
||||
Registrar.ExtraAssemblies = rendererAssemblies?.ToArray();
|
||||
|
||||
IsInitialized = true;
|
||||
|
||||
Device.SetIdiom(TargetIdiom.Desktop);
|
||||
Device.SetFlags(s_flags);
|
||||
Device.PlatformServices = new GtkPlatformServices();
|
||||
Device.Info = new GtkDeviceInfo();
|
||||
Color.SetAccent(Color.FromHex("#3498DB"));
|
||||
|
@ -39,6 +43,24 @@ namespace Xamarin.Forms
|
|||
typeof(ExportImageSourceHandlerAttribute),
|
||||
typeof(ExportRendererAttribute)
|
||||
});
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
||||
public static void SetFlags(params string[] flags)
|
||||
{
|
||||
if (FlagsSet)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(SetFlags)} must be called before {nameof(Init)}");
|
||||
}
|
||||
|
||||
s_flags = flags.ToList().AsReadOnly();
|
||||
FlagsSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,11 @@ namespace Xamarin.Forms
|
|||
{
|
||||
public static bool IsInitialized { get; private set; }
|
||||
|
||||
static bool FlagsSet { get; set; }
|
||||
|
||||
static IReadOnlyList<string> s_flags;
|
||||
public static IReadOnlyList<string> Flags => s_flags ?? (s_flags = new List<string>().AsReadOnly());
|
||||
|
||||
public static void Init(IEnumerable<Assembly> rendererAssemblies = null)
|
||||
{
|
||||
if (IsInitialized)
|
||||
|
@ -36,11 +41,28 @@ namespace Xamarin.Forms
|
|||
ExpressionSearch.Default = new WPFExpressionSearch();
|
||||
|
||||
Registrar.RegisterAll(new[] { typeof(ExportRendererAttribute), typeof(ExportCellAttribute), typeof(ExportImageSourceHandlerAttribute) });
|
||||
|
||||
|
||||
Ticker.SetDefault(new WPFTicker());
|
||||
Device.SetIdiom(TargetIdiom.Desktop);
|
||||
Device.SetFlags(s_flags);
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
||||
public static void SetFlags(params string[] flags)
|
||||
{
|
||||
if (FlagsSet)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(SetFlags)} must be called before {nameof(Init)}");
|
||||
}
|
||||
|
||||
s_flags = flags.ToList().AsReadOnly();
|
||||
FlagsSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче