diff --git a/Database/MauiTaskListApp/ViewModels/TasksViewModel.cs b/Database/MauiTaskListApp/ViewModels/TasksViewModel.cs index 9abc75b6..823a83c9 100644 --- a/Database/MauiTaskListApp/ViewModels/TasksViewModel.cs +++ b/Database/MauiTaskListApp/ViewModels/TasksViewModel.cs @@ -10,99 +10,99 @@ public sealed partial class TasksViewModel(AppDbContext context) : ObservableObj { public ObservableCollection ActiveTasks { get; } = new(); - public ObservableCollection FinishedTasks { get; } = new(); +public ObservableCollection 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(); } \ No newline at end of file diff --git a/MauiApplicationInsights/Platforms/Tizen/Main.cs b/MauiApplicationInsights/Platforms/Tizen/Main.cs index 82490022..c6479d01 100644 --- a/MauiApplicationInsights/Platforms/Tizen/Main.cs +++ b/MauiApplicationInsights/Platforms/Tizen/Main.cs @@ -1,4 +1,4 @@ -namespace MauiApplicationInsights +namespace MauiApplicationInsights { using System; using Microsoft.Maui; @@ -14,4 +14,4 @@ static void Main(string[] args) app.Run(args); } } -} +} \ No newline at end of file diff --git a/MauiShellCustomization/Platforms/Tizen/CustomShellHandler.cs b/MauiShellCustomization/Platforms/Tizen/CustomShellHandler.cs index 71da87f3..93bc72e3 100644 --- a/MauiShellCustomization/Platforms/Tizen/CustomShellHandler.cs +++ b/MauiShellCustomization/Platforms/Tizen/CustomShellHandler.cs @@ -1,4 +1,4 @@ - + namespace MauiShellCustomization; using Microsoft.Maui.Controls.Handlers; using Microsoft.Maui.Controls.Platform; diff --git a/MauiShellCustomization/Platforms/Windows/CustomShellHandler.cs b/MauiShellCustomization/Platforms/Windows/CustomShellHandler.cs index 93d79c72..f1f2a86f 100644 --- a/MauiShellCustomization/Platforms/Windows/CustomShellHandler.cs +++ b/MauiShellCustomization/Platforms/Windows/CustomShellHandler.cs @@ -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}" /> + + + """; var dataTemplate = (DataTemplate)XamlReader.Load(xaml); return dataTemplate; diff --git a/MauiTabView/Platforms/Tizen/Main.cs b/MauiTabView/Platforms/Tizen/Main.cs index f63695bf..803ccb7e 100644 --- a/MauiTabView/Platforms/Tizen/Main.cs +++ b/MauiTabView/Platforms/Tizen/Main.cs @@ -1,4 +1,4 @@ -namespace MauiTabView +namespace MauiTabView { using System; using Microsoft.Maui; @@ -14,4 +14,4 @@ static void Main(string[] args) app.Run(args); } } -} +} \ No newline at end of file diff --git a/MauiTabView/TabView.cs b/MauiTabView/TabView.cs index 18735631..22488c65 100644 --- a/MauiTabView/TabView.cs +++ b/MauiTabView/TabView.cs @@ -19,7 +19,7 @@ public partial class Tab : View public partial class TabView : VerticalStackLayout { [AutoBindable(DefaultValue = "new System.Collections.ObjectModel.ObservableCollection()", OnChanged = "OnTabsChanged")] - private ObservableCollection tabs = new (); + private ObservableCollection tabs = new(); [AutoBindable(DefaultValue = "-1", OnChanged = "OnActiveTabIndexChanged")] private int activeTabIndex;