Update with recovered code from VM binaries (Jan 1)
- ShellDemo: Updated all pages with recovered code, added AppShell.cs - TodoApp: Updated core files, added converters - XamlBrowser: Added recovered sample
This commit is contained in:
128
TodoApp/App.cs
128
TodoApp/App.cs
@@ -1,21 +1,123 @@
|
||||
// TodoApp - Main Application with NavigationPage
|
||||
|
||||
using System.CodeDom.Compiler;
|
||||
using Microsoft.Maui.ApplicationModel;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Internals;
|
||||
using Microsoft.Maui.Controls.Xaml;
|
||||
using Microsoft.Maui.Graphics;
|
||||
|
||||
namespace TodoApp;
|
||||
|
||||
[XamlFilePath("App.xaml")]
|
||||
public class App : Application
|
||||
{
|
||||
public static NavigationPage? NavigationPage { get; private set; }
|
||||
public App()
|
||||
{
|
||||
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_003e: Expected O, but got Unknown
|
||||
InitializeComponent();
|
||||
((Application)this).UserAppTheme = (AppTheme)1;
|
||||
((Application)this).MainPage = (Page)new NavigationPage((Page)(object)new TodoListPage())
|
||||
{
|
||||
BarBackgroundColor = Color.FromArgb("#5C6BC0"),
|
||||
BarTextColor = Colors.White
|
||||
};
|
||||
}
|
||||
|
||||
public App()
|
||||
{
|
||||
NavigationPage = new NavigationPage(new TodoListPage())
|
||||
{
|
||||
Title = "OpenMaui Todo App",
|
||||
BarBackgroundColor = Color.FromArgb("#2196F3"),
|
||||
BarTextColor = Colors.White
|
||||
};
|
||||
MainPage = NavigationPage;
|
||||
}
|
||||
[GeneratedCode("Microsoft.Maui.Controls.SourceGen", "1.0.0.0")]
|
||||
private void InitializeComponent()
|
||||
{
|
||||
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_001b: Expected O, but got Unknown
|
||||
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0035: Expected O, but got Unknown
|
||||
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_004f: Expected O, but got Unknown
|
||||
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0069: Expected O, but got Unknown
|
||||
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0084: Expected O, but got Unknown
|
||||
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_009f: Expected O, but got Unknown
|
||||
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_00ba: Expected O, but got Unknown
|
||||
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_00d5: Expected O, but got Unknown
|
||||
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_00f0: Expected O, but got Unknown
|
||||
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_010b: Expected O, but got Unknown
|
||||
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0126: Expected O, but got Unknown
|
||||
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0141: Expected O, but got Unknown
|
||||
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_015c: Expected O, but got Unknown
|
||||
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0177: Expected O, but got Unknown
|
||||
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0192: Expected O, but got Unknown
|
||||
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_01ad: Expected O, but got Unknown
|
||||
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_01c8: Expected O, but got Unknown
|
||||
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_01e3: Expected O, but got Unknown
|
||||
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_020d: Expected O, but got Unknown
|
||||
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
|
||||
Color val = new Color(0.36078432f, 0.41960785f, 64f / 85f, 1f);
|
||||
Color val2 = new Color(19f / 85f, 0.28627452f, 57f / 85f, 1f);
|
||||
Color val3 = new Color(0.14901961f, 0.6509804f, 0.6039216f, 1f);
|
||||
Color val4 = new Color(0.9372549f, 0.3254902f, 16f / 51f, 1f);
|
||||
Color val5 = new Color(49f / 51f, 0.96862745f, 50f / 51f, 1f);
|
||||
Color val6 = new Color(1f, 1f, 1f, 1f);
|
||||
Color val7 = new Color(11f / 85f, 11f / 85f, 11f / 85f, 1f);
|
||||
Color val8 = new Color(39f / 85f, 39f / 85f, 39f / 85f, 1f);
|
||||
Color val9 = new Color(0.8784314f, 0.8784314f, 0.8784314f, 1f);
|
||||
Color val10 = new Color(6f / 85f, 6f / 85f, 6f / 85f, 1f);
|
||||
Color val11 = new Color(0.11764706f, 0.11764706f, 0.11764706f, 1f);
|
||||
Color val12 = new Color(1f, 1f, 1f, 1f);
|
||||
Color val13 = new Color(0.6901961f, 0.6901961f, 0.6901961f, 1f);
|
||||
Color val14 = new Color(22f / 85f, 22f / 85f, 22f / 85f, 1f);
|
||||
Color val15 = new Color(1f, 1f, 1f, 1f);
|
||||
Color val16 = new Color(0.1764706f, 0.1764706f, 0.1764706f, 1f);
|
||||
Color val17 = new Color(0.8784314f, 0.8784314f, 0.8784314f, 1f);
|
||||
Color val18 = new Color(22f / 85f, 22f / 85f, 22f / 85f, 1f);
|
||||
string text = "\ue145";
|
||||
string text2 = "\ue872";
|
||||
string text3 = "\ue161";
|
||||
string text4 = "\ue876";
|
||||
string text5 = "\ue3c9";
|
||||
ResourceDictionary val19 = new ResourceDictionary();
|
||||
App app;
|
||||
NameScope val20 = (NameScope)(((object)NameScope.GetNameScope((BindableObject)(object)(app = this))) ?? ((object)new NameScope()));
|
||||
NameScope.SetNameScope((BindableObject)(object)app, (INameScope)(object)val20);
|
||||
((Application)app).Resources = val19;
|
||||
val19.Add("PrimaryColor", (object)val);
|
||||
val19.Add("PrimaryDarkColor", (object)val2);
|
||||
val19.Add("AccentColor", (object)val3);
|
||||
val19.Add("DangerColor", (object)val4);
|
||||
val19.Add("PageBackgroundLight", (object)val5);
|
||||
val19.Add("CardBackgroundLight", (object)val6);
|
||||
val19.Add("TextPrimaryLight", (object)val7);
|
||||
val19.Add("TextSecondaryLight", (object)val8);
|
||||
val19.Add("BorderLight", (object)val9);
|
||||
val19.Add("PageBackgroundDark", (object)val10);
|
||||
val19.Add("CardBackgroundDark", (object)val11);
|
||||
val19.Add("TextPrimaryDark", (object)val12);
|
||||
val19.Add("TextSecondaryDark", (object)val13);
|
||||
val19.Add("BorderDark", (object)val14);
|
||||
val19.Add("InputBackgroundLight", (object)val15);
|
||||
val19.Add("InputBackgroundDark", (object)val16);
|
||||
val19.Add("CheckboxUncheckedLight", (object)val17);
|
||||
val19.Add("CheckboxUncheckedDark", (object)val18);
|
||||
val19.Add("IconAdd", (object)text);
|
||||
val19.Add("IconDelete", (object)text2);
|
||||
val19.Add("IconSave", (object)text3);
|
||||
val19.Add("IconCheck", (object)text4);
|
||||
val19.Add("IconEdit", (object)text5);
|
||||
((Application)app).Resources = val19;
|
||||
}
|
||||
}
|
||||
|
||||
72
TodoApp/CompletedToColorConverter.cs
Normal file
72
TodoApp/CompletedToColorConverter.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Graphics;
|
||||
|
||||
namespace TodoApp;
|
||||
|
||||
public class CompletedToColorConverter : IValueConverter
|
||||
{
|
||||
private static readonly Color AccentColor = Color.FromArgb("#26A69A");
|
||||
|
||||
private static readonly Color CompletedColor = Color.FromArgb("#9E9E9E");
|
||||
|
||||
private static readonly Color TextPrimaryLight = Color.FromArgb("#212121");
|
||||
|
||||
private static readonly Color TextSecondaryLight = Color.FromArgb("#757575");
|
||||
|
||||
private static readonly Color TextPrimaryDark = Color.FromArgb("#FFFFFF");
|
||||
|
||||
private static readonly Color TextSecondaryDark = Color.FromArgb("#B0B0B0");
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0038: Invalid comparison between Unknown and I4
|
||||
bool flag = default(bool);
|
||||
int num;
|
||||
if (value is bool)
|
||||
{
|
||||
flag = (bool)value;
|
||||
num = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
bool flag2 = (byte)((uint)num & (flag ? 1u : 0u)) != 0;
|
||||
string text = (parameter as string) ?? "";
|
||||
Application current = Application.Current;
|
||||
bool flag3 = current != null && (int)current.RequestedTheme == 2;
|
||||
if (text == "indicator")
|
||||
{
|
||||
if (!flag2)
|
||||
{
|
||||
return AccentColor;
|
||||
}
|
||||
return CompletedColor;
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
return CompletedColor;
|
||||
}
|
||||
if (text == "notes")
|
||||
{
|
||||
if (!flag3)
|
||||
{
|
||||
return TextSecondaryLight;
|
||||
}
|
||||
return TextSecondaryDark;
|
||||
}
|
||||
if (!flag3)
|
||||
{
|
||||
return TextPrimaryLight;
|
||||
}
|
||||
return TextPrimaryDark;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
29
TodoApp/CompletedToOpacityConverter.cs
Normal file
29
TodoApp/CompletedToOpacityConverter.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.Maui.Controls;
|
||||
|
||||
namespace TodoApp;
|
||||
|
||||
public class CompletedToOpacityConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
bool flag = default(bool);
|
||||
int num;
|
||||
if (value is bool)
|
||||
{
|
||||
flag = (bool)value;
|
||||
num = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
return (((uint)num & (flag ? 1u : 0u)) != 0) ? 0.7 : 1.0;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
30
TodoApp/CompletedToTextDecorationsConverter.cs
Normal file
30
TodoApp/CompletedToTextDecorationsConverter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.Maui;
|
||||
using Microsoft.Maui.Controls;
|
||||
|
||||
namespace TodoApp;
|
||||
|
||||
public class CompletedToTextDecorationsConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
bool flag = default(bool);
|
||||
int num;
|
||||
if (value is bool)
|
||||
{
|
||||
flag = (bool)value;
|
||||
num = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
return (object)(TextDecorations)((((uint)num & (flag ? 1u : 0u)) != 0) ? 2 : 0);
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
// MauiProgram.cs - MAUI app configuration
|
||||
|
||||
using Microsoft.Maui.Controls.Hosting;
|
||||
using Microsoft.Maui.Hosting;
|
||||
using Microsoft.Maui.Platform.Linux.Hosting;
|
||||
|
||||
@@ -7,16 +6,11 @@ namespace TodoApp;
|
||||
|
||||
public static class MauiProgram
|
||||
{
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
|
||||
// Configure the app
|
||||
builder.UseMauiApp<App>();
|
||||
|
||||
// Add Linux platform support with all handlers
|
||||
builder.UseLinux();
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
MauiAppBuilder obj = MauiApp.CreateBuilder(true);
|
||||
AppHostBuilderExtensions.UseMauiApp<App>(obj);
|
||||
obj.UseLinux();
|
||||
return obj.Build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,81 +1,108 @@
|
||||
// TodoItem - Data model for a todo item
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace TodoApp;
|
||||
|
||||
public class TodoItem : INotifyPropertyChanged
|
||||
{
|
||||
private string _title = "";
|
||||
private string _notes = "";
|
||||
private bool _isCompleted;
|
||||
private DateTime _dueDate;
|
||||
private string _title = "";
|
||||
|
||||
public int Id { get; set; }
|
||||
private string _notes = "";
|
||||
|
||||
/// <summary>
|
||||
/// Index in the collection for alternating row colors.
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
private bool _isCompleted;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
set
|
||||
{
|
||||
if (_title != value)
|
||||
{
|
||||
_title = value;
|
||||
OnPropertyChanged(nameof(Title));
|
||||
}
|
||||
}
|
||||
}
|
||||
private DateTime _dueDate;
|
||||
|
||||
public string Notes
|
||||
{
|
||||
get => _notes;
|
||||
set
|
||||
{
|
||||
if (_notes != value)
|
||||
{
|
||||
_notes = value;
|
||||
OnPropertyChanged(nameof(Notes));
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _index;
|
||||
|
||||
public bool IsCompleted
|
||||
{
|
||||
get => _isCompleted;
|
||||
set
|
||||
{
|
||||
if (_isCompleted != value)
|
||||
{
|
||||
_isCompleted = value;
|
||||
OnPropertyChanged(nameof(IsCompleted));
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime DueDate
|
||||
{
|
||||
get => _dueDate;
|
||||
set
|
||||
{
|
||||
if (_dueDate != value)
|
||||
{
|
||||
_dueDate = value;
|
||||
OnPropertyChanged(nameof(DueDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_index != value)
|
||||
{
|
||||
_index = value;
|
||||
OnPropertyChanged("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_title != value)
|
||||
{
|
||||
_title = value;
|
||||
OnPropertyChanged("Title");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
public string Notes
|
||||
{
|
||||
get
|
||||
{
|
||||
return _notes;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_notes != value)
|
||||
{
|
||||
_notes = value;
|
||||
OnPropertyChanged("Notes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public bool IsCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isCompleted;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_isCompleted != value)
|
||||
{
|
||||
_isCompleted = value;
|
||||
OnPropertyChanged("IsCompleted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime DueDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dueDate;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_dueDate != value)
|
||||
{
|
||||
_dueDate = value;
|
||||
OnPropertyChanged("DueDate");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +1,59 @@
|
||||
// TodoService - Manages todo items
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace TodoApp;
|
||||
|
||||
public class TodoService
|
||||
{
|
||||
private static TodoService? _instance;
|
||||
public static TodoService Instance => _instance ??= new TodoService();
|
||||
private static TodoService? _instance;
|
||||
|
||||
private int _nextId = 1;
|
||||
private int _nextId = 1;
|
||||
|
||||
public ObservableCollection<TodoItem> Todos { get; } = new();
|
||||
public static TodoService Instance => _instance ?? (_instance = new TodoService());
|
||||
|
||||
private TodoService()
|
||||
{
|
||||
// Add sample todos with varying lengths to test MaxLines=2 with ellipsis
|
||||
AddTodo("Learn OpenMaui Linux", "Explore the SkiaSharp-based rendering engine for .NET MAUI on Linux desktop. This is a very long description that should wrap to multiple lines and demonstrate the ellipsis truncation feature when MaxLines is set to 2.");
|
||||
AddTodo("Build amazing apps", "Create cross-platform applications that run on Windows, macOS, iOS, Android, and Linux! With OpenMaui, you can write once and deploy everywhere.");
|
||||
AddTodo("Share with the community", "Contribute to the open-source project and help others build great Linux apps. Join our growing community of developers who are passionate about bringing .NET MAUI to Linux.");
|
||||
}
|
||||
public ObservableCollection<TodoItem> Todos { get; } = new ObservableCollection<TodoItem>();
|
||||
|
||||
public TodoItem AddTodo(string title, string notes = "")
|
||||
{
|
||||
var todo = new TodoItem
|
||||
{
|
||||
Id = _nextId++,
|
||||
Index = Todos.Count, // Set index for alternating row colors
|
||||
Title = title,
|
||||
Notes = notes,
|
||||
DueDate = DateTime.Today.AddDays(7)
|
||||
};
|
||||
Todos.Add(todo);
|
||||
return todo;
|
||||
}
|
||||
public int CompletedCount => Todos.Count((TodoItem t) => t.IsCompleted);
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the Index property on all items for alternating row colors.
|
||||
/// </summary>
|
||||
public void RefreshIndexes()
|
||||
{
|
||||
for (int i = 0; i < Todos.Count; i++)
|
||||
{
|
||||
Todos[i].Index = i;
|
||||
}
|
||||
}
|
||||
public int TotalCount => Todos.Count;
|
||||
|
||||
public TodoItem? GetTodo(int id)
|
||||
{
|
||||
return Todos.FirstOrDefault(t => t.Id == id);
|
||||
}
|
||||
private TodoService()
|
||||
{
|
||||
AddTodo("Learn OpenMaui Linux", "Explore the SkiaSharp-based rendering engine for .NET MAUI on Linux desktop. This is a very long description that should wrap to multiple lines and demonstrate the ellipsis truncation feature when MaxLines is set to 2.");
|
||||
AddTodo("Build amazing apps", "Create cross-platform applications that run on Windows, macOS, iOS, Android, and Linux! With OpenMaui, you can write once and deploy everywhere.");
|
||||
AddTodo("Share with the community", "Contribute to the open-source project and help others build great Linux apps. Join our growing community of developers who are passionate about bringing .NET MAUI to Linux.");
|
||||
}
|
||||
|
||||
public void DeleteTodo(TodoItem todo)
|
||||
{
|
||||
Todos.Remove(todo);
|
||||
}
|
||||
public TodoItem AddTodo(string title, string notes = "")
|
||||
{
|
||||
TodoItem todoItem = new TodoItem
|
||||
{
|
||||
Id = _nextId++,
|
||||
Index = Todos.Count,
|
||||
Title = title,
|
||||
Notes = notes,
|
||||
DueDate = DateTime.Today.AddDays(7.0)
|
||||
};
|
||||
Todos.Add(todoItem);
|
||||
return todoItem;
|
||||
}
|
||||
|
||||
public int CompletedCount => Todos.Count(t => t.IsCompleted);
|
||||
public int TotalCount => Todos.Count;
|
||||
public void RefreshIndexes()
|
||||
{
|
||||
for (int i = 0; i < Todos.Count; i++)
|
||||
{
|
||||
Todos[i].Index = i;
|
||||
}
|
||||
}
|
||||
|
||||
public TodoItem? GetTodo(int id)
|
||||
{
|
||||
return Todos.FirstOrDefault((TodoItem t) => t.Id == id);
|
||||
}
|
||||
|
||||
public void DeleteTodo(TodoItem todo)
|
||||
{
|
||||
Todos.Remove(todo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user