1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 22:45:44 +00:00
This commit is contained in:
Yan Maniez 2018-07-14 01:18:27 +02:00
parent c4c7c87ee8
commit 8df83cb8c4
6 changed files with 18 additions and 58 deletions

View file

@ -29,6 +29,15 @@ namespace AideDeJeuLib
{
break;
}
else if(enumerator.Current is HeadingBlock)
{
var headingBlock = enumerator.Current as HeadingBlock;
if(headingBlock.Level == 1 && headingBlock.HeaderChar == '#')
{
this.Name = headingBlock.Inline.ToMarkdownString();
}
}
enumerator.MoveNext();
}
while (enumerator.Current != null)

View file

@ -34,43 +34,6 @@ namespace AideDeJeu.Tools
}
}
public class StringListToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var strings = value as IEnumerable<string>;
if (strings != null)
{
var cstring = string.Empty;
foreach (var str in strings)
{
cstring += str + "\n\n";
}
return cstring;
// const string embedded = "# An exhibit of Markdown\n\n" +
// "|Familiarité|Incident|Zone similaire|À proximité|Sur place|\n" +
// "| ---| ---| ---| ---| ---|\n" +
//"| Cercle permanent|—|—|—|01-100|\n" +
//"|Objet associé|—|—|—|01-100|\n" +
//"|Très familier|01-05|06-13|14-24|25-100|\n" +
//"|Vu à quelques reprises|01-33|34-43|44-53|54-100|\n" +
//"|Vu une seule fois|01-43|44-53|54-73|74-100|\n" +
//"|Description|01-43|44-53|54-73|74-100|\n" +
//"|Destination factice|01-50|51-100|—|—|"
//+
// "\n\n![Unsplash](https://unsplash.it/200/300)This note demonstrates some of what [Markdown][1] is capable of doing.\n\n*Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.*\n\n## Basic formatting\n\nParagraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.\n\nParagraphs must be separated by a blank line. Basic formatting of *italics* and **bold** is supported. This *can be **nested** like* so.\n\n## Lists\n\n### Ordered list\n\n1. Item 1\n2. A second item\n3. Number 3\n4. Ⅳ\n\n*Note: the fourth item uses the Unicode character for [Roman numeral four][2].*\n\n### Unordered list\n\n* An item\n* Another item\n* Yet another item\n* And there's more...\n\n## Paragraph modifiers\n\n### Code block\n\n Code blocks are very useful for developers and other people who look at code or other things that are written in plain text. As you can see, it uses a fixed-width font.\n\nYou can also make `inline code` to add code into other things.\n\n### Quote\n\n> Here is a quote. What this is should be self explanatory. Quotes are automatically indented when they are used.\n\n## Headings\n\nThere are six levels of headings. They correspond with the six levels of HTML headings. You've probably noticed them already in the page. Each level down uses one more hash character.\n\n### Headings *can* also contain **formatting**\n\n### They can even contain `inline code`\n\nOf course, demonstrating what headings look like messes up the structure of the page.\n\nI don't recommend using more than three or four levels of headings here, because, when you're smallest heading isn't too small, and you're largest heading isn't too big, and you want each size up to look noticeably larger and more important, there there are only so many sizes that you can use.\n\n## URLs\n\nURLs can be made in a handful of ways:\n\n* A named link to [MarkItDown][3]. The easiest way to do these is to select what you want to make a link and hit `Ctrl+L`.\n* Another named link to [MarkItDown](http://www.markitdown.net/)\n\n## Horizontal rule\n\nA horizontal rule is a line that goes across the middle of the page.\n\n---\n\nIt's sometimes handy for breaking things up.\n\n## Images\n\nMarkdown can also contain images. I'll need to add something here sometime.\n\n## Finally\n\nThere's actually a lot more to Markdown than this. See the official [introduction][4] and [syntax][5] for more information. However, be aware that this is not using the official implementation, and this might work subtly differently in some of the little things.\n\n [1]: http://daringfireball.net/projects/markdown/\n [2]: http://www.fileformat.info/info/unicode/char/2163/index.htm\n [3]: http://www.markitdown.net/\n [4]: http://daringfireball.net/projects/markdown/basics\n [5]: http://daringfireball.net/projects/markdown/syntax";
// return embedded;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
public class ItemSourceTypeConverter<T> : IValueConverter
{
@ -109,19 +72,4 @@ namespace AideDeJeu.Tools
public class ItemSourceTypeToStringConverter : ItemSourceTypeConverter<string> { }
//public class ItemSourceTypeToFilterConverter : IValueConverter
//{
// public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
// {
// var vm = DependencyService.Get<ItemsViewModel>();
// var itemSourceType = vm.ItemSourceType;
// return vm.Main.GetFilterViewModel(itemSourceType).Filters;
// }
// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
// {
// return null;
// }
//}
}

View file

@ -160,11 +160,14 @@ namespace AideDeJeu.ViewModels
async Task LoadItemsAsync(CancellationToken cancellationToken = default)
{
IsBusy = true;
Main.IsLoading = true;
try
{
var filterViewModel = Filter;// Main.GetFilterViewModel(ItemSourceType);
var items = await filterViewModel.FilterItems(await Main.GetAllItemsAsync(ItemSourceType), cancellationToken: cancellationToken);
var filterViewModel = Filter;
var allItems = await Main.GetAllItemsAsync(ItemSourceType);
var items = await filterViewModel.FilterItems(allItems, cancellationToken: cancellationToken);
Items = items.ToList();
Title = (allItems as Item)?.Name;
}
catch (OperationCanceledException ex)
{
@ -172,6 +175,7 @@ namespace AideDeJeu.ViewModels
}
finally
{
Main.IsLoading = false;
IsBusy = false;
}
}

View file

@ -9,7 +9,6 @@
<ResourceDictionary>
<tools:MonsterMarkdownTheme x:Key="MonsterMarkdownTheme" />
<tools:NullToFalseConverter x:Key="NullToFalseConverter" />
<tools:StringListToStringConverter x:Key="StringListToStringConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>

View file

@ -7,9 +7,9 @@
x:Class="AideDeJeu.Views.ItemsPage"
x:Name="This"
IsPresented="False"
Title="{Binding ItemSourceType,Converter={StaticResource ItemSourceTypeToTitleConverter}}">
Title="{Binding Title}">
<MasterDetailPage.ToolbarItems>
<ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding AboutCommand}" />
<ToolbarItem Name="About" Text="À propos de..." Order="Secondary" Icon="wooden_sign.png" Command="{Binding Main.AboutCommand}" />
</MasterDetailPage.ToolbarItems>
<MasterDetailPage.Resources>
<ResourceDictionary>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<NavigationPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AideDeJeu.Views.MainNavigationPage" IsBusy="{Binding Main.IsBusy}">
x:Class="AideDeJeu.Views.MainNavigationPage" IsBusy="{Binding Main.IsLoading}">
</NavigationPage>