Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix application trigger issue and update time trigger text #718

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ void ApplicationTriggerTask::OnNavigatedTo(NavigationEventArgs^ e)
{
BackgroundTaskSample::UpdateBackgroundTaskRegistrationStatus(task->Name, true);
AttachProgressAndCompletedHandlers(task);
trigger = ref new ApplicationTrigger();
break;
}
}

trigger = ref new ApplicationTrigger();
UpdateUI();
}

Expand All @@ -76,6 +76,7 @@ void ApplicationTriggerTask::AttachProgressAndCompletedHandlers(IBackgroundTaskR
/// <param name="e"></param>
void ApplicationTriggerTask::RegisterBackgroundTask(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
trigger = ref new ApplicationTrigger();
auto task = BackgroundTaskSample::RegisterBackgroundTask(SampleBackgroundTaskEntryPoint,
ApplicationTriggerTaskName,
trigger,
Expand All @@ -93,6 +94,7 @@ void ApplicationTriggerTask::UnregisterBackgroundTask(Platform::Object^ sender,
{
BackgroundTaskSample::UnregisterBackgroundTasks(ApplicationTriggerTaskName);
BackgroundTaskSample::ApplicationTriggerTaskResult = "";
trigger = nullptr;
UpdateUI();
}

Expand Down Expand Up @@ -153,7 +155,7 @@ void ApplicationTriggerTask::UpdateUI()
{
RegisterButton->IsEnabled = !BackgroundTaskSample::ApplicationTriggerTaskRegistered;
UnregisterButton->IsEnabled = BackgroundTaskSample::ApplicationTriggerTaskRegistered;
SignalButton->IsEnabled = BackgroundTaskSample::ApplicationTriggerTaskRegistered & (trigger != nullptr);
SignalButton->IsEnabled = BackgroundTaskSample::ApplicationTriggerTaskRegistered && (trigger != nullptr);
Progress->Text = BackgroundTaskSample::ApplicationTriggerTaskProgress;
Result->Text = BackgroundTaskSample::ApplicationTriggerTaskResult;
Status->Text = BackgroundTaskSample::GetBackgroundTaskStatus(ApplicationTriggerTaskName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
{
AttachProgressAndCompletedHandlers(task.Value);
BackgroundTaskSample.UpdateBackgroundTaskRegistrationStatus(BackgroundTaskSample.ApplicationTriggerTaskName, true);
trigger = new ApplicationTrigger();
break;
}
}

trigger = new ApplicationTrigger();
UpdateUI();
}

Expand All @@ -67,6 +67,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
/// <param name="e"></param>
private void RegisterBackgroundTask(object sender, RoutedEventArgs e)
{
trigger = new ApplicationTrigger();
var task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.SampleBackgroundTaskEntryPoint,
BackgroundTaskSample.ApplicationTriggerTaskName,
trigger,
Expand All @@ -84,6 +85,7 @@ private void UnregisterBackgroundTask(object sender, RoutedEventArgs e)
{
BackgroundTaskSample.UnregisterBackgroundTasks(BackgroundTaskSample.ApplicationTriggerTaskName);
BackgroundTaskSample.ApplicationTriggerTaskResult = "";
trigger = null;
UpdateUI();
}

Expand Down Expand Up @@ -149,7 +151,7 @@ private async void UpdateUI()
{
RegisterButton.IsEnabled = !BackgroundTaskSample.ApplicationTriggerTaskRegistered;
UnregisterButton.IsEnabled = BackgroundTaskSample.ApplicationTriggerTaskRegistered;
SignalButton.IsEnabled = BackgroundTaskSample.ApplicationTriggerTaskRegistered & (trigger != null);
SignalButton.IsEnabled = BackgroundTaskSample.ApplicationTriggerTaskRegistered && (trigger != null);
Progress.Text = BackgroundTaskSample.ApplicationTriggerTaskProgress;
Result.Text = BackgroundTaskSample.ApplicationTriggerTaskResult;
Status.Text = BackgroundTaskSample.GetBackgroundTaskStatus(BackgroundTaskSample.ApplicationTriggerTaskName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<StackPanel>
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
Registers a background task for a time trigger event and adds the
application to the lock screen. The background task runs every 15 mins
provided the app is on the lock screen.
Registers a background task for a time trigger event and requests
background access. The background task runs every 15 mins
provided the app has background access.
</TextBlock>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal" Margin="0,10,0,10">
<Button x:Name="RegisterButton" Content="Register" Click="RegisterBackgroundTask" Margin="0,0,10,0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ Namespace Global.SDKTemplate
If task.Value.Name = BackgroundTaskSample.ApplicationTriggerTaskName Then
AttachProgressAndCompletedHandlers(task.Value)
BackgroundTaskSample.UpdateBackgroundTaskRegistrationStatus(BackgroundTaskSample.ApplicationTriggerTaskName, True)
trigger = New ApplicationTrigger()
Exit For
End If
Next

trigger = New ApplicationTrigger()
UpdateUI()
End Sub

Expand All @@ -57,6 +57,7 @@ Namespace Global.SDKTemplate
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub RegisterBackgroundTask(sender As Object, e As RoutedEventArgs)
trigger = New ApplicationTrigger()
Dim task = BackgroundTaskSample.RegisterBackgroundTask(BackgroundTaskSample.SampleBackgroundTaskEntryPoint, BackgroundTaskSample.ApplicationTriggerTaskName, trigger, Nothing)
AttachProgressAndCompletedHandlers(task)
UpdateUI()
Expand All @@ -70,6 +71,7 @@ Namespace Global.SDKTemplate
Private Sub UnregisterBackgroundTask(sender As Object, e As RoutedEventArgs)
BackgroundTaskSample.UnregisterBackgroundTasks(BackgroundTaskSample.ApplicationTriggerTaskName)
BackgroundTaskSample.ApplicationTriggerTaskResult = ""
trigger = Nothing
UpdateUI()
End Sub

Expand Down