/// <summary> /// Parses command line and app.config arguments and initilialize log. /// </summary> /// <param name="args">Program arguments</param> /// <param name="thrownOnError">The thrown exception on internal initialization error.</param> /// <param name="options">The additional options.</param> /// <returns>Parsed arguments</returns> public static FlexibleOptions Initialize (string[] args, bool thrownOnError, InitializationOptions options = null) { InitOptions = options; // run default program initialization DefaultProgramInitialization (); // parse command line arguments ProgramOptions = CheckCommandLineParams (args, thrownOnError); // check for help command if (ProgramOptions.Get<bool> ("help", false) || ProgramOptions.Get<bool> ("h", false)) { show_help (""); CloseApplication (0, true); } // display program initialization header if (!Console.IsOutputRedirected) { ConsoleUtils.DisplayHeader ( typeof(ConsoleUtils).Namespace.Replace (".SimpleHelpers", ""), "options: " + (ProgramOptions == null ? "none" : "\n# " + String.Join ("\n# ", ProgramOptions.Options.Select (i => i.Key + "=" + i.Value)))); } else { var logger = GetLogger (); if (logger.IsDebugEnabled) { logger.Debug ("options: " + (ProgramOptions == null ? "none" : "\n# " + String.Join ("\n# ", ProgramOptions.Options.Select (i => i.Key + "=" + i.Value)))); } } return ProgramOptions; }
static void InitializePlatform(ref InitializationOptions options) { // BaseDirectory may not be set in some Mono embedded environments // so try some reasonable fallbacks in these cases. string basePath = AppDomain.CurrentDomain.BaseDirectory; if (!string.IsNullOrEmpty(basePath)) { basePath = Path.Combine(basePath, ".."); } else { basePath = Assembly.GetExecutingAssembly().Location; if (!string.IsNullOrEmpty(basePath)) { basePath = Path.Combine(Path.GetDirectoryName(basePath), ".."); } else { // The executing assembly location may be null if loaded from // memory so the final fallback is the current directory basePath = Path.Combine(Environment.CurrentDirectory, ".."); } } ResourcesPath = Path.Combine(basePath, "Resources"); FrameworksPath = Path.Combine(basePath, "Frameworks"); }
public static Arch Arch; // default: = Arch.DEVICE; unsafe static void InitializePlatform (ref InitializationOptions options) { if (options.IsSimulator) Arch = Arch.SIMULATOR; UIApplication.Initialize (); }
static void Main(string[] args) { var app = new Program(); try { var option = new InitializationOptions(app) { //Using DP without device scaling mode DisplayResolutionUnit = DisplayResolutionUnit.DP(), UseSkiaSharp = true }; Forms.Init(option); if (Device.Idiom == TargetIdiom.TV) { // UIControls.Init() should be called after Forms.Init() UIControls.Init(new InitOptions(app)); CommonUI.Init(app); } else { CommonUI.Init(app); CommonUI.AddCommonThemeOverlay(); } app.Run(args); } catch (Exception e) { Console.WriteLine($"Exception : {e.Message}"); } }
public static FlexibleOptions Initialize (string[] args, bool thrownOnError, InitializationOptions options = null) { InitOptions = options; DefaultProgramInitialization (); ProgramOptions = CheckCommandLineParams (args, thrownOnError); if (ProgramOptions.Get<bool> ("help", false) || ProgramOptions.Get<bool> ("h", false)) { show_help (""); CloseApplication (0, true); } // display program initialization header if (!Console.IsOutputRedirected) { ConsoleUtils.DisplayHeader ( typeof(ConsoleUtils).Namespace.Replace (".SimpleHelpers", ""), "options: " + (ProgramOptions == null ? "none" : "\n# " + String.Join ("\n# ", ProgramOptions.Options.Select (i => i.Key + "=" + i.Value)))); } else { var logger = GetLogger (); if (logger.IsDebugEnabled) { logger.Debug ("options: " + (ProgramOptions == null ? "none" : "\n# " + String.Join ("\n# ", ProgramOptions.Options.Select (i => i.Key + "=" + i.Value)))); } } return ProgramOptions; }
/// <summary> /// [iOS] Initializes OpenAL. Then 16 OpenAL sources will be allocated all at once. You have a maximum of 16 concurrency shared for all sounds. /// It is not possible to initialize again on iOS. (Nothing will happen) /// /// [Android] Initializes OpenSL ES. Then 1 OpenSL ES Engine and a number of AudioPlayer object (and in turn AudioTrack) will be allocated all at once. /// It is possible on Android to initialize again in order to change <paramref name="initializationOptions">. /// /// (More about this limit : https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android) /// (And my own research here : https://gametorrahod.com/androids-native-audio-primer-for-unity-developers-65acf66dd124) /// </summary> public static void Initialize(InitializationOptions initializationOptions) { //Now it is possible to initialize again with different option on Android. It would dispose and reallocate native sources. #if UNITY_IOS if (Initialized) { return; } #endif #if UNITY_IOS int errorCode = _Initialize(); if (errorCode == -1) { throw new System.Exception("There is an error initializing Native Audio."); } //There is also a check at native side but just to be safe here. Initialized = true; #elif UNITY_ANDROID int errorCode = AndroidNativeAudio.CallStatic <int>(AndroidInitialize, initializationOptions.androidAudioTrackCount, initializationOptions.androidMinimumBufferSize, initializationOptions.preserveOnMinimize); if (errorCode == -1) { throw new System.Exception("There is an error initializing Native Audio."); } Initialized = true; #endif }
public static Arch Arch; // default: = Arch.DEVICE; unsafe static void InitializePlatform(ref InitializationOptions options) { if (options.IsSimulator) { Arch = Arch.SIMULATOR; } UIApplication.Initialize(); }
// moved into it's own method to make it easier /safer to be re-written by the linker static void CreateRegistrar (InitializationOptions options) { #if XAMCORE_2_0 Registrar = new DynamicRegistrar (); #else if (options.UseOldDynamicRegistrar) { Registrar = new OldDynamicRegistrar (); } else { Registrar = new DynamicRegistrar (); } #endif }
static void Main(string[] args) { var app = new Program(); var option = new InitializationOptions(app) { DisplayResolutionUnit = DisplayResolutionUnit.DP(true), UseSkiaSharp = true }; Forms.Init(option); app.Run(args); }
public static IServiceCollection AddKumuluzDiscovery(this IServiceCollection services, Action <InitializationOptions> options) { InitializationOptions opt = new InitializationOptions(); options(opt); var discovery = new Discovery(opt); DiscoveryProvider._discovery = discovery; services.AddSingleton(discovery); return(services); }
static void Main(string[] args) { var app = new Program(); var option = new InitializationOptions(app) { DisplayResolutionUnit = DisplayResolutionUnit.Pixel() }; Forms.Init(option); // UIControls.Init() should be called after Forms.Init() UIControls.Init(new InitOptions(app)); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(app); app.Run(args); }
static void Main(string[] args) { var app = new Program(); global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental"); var option = new InitializationOptions(app) { UseDeviceIndependentPixel = true, UseSkiaSharp = true }; global::Xamarin.Forms.Forms.Init(option); app.Run(args); }
// moved into it's own method to make it easier /safer to be re-written by the linker static void CreateRegistrar(InitializationOptions options) { #if XAMCORE_2_0 Registrar = new DynamicRegistrar(); #else if (options.UseOldDynamicRegistrar) { Registrar = new OldDynamicRegistrar(); } else { Registrar = new DynamicRegistrar(); } #endif }
public Discovery(InitializationOptions options) { _logger = options.Logger ?? new NullLogger <Discovery>(); _configOptions = new ConfigOptions(); _configOptions.SetConfigFilePath(options.ConfigFilePath); _configOptions.SetExtensions(options.Extension); _configOptions.SetLogger(_logger); switch (options.Extension) { case Extension.Consul: _discoverySource = new ConsulDiscovery(_configOptions, _logger); break; default: break; } }
protected override void OnCreate(Bundle savedInstanceState) { Profile.Start(); Profile.FrameBegin("Startup"); Profile.FramePartition("CpuUsage.Now"); //__cpuStart = CpuUsage.Now; Profile.FramePartition("AndroidAnticipator.Initialize"); //AndroidAnticipator.Initialize(this); Profile.FramePartition("OnCreate"); base.OnCreate(savedInstanceState); Profile.FramePartition("Forms.SetFlags"); Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental"); //Profile.FramePartition("Essentials.Init"); //Xamarin.Essentials.Platform.Init(this, savedInstanceState); Profile.FramePartition("Forms.Init"); var activation = new InitializationOptions() { Activity = this, Bundle = savedInstanceState, ResourceAssembly = Assembly.GetExecutingAssembly(), Handlers = Exports.Handlers, EffectScopes = null, Flags = InitializationFlags.DisableCss }; Forms.Init(activation); //Forms.Forms.Init(this, savedInstanceState); Profile.FrameEnd("Startup"); Profile.FrameBegin("Create App"); var app = new App(); Profile.FrameEnd("Create App"); Profile.FrameBegin("Render App"); LoadApplication(app); }
static void OnConfigureLifeCycle(ITizenLifecycleBuilder tizen) { tizen.OnPreCreate((app) => { // This is the initial Init to set up any system services registered by // Forms.Init(). This happens before any UI has appeared. // This creates a dummy MauiContext. var services = MauiApplication.Current.Services; MauiContext mauiContext = new MauiContext(services); ActivationState state = new ActivationState(mauiContext); #pragma warning disable CS0612 // Type or member is obsolete var options = services.GetService <InitializationOptions>(); if (options == null) { options = new InitializationOptions(MauiApplication.Current) { DisplayResolutionUnit = TDeviceInfo.DisplayResolutionUnit.ToCompatibility(TDeviceInfo.ViewPortWidth) }; } else { options.Context = options.Context ?? MauiApplication.Current; TDeviceInfo.DisplayResolutionUnit = options.DisplayResolutionUnit.ToDeviceInfo(); } options.Flags |= InitializationFlags.SkipRenderers; Forms.Init(state, options); #pragma warning disable CS0612 // Type or member is obsolete }) .OnMauiContextCreated((mauiContext) => { // This is the final Init that sets up the real context from the application. var state = new ActivationState(mauiContext !); #pragma warning disable CS0612 // Type or member is obsolete Forms.Init(state); #pragma warning disable CS0612 // Type or member is obsolete }); }
static void Main(string[] args) { var app = new Program(); try { var option = new InitializationOptions(app) { //Using DP without device scaling mode DisplayResolutionUnit = DisplayResolutionUnit.DP() }; Forms.Init(option); // UIControls.Init() should be called after Forms.Init() UIControls.Init(new InitOptions(app)); app.Run(args); } catch (Exception e) { System.Console.WriteLine($"Exception : {e.Message}"); } }
public static void Initialize(InitializationOptions initializationOptions) { if (!initialized) { int errorCode; #if UNITY_IOS errorCode = _Initialize(); if (errorCode == -1) { throw new System.Exception("There is an error initializing Native Audio."); } //There is also a check at native side but just to be safe here. initialized = true; #elif UNITY_ANDROID errorCode = AndroidNativeAudio.CallStatic <int>(AndroidInitialize, initializationOptions.androidAudioTrackCount, initializationOptions.androidMinimumBufferSize); if (errorCode == -1) { throw new System.Exception("There is an error initializing Native Audio."); } //There is no check at the native C side so without this and we initialize again it is a crash! initialized = true; #endif } }
public DbInitializer(EarlessContext context, IOptionsMonitor <InitializationOptions> subOptionsAccessor) { this.context = context; options = subOptionsAccessor.CurrentValue; }
/// <summary> /// Log initialization. /// </summary> internal static void InitializeLog(string logFileName = null, string logLevel = null, InitializationOptions options = null) { if (options != null && !options.overrideNLogFileConfiguration && LogManager.Configuration == null) { return; } // default parameters initialization from config file if (String.IsNullOrEmpty(logFileName)) { logFileName = _logFileName ?? System.Configuration.ConfigurationManager.AppSettings["logFilename"]; } if (String.IsNullOrEmpty(logFileName)) { logFileName = ("${basedir}/log/" + typeof(ConsoleUtils).Namespace.Replace(".SimpleHelpers", "") + ".log"); } if (String.IsNullOrEmpty(logLevel)) { logLevel = _logLevel ?? (System.Configuration.ConfigurationManager.AppSettings["logLevel"] ?? "Info"); } // check if log was initialized with same options if (_logFileName == logFileName && _logLevel == logLevel) { return; } // try to parse loglevel LogLevel currentLogLevel; try { currentLogLevel = LogLevel.FromString(logLevel); } catch { currentLogLevel = LogLevel.Info; } // save current log configuration _logFileName = logFileName; _logLevel = currentLogLevel.ToString(); // prepare log configuration var config = new NLog.Config.LoggingConfiguration(); // console output if (!Console.IsOutputRedirected) { var consoleTarget = new NLog.Targets.ColoredConsoleTarget(); consoleTarget.Layout = "${longdate}\t${callsite}\t${level}\t${message}\t${onexception: \\:[Exception] ${exception:format=tostring}}"; config.AddTarget("console", consoleTarget); var rule1 = new NLog.Config.LoggingRule("*", LogLevel.Trace, consoleTarget); config.LoggingRules.Add(rule1); } // file output var fileTarget = new NLog.Targets.FileTarget(); fileTarget.FileName = logFileName; fileTarget.Layout = "${longdate}\t${callsite}\t${level}\t\"${message}${onexception: \t [Exception] ${exception:format=tostring}}\""; fileTarget.ConcurrentWrites = true; fileTarget.ConcurrentWriteAttemptDelay = 10; fileTarget.ConcurrentWriteAttempts = 8; fileTarget.AutoFlush = true; fileTarget.KeepFileOpen = true; fileTarget.DeleteOldFileOnStartup = false; fileTarget.ArchiveAboveSize = 4 * 1024 * 1024; // 4 Mb fileTarget.MaxArchiveFiles = 10; fileTarget.ArchiveNumbering = NLog.Targets.ArchiveNumberingMode.DateAndSequence; fileTarget.ArchiveDateFormat = "yyyyMMdd_HHmmss"; // set file output to be async (commented out since doesn't work on mono) // var wrapper = new NLog.Targets.Wrappers.AsyncTargetWrapper (fileTarget); config.AddTarget("file", fileTarget); // configure log from configuration file var rule2 = new NLog.Config.LoggingRule("*", currentLogLevel, fileTarget); config.LoggingRules.Add(rule2); // External Log Target if (options != null && options.targets != null) { foreach (var t in options.targets) { config.AddTarget(t); config.LoggingRules.Add(new NLog.Config.LoggingRule("*", currentLogLevel, t)); } } // set configuration options LogManager.Configuration = config; }
public SymbolPicker() { InitializationOptions.Initialize(this); DropDownOpened += SymbolPicker_DropDownOpened; }
/// <summary> /// Log initialization. /// </summary> internal static void InitializeLog (string logFileName = null, string logLevel = null, InitializationOptions options = null) { if (options != null && !options.overrideNLogFileConfiguration && LogManager.Configuration == null) return; // default parameters initialization from config file if (String.IsNullOrEmpty (logFileName)) logFileName = _logFileName ?? System.Configuration.ConfigurationManager.AppSettings["logFilename"]; if (String.IsNullOrEmpty (logFileName)) logFileName = ("${basedir}/log/" + typeof (ConsoleUtils).Namespace.Replace (".SimpleHelpers", "") + ".log"); if (String.IsNullOrEmpty (logLevel)) logLevel = _logLevel ?? (System.Configuration.ConfigurationManager.AppSettings["logLevel"] ?? "Info"); // check if log was initialized with same options if (_logFileName == logFileName && _logLevel == logLevel) return; // try to parse loglevel LogLevel currentLogLevel; try { currentLogLevel = LogLevel.FromString (logLevel); } catch { currentLogLevel = LogLevel.Info; } // save current log configuration _logFileName = logFileName; _logLevel = currentLogLevel.ToString (); // prepare log configuration var config = new NLog.Config.LoggingConfiguration (); // console output if (!Console.IsOutputRedirected) { var consoleTarget = new NLog.Targets.ColoredConsoleTarget (); consoleTarget.Layout = "${longdate}\t${callsite}\t${level}\t${message}\t${onexception: \\:[Exception] ${exception:format=tostring}}"; config.AddTarget ("console", consoleTarget); var rule1 = new NLog.Config.LoggingRule ("*", LogLevel.Trace, consoleTarget); config.LoggingRules.Add (rule1); } // file output var fileTarget = new NLog.Targets.FileTarget (); fileTarget.FileName = logFileName; fileTarget.Layout = "${longdate}\t${callsite}\t${level}\t\"${message}${onexception: \t [Exception] ${exception:format=tostring}}\""; fileTarget.ConcurrentWrites = true; fileTarget.ConcurrentWriteAttemptDelay = 10; fileTarget.ConcurrentWriteAttempts = 8; fileTarget.AutoFlush = true; fileTarget.KeepFileOpen = true; fileTarget.DeleteOldFileOnStartup = false; fileTarget.ArchiveAboveSize = 4 * 1024 * 1024; // 4 Mb fileTarget.MaxArchiveFiles = 10; fileTarget.ArchiveNumbering = NLog.Targets.ArchiveNumberingMode.DateAndSequence; fileTarget.ArchiveDateFormat = "yyyyMMdd_HHmmss"; // set file output to be async (commented out since doesn't work on mono) // var wrapper = new NLog.Targets.Wrappers.AsyncTargetWrapper (fileTarget); config.AddTarget ("file", fileTarget); // configure log from configuration file var rule2 = new NLog.Config.LoggingRule ("*", currentLogLevel, fileTarget); config.LoggingRules.Add (rule2); // External Log Target if (options != null && options.targets != null) { foreach (var t in options.targets) { config.AddTarget (t); config.LoggingRules.Add (new NLog.Config.LoggingRule ("*", currentLogLevel, t)); } } // set configuration options LogManager.Configuration = config; }
internal static extern Result FMOD_System_Init(IntPtr systemHandle, int maximumChannels, InitializationOptions initFlag, IntPtr extraData);
/// <summary> /// Log initialization. /// </summary> internal static void InitializeLog (string logFileName = null, string logLevel = null, InitializationOptions initOptions = null, FlexibleOptions appOptions = null) { // default parameters initialization from config file if (String.IsNullOrEmpty (logFileName)) logFileName = _logFileName ?? System.Configuration.ConfigurationManager.AppSettings["logFilename"]; if (String.IsNullOrEmpty (logFileName)) logFileName = ("${basedir}/log/" + typeof (ConsoleUtils).Namespace.Replace (".SimpleHelpers", "") + ".log"); if (String.IsNullOrEmpty (logLevel)) logLevel = _logLevel ?? (System.Configuration.ConfigurationManager.AppSettings["logLevel"] ?? "Info"); // check if log was initialized with same options if (_logFileName == logFileName && _logLevel == logLevel) return; // try to parse loglevel LogLevel currentLogLevel; try { currentLogLevel = LogLevel.FromString (logLevel); } catch { currentLogLevel = LogLevel.Info; } // save current log configuration _logFileName = logFileName; _logLevel = currentLogLevel.ToString (); // check initialization options var localOptions = initOptions != null ? initOptions.Clone () : new InitializationOptions (); // adjust options based on arguments if (appOptions != null) { if (!localOptions.DisableLogFile.HasValue && appOptions.HasOption ("DisableLogFile")) localOptions.DisableLogFile = appOptions.Get ("DisableLogFile", false); if (localOptions.EnableLogTargets == null && !String.IsNullOrEmpty (appOptions.Get ("EnableLogTargets"))) localOptions.EnableLogTargets = appOptions.GetAsList ("EnableLogTargets").Where (i => !String.IsNullOrWhiteSpace (i)).Select (i => i.Trim ()).ToArray (); if (localOptions.DisableLogTargets == null && !String.IsNullOrEmpty (appOptions.Get ("DisableLogTargets"))) localOptions.DisableLogTargets = appOptions.GetAsList ("DisableLogTargets").Where (i => !String.IsNullOrWhiteSpace (i)).Select (i => i.Trim ()).ToArray (); } // prepare list of enabled targets HashSet<string> enabledTargets; // if enabled log targets was provided, use it! if (localOptions.EnableLogTargets != null && localOptions.EnableLogTargets.Count > 0) { enabledTargets = new HashSet<string> (localOptions.EnableLogTargets, StringComparer.OrdinalIgnoreCase); } // else we remove disabled target... else { enabledTargets = new HashSet<string> (StringComparer.OrdinalIgnoreCase) { "console", "file" }; // set enabled targets if (localOptions.Targets != null) { foreach (var i in localOptions.Targets) { foreach (var n in GetNLogTargetName (i)) enabledTargets.Add (n); } } // remove disabled targets if (localOptions.DisableLogTargets != null) foreach (var i in localOptions.DisableLogTargets) enabledTargets.Remove (i); if (localOptions.DisableLogFile ?? false) enabledTargets.Remove ("file"); } // prepare log configuration var config = new NLog.Config.LoggingConfiguration (); // console output if (!Console.IsOutputRedirected && enabledTargets.Contains ("console")) { var consoleTarget = new NLog.Targets.ColoredConsoleTarget (); consoleTarget.Layout = "${longdate}\t${callsite}\t${level}\t${message}\t${onexception: \\:[Exception] ${exception:format=tostring}}"; config.AddTarget ("console", consoleTarget); var rule1 = new NLog.Config.LoggingRule ("*", LogLevel.Trace, consoleTarget); config.LoggingRules.Add (rule1); } // file output if (enabledTargets.Contains ("file")) { var fileTarget = new NLog.Targets.FileTarget (); fileTarget.FileName = logFileName; fileTarget.Layout = "${longdate}\t${callsite}\t${level}\t\"${message}${onexception: \t [Exception] ${exception:format=tostring}}\""; fileTarget.ConcurrentWrites = true; fileTarget.ConcurrentWriteAttemptDelay = 10; fileTarget.ConcurrentWriteAttempts = 8; fileTarget.AutoFlush = true; fileTarget.KeepFileOpen = true; fileTarget.DeleteOldFileOnStartup = false; fileTarget.ArchiveAboveSize = (localOptions.MaxLogFileSize > 0) ? localOptions.MaxLogFileSize : 4 * 1024 * 1024; // 4 Mb fileTarget.MaxArchiveFiles = (localOptions.MaxArchiveLogFiles > 0) ? localOptions.MaxArchiveLogFiles : 10; fileTarget.ArchiveNumbering = NLog.Targets.ArchiveNumberingMode.DateAndSequence; fileTarget.ArchiveDateFormat = "yyyyMMdd"; fileTarget.ArchiveFileName = System.IO.Path.ChangeExtension (logFileName, ".{#}" + System.IO.Path.GetExtension (logFileName)); // set file output to be async (commented out since doesn't work well on mono) // var wrapper = new NLog.Targets.Wrappers.AsyncTargetWrapper (fileTarget); config.AddTarget ("file", fileTarget); // configure log from configuration file var rule2 = new NLog.Config.LoggingRule ("*", currentLogLevel, fileTarget); config.LoggingRules.Add (rule2); } // External Log Target if (localOptions.Targets != null) { foreach (var t in localOptions.Targets) { if (GetNLogTargetName (t).Any (i => enabledTargets.Contains (i))) { config.AddTarget (t); config.LoggingRules.Add (new NLog.Config.LoggingRule ("*", currentLogLevel, t)); } } } // set configuration options LogManager.Configuration = config; }
/// <summary> /// Initializes log with initialization options. /// </summary> /// <param name="options">The options.</param> internal static void InitializeLog (InitializationOptions options) { InitializeLog (null, null, options, ProgramOptions); }
protected override void OnCreate(Bundle savedInstanceState) { Profile.Start(); Profile.FrameBegin("ignore"); Profile.FrameEnd(); Profile.FrameBegin("OnResume-OnCreate"); Profile.FrameBegin("OnCreate"); { Profile.FramePartition("base.OnCreate"); { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); } Profile.FramePartition("Forms.Init"); { App.AppName = "XFFastUp"; Forms.SetFlags("FastRenderers_Experimental"); switch (Init) { case InitType.Explicit: var activation = new InitializationOptions() { Activity = this, Bundle = savedInstanceState, ResourceAssembly = Assembly.GetExecutingAssembly(), Handlers = Exports.Handlers, EffectScopes = null, Flags = InitializationFlags.DisableCss }; Forms.Init(activation); break; case InitType.Async: var re = new AutoResetEvent(false); var init = new Thread(() => { Forms.Init(this, savedInstanceState, Assembly.GetExecutingAssembly()); re.Set(); }); init.Start(); re.WaitOne(); break; default: Forms.Init(this, savedInstanceState, Assembly.GetExecutingAssembly()); break; } } App app; Profile.FramePartition("new App()"); { app = new App(); } Profile.FramePartition("LoadApplication()"); { LoadApplication(app); } } Profile.FrameEnd(); // OnCreate }
internal static async Task <TestLspServer> CreateAsync(TestWorkspace testWorkspace, InitializationOptions initializationOptions) { var locations = await GetAnnotatedLocationsAsync(testWorkspace, testWorkspace.CurrentSolution); var server = new TestLspServer(testWorkspace, locations, initializationOptions.ClientCapabilities, initializationOptions.ServerKind); await server.ExecuteRequestAsync <LSP.InitializeParams, LSP.InitializeResult>(LSP.Methods.InitializeName, new LSP.InitializeParams { Capabilities = initializationOptions.ClientCapabilities, }, CancellationToken.None); return(server); }
public SplitHighlightPicker() { //InitializeComponent(); InitializationOptions.Initialize(this); }
private static async Task <TestLspServer> CreateTestLspServerAsync(TestWorkspace workspace, InitializationOptions initializationOptions) { var solution = workspace.CurrentSolution; foreach (var document in workspace.Documents) { if (document.IsSourceGenerated) { continue; } solution = solution.WithDocumentFilePath(document.Id, "C:\\" + document.Name); var documentText = await solution.GetRequiredDocument(document.Id).GetTextAsync(CancellationToken.None); solution = solution.WithDocumentText(document.Id, SourceText.From(documentText.ToString(), System.Text.Encoding.UTF8)); } foreach (var project in workspace.Projects) { // Ensure all the projects have a valid file path. solution = solution.WithProjectFilePath(project.Id, "C:\\" + project.Name); } solution = solution.WithAnalyzerReferences(new[] { new TestAnalyzerReferenceByLanguage(DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap()) }); workspace.ChangeSolution(solution); // Important: We must wait for workspace creation operations to finish. // Otherwise we could have a race where workspace change events triggered by creation are changing the state // created by the initial test steps. This can interfere with the expected test state. var operations = workspace.ExportProvider.GetExportedValue <AsynchronousOperationListenerProvider>(); var workspaceWaiter = operations.GetWaiter(FeatureAttribute.Workspace); await workspaceWaiter.ExpeditedWaitAsync(); return(await TestLspServer.CreateAsync(workspace, initializationOptions)); }
public void Initialize(int maximumChannels, InitializationOptions flags, IntPtr extraData) { isInitialized = true; currentResult = NativeMethods.FMOD_System_Init(handle, maximumChannels, flags, extraData); }
public SplitBorderSelector() { //InitializeComponent(); InitializationOptions.Initialize(this); }
// moved into it's own method to make it easier /safer to be re-written by the linker static void CreateRegistrar(InitializationOptions options) { Registrar = new DynamicRegistrar(); }
public SplitColorPicker() { //InitializeComponent(); //Loaded += SplitColorPicker_Loaded; InitializationOptions.Initialize(this, SplitColorPicker_Loaded); }