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

style: format code with dotnet-format #392

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 73 additions & 73 deletions Database/MauiTaskListApp/ViewModels/TasksViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,99 +10,99 @@ public sealed partial class TasksViewModel(AppDbContext context) : ObservableObj
{
public ObservableCollection<Task> ActiveTasks { get; } = new();

public ObservableCollection<Task> FinishedTasks { get; } = new();
public ObservableCollection<Task> FinishedTasks { get; } = new();

[ObservableProperty]
private Task task = new();
[ObservableProperty]
private Task task = new();

public Task TaskEditMode { get; set; } = new();
public Task TaskEditMode { get; set; } = new();

[ObservableProperty]
private string hasErrorsCodeBehind = string.Empty;
[ObservableProperty]
private string hasErrorsCodeBehind = string.Empty;

[RelayCommand]
private void New()
[RelayCommand]
private void New()
{
Task = new()
{
Task = new()
{
Date = DateTime.Now
};
}
Date = DateTime.Now
};
}

[RelayCommand]
private void EditModeOn()
[RelayCommand]
private void EditModeOn()
{
TaskEditMode.Id = Task.Id;
TaskEditMode.Description = Task.Description;
TaskEditMode.Date = Task.Date;
TaskEditMode.IsFinished = Task.IsFinished;
}

[RelayCommand]
private void EditModeOff()
{
Task.Id = TaskEditMode.Id;
Task.Description = TaskEditMode.Description;
Task.Date = TaskEditMode.Date;
Task.IsFinished = TaskEditMode.IsFinished;
}

[RelayCommand]
private void Edit(Task task)
{
try
{
TaskEditMode.Id = Task.Id;
TaskEditMode.Description = Task.Description;
TaskEditMode.Date = Task.Date;
TaskEditMode.IsFinished = Task.IsFinished;
}
HasErrorsCodeBehind = string.Empty;

[RelayCommand]
private void EditModeOff()
context.Update(Task);
context.SaveChanges();

EditModeOn();
}
catch (Exception ex)
{
Task.Id = TaskEditMode.Id;
Task.Description = TaskEditMode.Description;
Task.Date = TaskEditMode.Date;
Task.IsFinished = TaskEditMode.IsFinished;
HasErrorsCodeBehind = ex.Message;
}
}

[RelayCommand]
private void Edit(Task task)
[RelayCommand]
private void Delete(Task task)
{
try
{
try
{
HasErrorsCodeBehind = string.Empty;

context.Update(Task);
context.SaveChanges();

EditModeOn();
}
catch (Exception ex)
{
HasErrorsCodeBehind = ex.Message;
}
}
HasErrorsCodeBehind = string.Empty;

[RelayCommand]
private void Delete(Task task)
context.Remove(task);
context.SaveChanges();
}
catch (Exception ex)
{
try
{
HasErrorsCodeBehind = string.Empty;

context.Remove(task);
context.SaveChanges();
}
catch (Exception ex)
{
HasErrorsCodeBehind = ex.Message;
}
HasErrorsCodeBehind = ex.Message;
}
}

[RelayCommand]
private void GetAll()
[RelayCommand]
private void GetAll()
{
var tasks = context.Tasks.ToList();

ActiveTasks.Clear();
foreach (var activeTask in tasks.Where(x => !x.IsFinished).OrderBy(x => x.Date))
{
var tasks = context.Tasks.ToList();

ActiveTasks.Clear();
foreach (var activeTask in tasks.Where(x => !x.IsFinished).OrderBy(x => x.Date))
{
ActiveTasks.Add(activeTask);
}

FinishedTasks.Clear();
foreach (var activeTask in tasks.Where(x => x.IsFinished).OrderByDescending(x => x.Date))
{
FinishedTasks.Add(activeTask);
}
ActiveTasks.Add(activeTask);
}

public void Initialize()
FinishedTasks.Clear();
foreach (var activeTask in tasks.Where(x => x.IsFinished).OrderByDescending(x => x.Date))
{
GetAll();
FinishedTasks.Add(activeTask);
}
}

public void Initialize()
{
GetAll();
}

public void Dispose() => context.Dispose();
public void Dispose() => context.Dispose();
}
4 changes: 2 additions & 2 deletions MauiApplicationInsights/Platforms/Tizen/Main.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MauiApplicationInsights
namespace MauiApplicationInsights
{
using System;
using Microsoft.Maui;
Expand All @@ -14,4 +14,4 @@ static void Main(string[] args)
app.Run(args);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


namespace MauiShellCustomization;
using Microsoft.Maui.Controls.Handlers;
using Microsoft.Maui.Controls.Platform;
Expand Down
29 changes: 19 additions & 10 deletions MauiShellCustomization/Platforms/Windows/CustomShellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,25 @@ private void ShellViewOnLoaded(object sender, RoutedEventArgs e)
private static DataTemplate CreateNavigationViewItemDataTemplate()
{
var xaml = """
<DataTemplate xmlns = 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
<NavigationViewItem BackgroundSizing = "OuterBorderEdge"
Content = "{Binding Content}"
Foreground = "{Binding Foreground}"
Background = "{Binding Background}"
IsSelected = "{Binding IsSelected, Mode=TwoWay}"
MenuItemsSource = "{Binding MenuItemsSource}"
Icon = "{Binding Icon}" />
</DataTemplate>
""";
< DataTemplate xmlns = 'http://schemas.microsoft.com/winfx/2006/xaml/presentation' >


< NavigationViewItem BackgroundSizing = "OuterBorderEdge"

Content = "{Binding Content}"

Foreground = "{Binding Foreground}"

Background = "{Binding Background}"

IsSelected = "{Binding IsSelected, Mode=TwoWay}"

MenuItemsSource = "{Binding MenuItemsSource}"

Icon = "{Binding Icon}" />

</ DataTemplate >
""";

var dataTemplate = (DataTemplate)XamlReader.Load(xaml);
return dataTemplate;
Expand Down
4 changes: 2 additions & 2 deletions MauiTabView/Platforms/Tizen/Main.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace MauiTabView
namespace MauiTabView
{
using System;
using Microsoft.Maui;
Expand All @@ -14,4 +14,4 @@ static void Main(string[] args)
app.Run(args);
}
}
}
}
2 changes: 1 addition & 1 deletion MauiTabView/TabView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class Tab : View
public partial class TabView : VerticalStackLayout
{
[AutoBindable(DefaultValue = "new System.Collections.ObjectModel.ObservableCollection<Tab>()", OnChanged = "OnTabsChanged")]
private ObservableCollection<Tab> tabs = new ();
private ObservableCollection<Tab> tabs = new();

[AutoBindable(DefaultValue = "-1", OnChanged = "OnActiveTabIndexChanged")]
private int activeTabIndex;
Expand Down
Loading