protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; MessagingCenter.Subscribe <ViewModels.StreamPageViewModel>(this, "landscape", sender => { LockRotation(Orientation.Horizontal); }); MessagingCenter.Subscribe <ViewModels.StreamPageViewModel>(this, "portrait", sender => { LockRotation(Orientation.Vertical); }); Popup.Init(this, savedInstanceState); Forms.Init(this, savedInstanceState); AuthenticationConfiguration.Init(this, savedInstanceState); if (ApplicationContext.GetSystemService(WifiService) is WifiManager wifiManager) { WifiLock = wifiManager.CreateWifiLock(WifiMode.FullHighPerf, WifiTag); WifiLock.SetReferenceCounted(false); WifiLock.Acquire(); } LoadApplication(new App()); }
protected override void OnCreate(Bundle savedInstanceState) { AppCenter.Start("b17f9c9d-e90c-488f-8c4b-92ef3e305c0d", typeof(Analytics), typeof(Distribute)); var versionInfo = Application.Context.ApplicationContext?.PackageManager?.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0); //var username = System.Security.Principal.WindowsIdentity.GetCurrent(); SentryXamarin.Init(o => { o.AddXamarinFormsIntegration(); o.Dsn = "https://[email protected]/5390642"; o.Release = $"TacControl@{versionInfo?.VersionName}:{versionInfo?.LongVersionCode}"; o.Environment = //username == "Dedmen-PC\\dedmen" ? "Dev" : "Alpha"; }); WifiManager wifiMgr = (WifiManager)ApplicationContext.GetSystemService(Context.WifiService); wifiLock = wifiMgr.CreateWifiLock(WifiMode.Full, "TacControl-udp"); wifiLock.SetReferenceCounted(true); wifiLock.Acquire(); castLock = wifiMgr.CreateMulticastLock("TacControl-udp"); castLock.SetReferenceCounted(true); castLock.Acquire(); ConnectivityManager conMgr = (ConnectivityManager)ApplicationContext.GetSystemService(Context.ConnectivityService); var stuff = conMgr.GetAllNetworks(); var wifiNet = stuff.FirstOrDefault(x => conMgr.GetNetworkInfo(x).Type == ConnectivityType.Wifi); if (wifiNet != null) { var res = conMgr.BindProcessToNetwork(wifiNet); var info = conMgr.GetNetworkInfo(wifiNet); var connInfo = wifiMgr.ConnectionInfo; } //Networking.ConnectionInfo TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); Android.Views.Window window = Window; window.AddFlags(WindowManagerFlags.KeepScreenOn); window.AddFlags(WindowManagerFlags.Fullscreen); LoadApplication(new App((action) => { TaskCompletionSource <object> tcs = new TaskCompletionSource <object>(); bool isMain = MainThread.IsMainThread; RunOnUiThread(() => { try { action(); tcs.SetResult(null); } catch (Exception ex) { tcs.SetException(ex); } }); return(tcs.Task); })); }