1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

IsEnabled variable sur la main page

This commit is contained in:
Yan Maniez 2018-12-18 20:42:14 +01:00
parent e6a68d4788
commit cbea03680d
6 changed files with 52 additions and 15 deletions

View file

@ -1,11 +1,11 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------

View file

@ -24,10 +24,16 @@ namespace AideDeJeu.ViewModels
public async Task ExecuteSearchCommandAsync(string searchText)
{
Main.IsLoading = true;
//await Task.Run(async () => await Store.PreloadAllItemsAsync());
Items = await Task.Run(async () => await DeepSearchAllItemsAsync(searchText));
Main.IsLoading = false;
try
{
Main.IsLoading = true;
//await Task.Run(async () => await Store.PreloadAllItemsAsync());
Items = await Task.Run(async () => await DeepSearchAllItemsAsync(searchText));
}
finally
{
Main.IsLoading = false;
}
}
public IEnumerable<SearchedItem> _Items = null;

View file

@ -16,8 +16,20 @@ namespace AideDeJeu.ViewModels
public bool IsLoading
{
get => _isLoading;
set => SetProperty(ref _isLoading, value);
set
{
SetProperty(ref _isLoading, value);
OnPropertyChanged(nameof(IsEnabled));
}
}
public bool IsEnabled
{
get => !_isLoading;
}
/*
void AddAnchor(string source, Dictionary<string, Item> anchors, Item item)
{

View file

@ -157,11 +157,18 @@ namespace AideDeJeu.ViewModels
var file = match.Groups["file"].Value;
var anchor = match.Groups["anchor"].Value;
var with = match.Groups["with"].Value;
Main.IsBusy = true;
Main.IsLoading = true;
var item = await Task.Run(async () => await Store.GetItemFromDataAsync(file, anchor));
Main.IsBusy = false;
Main.IsLoading = false;
Item item = null;
try
{
Main.IsBusy = true;
Main.IsLoading = true;
item = await Task.Run(async () => await Store.GetItemFromDataAsync(file, anchor));
}
finally
{
Main.IsBusy = false;
Main.IsLoading = false;
}
if (item != null)
{
var items = item; // as Items;

View file

@ -7,6 +7,7 @@
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
x:Class="AideDeJeu.Views.MainTabbedPage"
Padding="0"
IsEnabled="{Binding Main.IsEnabled}"
android:TabbedPage.ToolbarPlacement="Bottom"
android:TabbedPage.IsSwipePagingEnabled="False"
android:TabbedPage.BarItemColor="{StaticResource HDMidGrey}"

View file

@ -1,4 +1,5 @@
using System;
using AideDeJeu.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -23,9 +24,19 @@ namespace AideDeJeu.Views
this.NavigationPage = value;
}
}
public MainViewModel Main
{
get
{
return DependencyService.Get<MainViewModel>();
}
}
public MainTabbedPage ()
{
InitializeComponent();
BindingContext = this;
}
}
}