コード例 #1
0
ファイル: App.xaml.cs プロジェクト: JumpAttacker/JMangaReader
 public App()
 {
     DependencyService.Register <MockDataStore>();
     DependencyService.Register <ReadMangaScrapper>();
     InitializeComponent();
     MainPage = new MainPage();
     Registrations.Start("JMangaParser");
 }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: albilaga/akavachetest
 public App()
 {
     InitializeComponent();
     Registrations.Start("TEST");
     //var token = GetToken().Result;
     //MainPage = new MainPage();
     SetMainPage();
 }
コード例 #3
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method
            BlobCache.ApplicationName = "MyRegisterApp";
            Registrations.Start("MyRegisterApp");

            return(true);
        }
コード例 #4
0
 public MainPage()
 {
     InitializeComponent();
     Task.Run(() =>
     {
         Registrations.Start(Guid.NewGuid().ToString());
         foreach (var workItem in _workItems.GetConsumingEnumerable())
         {
             workItem();
         }
     });
 }
コード例 #5
0
        public ItemsPage()
        {
            InitializeComponent();

            BlobCache.ApplicationName = "BDD";
            BlobCache.EnsureInitialized();
            Registrations.Start("BDD");

            BindingContext = viewModel = new ItemsViewModel();

            getDataInBDD();
            GetData();

            Device.StartTimer(TimeSpan.FromSeconds(30), () =>
            {
                var shouldTimerContinueWork = true;
                GetData();
                return(shouldTimerContinueWork);
            });
        }
コード例 #6
0
        /// <summary>
        /// Check if cache have saved data. If have, then start to default main activity
        /// </summary>
        /// <returns>Task</returns>
        private async Task CheckIfDBCached()
        {
            try
            {
                RunOnUiThread(() => {
                    debugTextView.SetText("check cache", TextView.BufferType.Normal);
                });
                Registrations.Start("WarThinderVersusAkavacheCache");
                var arrayOfPlanesCached = await BlobCache.UserAccount.GetObject <ArrayOfPlanes>("cachedArrayOfPlanes");

                var arrayOfTanksCached = await BlobCache.UserAccount.GetObject <ArrayOfPlanes>("cachedArrayOfTanks");

                var arrayOfHelisCached = await BlobCache.UserAccount.GetObject <ArrayOfPlanes>("cachedArrayOfHelis");

                var arrayOfShipsCached = await BlobCache.UserAccount.GetObject <ArrayOfPlanes>("cachedArrayOfShips");

                MoveToNextActivity();
            }
            catch (KeyNotFoundException ex)
            {
                RunOnUiThread(() => {
                    debugTextView.SetText("cache failed", TextView.BufferType.Normal);
                    AlertDialogWhenDataLoading();
                });
                await Task.Run(() => GetPlanesListFromApiAsync());

                await Task.Run(() => GetTanksListFromApiAsync());

                await Task.Run(() => GetHelisListFromApiAsync());

                await Task.Run(() => GetShipsListFromApiAsync());

                Task.WaitAll();
                MoveToNextActivity();
            }
        }
コード例 #7
0
 protected override void OnStart() =>
 Registrations.Start(nameof(Template));
コード例 #8
0
ファイル: App.xaml.cs プロジェクト: patel-pragnesh/XamarinNIC
        protected override void OnStart()
        {
            Registrations.Start("XamarinJKH");

            int theme = Preferences.Get("Theme", 0);

            //только темная тема в ios
            //if (Xamarin.Essentials.DeviceInfo.Platform == DevicePlatform.iOS)
            //    theme = Preferences.Get("Theme", 1);

            switch (theme)
            {
            case 0:
                switch (Settings.MobileSettings.appTheme)
                {
                case "": Current.UserAppTheme = OSAppTheme.Unspecified;  break;

                case "light": Current.UserAppTheme = OSAppTheme.Light; break;

                case "dark": Current.UserAppTheme = OSAppTheme.Dark; break;
                }
                break;

                break;

            case 1:
                Current.UserAppTheme = OSAppTheme.Dark;
                break;

            case 2:
                Current.UserAppTheme = OSAppTheme.Light;
                break;
            }



            AppCenter.Start("android=4384b8c4-8639-411c-b011-9d9e8408acde;ios=4a45a15f-a591-4860-b748-a856636cf982;", typeof(Analytics), typeof(Crashes));
            //AppCenter.Start("39dce15b-0d85-46a2-bf90-a28af9fb8795", typeof(Analytics), typeof(Crashes)); //тихая гавань иос
            AppCenter.LogLevel = LogLevel.Verbose;



            // Handle when your app starts
            CrossFirebasePushNotification.Current.Subscribe("general");
            CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine($"TOKEN REC: {p.Token}");
            };
            System.Diagnostics.Debug.WriteLine($"TOKEN: {CrossFirebasePushNotification.Current.Token}");

            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {
                try
                {
                    System.Diagnostics.Debug.WriteLine("Received");
                    if (p.Data.ContainsKey("body"))
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            System.Diagnostics.Debug.WriteLine($"{p.Data["body"]}");
                        });
                    }

                    if (p.Data.ContainsKey("aps.alert.body"))
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            System.Diagnostics.Debug.WriteLine($"{p.Data["aps.alert.body"]}");
                        });
                    }
                }
                catch (Exception ex)
                {
                }
            };

            CrossFirebasePushNotification.Current.OnNotificationOpened += (s, rea) =>
            {
                //System.Diagnostics.Debug.WriteLine(p.Identifier);

                System.Diagnostics.Debug.WriteLine("Opened");
                foreach (var data in rea.Data)
                {
                    System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
                }

                if (!string.IsNullOrEmpty(rea.Identifier))
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        // MainPage.Message = p.Identifier;
                        System.Diagnostics.Debug.WriteLine("123");
                    });
                }
                else if (rea.Data.ContainsKey("color"))
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        MainPage.Navigation.PushAsync(new ContentPage()
                        {
                            BackgroundColor = Color.FromHex($"{rea.Data["color"]}")
                        });
                    });
                }
                else if (rea.Data.ContainsKey("aps.alert.title"))
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        // MainPage.Message = $"{p.Data["aps.alert.title"]}";
                        System.Diagnostics.Debug.WriteLine($"Пушшшш2 ==== {rea.Data["aps.alert.title"]}");
                    });
                }
            };

            CrossFirebasePushNotification.Current.OnNotificationAction += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine("Action");

                if (!string.IsNullOrEmpty(p.Identifier))
                {
                    System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}");
                    foreach (var data in p.Data)
                    {
                        System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
                    }
                }
            };

            CrossFirebasePushNotification.Current.OnNotificationDeleted += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine("Dismissed");
            };
        }
コード例 #9
0
 public AkavacheCacheHandler()
 {
     Registrations.Start($"DCMS.Client.{nameof(AkavacheCacheHandler)}");
 }
コード例 #10
0
 public void Start()
 => Registrations.Start(AppInfo.Name);
コード例 #11
0
 public AkavacheCacheHandler()
 {
     Registrations.Start($"{nameof(Apizr)}{nameof(AkavacheCacheHandler)}");
 }