intergartions XLabs.* WIP MVVM
This commit is contained in:
parent
24e13be888
commit
b6d3dc1a9b
49 changed files with 6236 additions and 2960 deletions
22
BookAStar/BookAStar/ViewModels/BookQueriesViewModel.cs
Normal file
22
BookAStar/BookAStar/ViewModels/BookQueriesViewModel.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using BookAStar.Helpers;
|
||||
using BookAStar.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BookAStar.ViewModels
|
||||
{
|
||||
class BookQueriesViewModel : XLabs.Forms.Mvvm.ViewModel
|
||||
{
|
||||
public ObservableCollection<BookQueryData> Queries
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataManager.Current.BookQueries;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
BookAStar/BookAStar/ViewModels/BookQueryViewModel.cs
Normal file
32
BookAStar/BookAStar/ViewModels/BookQueryViewModel.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using BookAStar.Model;
|
||||
using BookAStar.Model.Social;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BookAStar.ViewModels
|
||||
{
|
||||
class BookQueryViewModel : XLabs.Forms.Mvvm.ViewModel
|
||||
{
|
||||
public BookQueryViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
public BookQueryViewModel(BookQueryData data)
|
||||
{
|
||||
Debug.Assert(data != null);
|
||||
Client=data.Client;
|
||||
Location = data.Location;
|
||||
EventDate = data.EventDate;
|
||||
Previsionnal = data.Previsionnal;
|
||||
}
|
||||
public ClientProviderInfo Client { get; set; }
|
||||
public Location Location { get; set; }
|
||||
public long Id { get; set; }
|
||||
public DateTime EventDate { get; set; }
|
||||
public decimal? Previsionnal { get; set; }
|
||||
}
|
||||
}
|
||||
11
BookAStar/BookAStar/ViewModels/SettingsViewModel.cs
Normal file
11
BookAStar/BookAStar/ViewModels/SettingsViewModel.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using XLabs.Forms.Mvvm;
|
||||
using XLabs.Platform.Services;
|
||||
|
||||
namespace BookAStar.ViewModels
|
||||
{
|
||||
internal class SettingsViewModel : XLabs.Forms.Mvvm.ViewModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
45
BookAStar/BookAStar/ViewModels/ViewModelBase.cs
Normal file
45
BookAStar/BookAStar/ViewModels/ViewModelBase.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using BookAStar.Helpers;
|
||||
using BookAStar.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BookAStar.ViewModels
|
||||
{
|
||||
public class ViewModelBase : IModelViewModel
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void SetState<T>(Action<T> action) where T : class, IModelViewModel
|
||||
{
|
||||
action(this as T);
|
||||
}
|
||||
|
||||
protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (object.Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged<T>(Expression<Func<T>> propertyExpression)
|
||||
{
|
||||
OnPropertyChanged( PropertySupport.ExtractPropertyName<T>( propertyExpression));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue