예제 #1
0
        private async Task AlertUserStartWork()
        {
            Debug.WriteLine("INFO: Inform user to start work");

            _lastReminder = DateTimeOffset.Now;
            _vibrate.Vibration();
            _localNotifications.Show("Arbeit beginnen", "Du hast deinen Arbeitsplatz betreten."); //TODO Remove when leaving workplace or starting timer
            //TODO add graphical information
        }
예제 #2
0
        public App()
        {
            // The root page of your application

            ILocalNotifications localNotifications = DependencyService.Get <ILocalNotifications>();

            Button showNotificationButton = new Button();

            showNotificationButton.Text     = "Show Local Notification";
            showNotificationButton.Clicked += (sender, e) => localNotifications.Show("Test", "Local notification alert", 1);

            Button cancelNotificationButton = new Button();

            cancelNotificationButton.Text     = "Cancel Local Notification";
            cancelNotificationButton.Clicked += (sender, e) => localNotifications.Cancel(1);

            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        showNotificationButton,
                        cancelNotificationButton
                    }
                }
            };
        }
예제 #3
0
        public async Task <bool> SaveGameStateAsync(uint slotID)
        {
            var success = false;

            if (CoreRunner == null)
            {
                return(success);
            }

            SaveStateService.SetGameId(GameID);
            using (var stream = await SaveStateService.GetStreamForSlotAsync(slotID, FileAccess.ReadWrite))
            {
                if (stream == null)
                {
                    return(success);
                }

                success = await CoreRunner.SaveGameStateAsync(stream);

                await stream.FlushAsync();
            }

            if (success)
            {
                var notificationTitle = LocalizationService.GetLocalizedString(StateSavedToSlotMessageTitleKey);
                var notificationBody  = string.Format(LocalizationService.GetLocalizedString(StateSavedToSlotMessageBodyKey), slotID);
                NotificationService.Show(notificationTitle, notificationBody);
            }

            return(success);
        }
예제 #4
0
        public async Task <bool> SaveStateAsync(uint slotId, byte[] data)
        {
            if (!AllowOperations)
            {
                return(false);
            }

            OperationInProgress = true;

            var statesFolder = await GetGameSaveStatesFolderAsync();

            var fileName = GenerateSaveFileName(slotId);
            var file     = await statesFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);

            using (var stream = await file.OpenAsync(FileAccess.ReadAndWrite))
            {
                await stream.WriteAsync(data, 0, data.Length);
            }

            var messageTitle = LocalizationService.GetLocalizedString(StateSavedToSlotMessageTitleKey);
            var messageBody  = LocalizationService.GetLocalizedString(StateSavedToSlotMessageBodyKey);

            messageBody = string.Format(messageBody, slotId);
            NotificationService.Show(messageTitle, messageBody);

            OperationInProgress = false;
            return(true);
        }
예제 #5
0
        public App()
        {
            //pokazuje na pasku
            ILocalNotifications localNotifications = DependencyService.Get <ILocalNotifications>();
            Button showNotificationButton          = new Button();

            showNotificationButton.Text     = "Pokaż lokalne powiadomienia";
            showNotificationButton.Clicked +=
                (sender, e) => localNotifications.Show("Test", "Lokalne powiadomienie", 1);
            Button cancelNotificationButton = new Button();

            cancelNotificationButton.Text     = "Przerwij lokalne powiadomienia";
            cancelNotificationButton.Clicked += (sender, e) => localNotifications.Cancel(1);
            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        showNotificationButton,
                        cancelNotificationButton
                    }
                }
            };
        }