Skip to content

Commit

Permalink
Fix toast (#25580)
Browse files Browse the repository at this point in the history
* Fix toast

* Update ManageMetaPageModel.cs
  • Loading branch information
PureWeen authored Oct 29, 2024
1 parent 9769a5e commit d5e4ed5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/Templates/src/templates/maui-mobile/AppShell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ public static async Task DisplaySnackbarAsync(string message)
await snackbar.Show(cancellationTokenSource.Token);
}

#if WINDOWS
public static Task DisplayToastAsync(string message)
{
// Toast is currently not working in MCT on Windows
return Task.CompletedTask;
}
#else
public static async Task DisplayToastAsync(string message)
{
var toast = Toast.Make(message, textSize: 18);

var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
await toast.Show(cts.Token);
}
#endif

private void SfSegmentedControl_SelectionChanged(object sender, Syncfusion.Maui.Toolkit.SegmentedControl.SelectionChangedEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ private async Task AddTag()
private async Task Reset()
{
Preferences.Default.Remove("is_seeded");
await Shell.Current.GoToAsync("//main");
await _seedDataService.LoadSeedDataAsync();
Preferences.Default.Set("is_seeded", true);
await Shell.Current.GoToAsync("//main");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private async Task Save()
_project.Name = Name;
_project.Description = Description;
_project.CategoryID = Category?.ID ?? 0;
_project.Icon = Icon;
_project.Icon = Icon ?? FluentUI.ribbon_24_regular;
await _projectRepository.SaveItemAsync(_project);

if (_project.IsNullOrNew())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ private async Task LoadTaskAsync(IDictionary<string, object> query)
}

// If the project is new, we don't need to load the project dropdown
if (Project is not null && Project.ID != 0)
{
Projects = await _projectRepository.ListAsync();
IsExistingProject = true;
if (Project?.ID == 0)
{
IsExistingProject = false;
}
else
{
IsExistingProject = false;
{
Projects = await _projectRepository.ListAsync();
IsExistingProject = true;
}

if (Project is not null)
Expand Down Expand Up @@ -142,7 +142,7 @@ private async Task Save()
Project.Tasks.Add(_task);

if (_task.ProjectID > 0)
_ = _taskRepository.SaveItemAsync(_task);
_taskRepository.SaveItemAsync(_task).FireAndForgetSafeAsync(_errorHandler);

await Shell.Current.GoToAsync("..?refresh=true");

Expand Down

0 comments on commit d5e4ed5

Please sign in to comment.