Merge.
This commit is contained in:
@ -252,7 +252,7 @@ namespace BookAStar.Droid
|
||||
Task.Run(async () =>
|
||||
{
|
||||
App.ShowBookQuery(
|
||||
await DataManager.Current.BookQueries.Get(queryId));
|
||||
await DataManager.Instance.BookQueries.Get(queryId));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -107,10 +107,10 @@ namespace BookAStar
|
||||
{
|
||||
// TODO save the navigation stack
|
||||
int position = 0;
|
||||
DataManager.Current.AppState.Clear();
|
||||
DataManager.Instance.AppState.Clear();
|
||||
foreach (Page page in Navigation.NavigationStack)
|
||||
{
|
||||
DataManager.Current.AppState.Add(
|
||||
DataManager.Instance.AppState.Add(
|
||||
new PageState
|
||||
{
|
||||
Position = position++,
|
||||
@ -118,7 +118,7 @@ namespace BookAStar
|
||||
BindingContext = page.BindingContext
|
||||
});
|
||||
}
|
||||
DataManager.Current.AppState.SaveEntity();
|
||||
DataManager.Instance.AppState.SaveEntity();
|
||||
}
|
||||
|
||||
// called on app startup, after OnStartup, not on rotation
|
||||
@ -126,14 +126,20 @@ namespace BookAStar
|
||||
{
|
||||
// TODO restore the navigation stack
|
||||
base.OnResume();
|
||||
foreach (var pageState in DataManager.Current.AppState)
|
||||
foreach (var pageState in DataManager.Instance.AppState)
|
||||
{
|
||||
var pageType = Type.GetType(pageState.PageType);
|
||||
NavigationService.NavigateTo(
|
||||
pageType, true, pageState.BindingContext);
|
||||
if (pageState.PageType != null)
|
||||
{
|
||||
var pageType = Type.GetType(pageState.PageType);
|
||||
if (pageState.BindingContext != null)
|
||||
NavigationService.NavigateTo(
|
||||
pageType, false, pageState.BindingContext);
|
||||
else NavigationService.NavigateTo(
|
||||
pageType, false);
|
||||
}
|
||||
}
|
||||
DataManager.Current.AppState.Clear();
|
||||
DataManager.Current.AppState.SaveEntity();
|
||||
DataManager.Instance.AppState.Clear();
|
||||
DataManager.Instance.AppState.SaveEntity();
|
||||
}
|
||||
|
||||
// FIXME Not called?
|
||||
@ -342,7 +348,7 @@ namespace BookAStar
|
||||
|
||||
chatHubProxy = chatHubConnection.CreateHubProxy("ChatHub");
|
||||
chatHubProxy.On<string, string>("addPV", (n, m) => {
|
||||
DataManager.Current.PrivateMessages.Add(
|
||||
DataManager.Instance.PrivateMessages.Add(
|
||||
new ChatMessage
|
||||
{
|
||||
Message = m,
|
||||
|
@ -56,6 +56,7 @@
|
||||
<Compile Include="Data\ApiCallFailedException.cs" />
|
||||
<Compile Include="Data\EstimateEntity.cs" />
|
||||
<Compile Include="Data\NonCrUD\RemoteFiles.cs" />
|
||||
<Compile Include="Model\Access\BlackListed.cs" />
|
||||
<Compile Include="Model\FileSystem\UserDirectoryInfo.cs" />
|
||||
<Compile Include="Model\FileSystem\UserFileInfo.cs" />
|
||||
<Compile Include="Model\Settings\SignatureSettings.cs" />
|
||||
|
@ -7,6 +7,7 @@
|
||||
using ViewModels.EstimateAndBilling;
|
||||
using NonCrUD;
|
||||
using ViewModels;
|
||||
using Model.Access;
|
||||
|
||||
public class DataManager
|
||||
{
|
||||
@ -17,23 +18,22 @@
|
||||
internal RemoteFilesEntity RemoteFiles { get; set; }
|
||||
|
||||
public LocalEntity<ClientProviderInfo, string> Contacts { get; set; }
|
||||
internal LocalEntity<PageState, int> AppState { get; set; }
|
||||
// TODO internal RemoteEntity<Blacklisted, long> { get; set; }
|
||||
internal RemoteEntity<BlackListed, long> BlackList { get; set; }
|
||||
/// <summary>
|
||||
/// They have no remote exisence ...
|
||||
/// They've got no remote existence ...
|
||||
/// </summary>
|
||||
internal LocalEntity<EditEstimateViewModel, long> EstimationCache { get; set; }
|
||||
internal LocalEntity<BillingLine, string> EstimateLinesTemplates { get; set; }
|
||||
internal LocalEntity<ChatMessage, int> PrivateMessages { get; set; }
|
||||
protected static DataManager current ;
|
||||
internal LocalEntity<PageState, int> AppState { get; set; }
|
||||
|
||||
public static DataManager Current
|
||||
protected static DataManager instance = new DataManager();
|
||||
|
||||
public static DataManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (current == null)
|
||||
current = new DataManager();
|
||||
return current;
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
28
BookAStar/BookAStar/Model/Access/BlackListed.cs
Normal file
28
BookAStar/BookAStar/Model/Access/BlackListed.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using BookAStar.Model.Access;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace BookAStar.Model.Access
|
||||
{
|
||||
class BlackListed : IBlackListed
|
||||
{
|
||||
public long Id
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string OwnerId
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string UserId
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
@ -56,7 +56,7 @@ namespace BookAStar.Model.Workflow
|
||||
{
|
||||
if (CommandId.HasValue)
|
||||
{
|
||||
var dm = DataManager.Current;
|
||||
var dm = DataManager.Instance;
|
||||
return dm.BookQueries.LocalGet(CommandId.Value);
|
||||
}
|
||||
return null;
|
||||
@ -67,7 +67,7 @@ namespace BookAStar.Model.Workflow
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataManager.Current.Contacts.LocalGet(ClientId);
|
||||
return DataManager.Instance.Contacts.LocalGet(ClientId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,10 @@ namespace BookAStar.Pages.Chat
|
||||
InitializeComponent();
|
||||
|
||||
Title = "Chat";
|
||||
ToolbarItems.Add(new ToolbarItem(
|
||||
name: "...",
|
||||
icon: null,
|
||||
activated: () => { }));
|
||||
BindingContext = new ChatViewModel();
|
||||
App.ChatHubConnection.StateChanged += ChatHubConnection_StateChanged;
|
||||
sendButton.Clicked += async (sender, args) =>
|
||||
|
@ -13,6 +13,10 @@ namespace BookAStar.Pages.Chat
|
||||
public PrivateChatPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
ToolbarItems.Add(new ToolbarItem(
|
||||
name: "...",
|
||||
icon: null,
|
||||
activated: () => { }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace BookAStar.Pages
|
||||
var model = new BookQueriesViewModel();
|
||||
model.RefreshQueries =
|
||||
new Command( () => {
|
||||
DataManager.Current.BookQueries.Execute(null);
|
||||
DataManager.Instance.BookQueries.Execute(null);
|
||||
this.list.EndRefresh();
|
||||
});
|
||||
|
||||
|
@ -65,13 +65,13 @@ namespace BookAStar.Pages
|
||||
if (editEstimateViewModel == null)
|
||||
{
|
||||
// First search for an existing estimate
|
||||
editEstimateViewModel = DataManager.Current.EstimationCache.FirstOrDefault(
|
||||
editEstimateViewModel = DataManager.Instance.EstimationCache.FirstOrDefault(
|
||||
estimate=> estimate.Query.Id == bookQueryViewModel.Id
|
||||
);
|
||||
if (editEstimateViewModel == null)
|
||||
{
|
||||
DataManager.Current.Contacts.Merge(BookQuery.Client);
|
||||
DataManager.Current.Contacts.SaveEntity();
|
||||
DataManager.Instance.Contacts.Merge(BookQuery.Client);
|
||||
DataManager.Instance.Contacts.SaveEntity();
|
||||
editEstimateViewModel = new EditEstimateViewModel( new Estimate
|
||||
{
|
||||
ClientId = BookQuery.Client.UserId,
|
||||
@ -79,7 +79,7 @@ namespace BookAStar.Pages
|
||||
OwnerId = MainSettings.CurrentUser.Id,
|
||||
Id = 0
|
||||
});
|
||||
DataManager.Current.EstimationCache.Add(editEstimateViewModel);
|
||||
DataManager.Instance.EstimationCache.Add(editEstimateViewModel);
|
||||
}
|
||||
}
|
||||
App.NavigationService.NavigateTo<EditEstimatePage>(true,
|
||||
|
@ -44,7 +44,7 @@ namespace BookAStar.Pages
|
||||
|
||||
private void EditEstimatePage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
DataManager.Current.EstimationCache.SaveEntity();
|
||||
DataManager.Instance.EstimationCache.SaveEntity();
|
||||
}
|
||||
|
||||
protected override void OnSizeAllocated(double width, double height)
|
||||
@ -67,7 +67,7 @@ namespace BookAStar.Pages
|
||||
var lineView = new BillingLineViewModel(com)
|
||||
{ ValidateCommand = new Command(() => {
|
||||
bill.Add(new BillingLineViewModel(com));
|
||||
DataManager.Current.EstimationCache.SaveEntity();
|
||||
DataManager.Instance.EstimationCache.SaveEntity();
|
||||
})};
|
||||
App.NavigationService.NavigateTo<EditBillingLinePage>(
|
||||
true, lineView );
|
||||
@ -83,14 +83,14 @@ namespace BookAStar.Pages
|
||||
line.ValidateCommand = new Command(() =>
|
||||
{
|
||||
evm.Check();
|
||||
DataManager.Current.EstimationCache.SaveEntity();
|
||||
DataManager.Instance.EstimationCache.SaveEntity();
|
||||
});
|
||||
// and setup a removal command, that was not expected at creation time
|
||||
line.RemoveCommand = new Command(() =>
|
||||
{
|
||||
evm.Bill.Remove(line);
|
||||
evm.Check();
|
||||
DataManager.Current.EstimationCache.SaveEntity();
|
||||
DataManager.Instance.EstimationCache.SaveEntity();
|
||||
});
|
||||
App.NavigationService.NavigateTo<EditBillingLinePage>(
|
||||
true, line );
|
||||
@ -105,8 +105,8 @@ namespace BookAStar.Pages
|
||||
var cmd = new Command<bool>( async (validated) =>
|
||||
{
|
||||
if (validated) {
|
||||
DataManager.Current.EstimationCache.Remove(evm);
|
||||
DataManager.Current.EstimationCache.SaveEntity();
|
||||
DataManager.Instance.EstimationCache.Remove(evm);
|
||||
DataManager.Instance.EstimationCache.SaveEntity();
|
||||
}
|
||||
await thisPage.Navigation.PopAsync();
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ namespace BookAStar.Pages.EstimatePages
|
||||
private async void OnValidate (object sender, EventArgs ev)
|
||||
{
|
||||
btnValidate.IsEnabled = false;
|
||||
if (DataManager.Current.Estimates.IsExecuting)
|
||||
if (DataManager.Instance.Estimates.IsExecuting)
|
||||
{
|
||||
await App.DisplayAlert(Strings.OperationPending, Strings.oups);
|
||||
return;
|
||||
@ -32,8 +32,8 @@ namespace BookAStar.Pages.EstimatePages
|
||||
var estimate = evm.Data;
|
||||
var pngStream = await padView.GetImageStreamAsync(SignatureImageFormat.Png);
|
||||
pngStream.Seek(0, SeekOrigin.Begin);
|
||||
DataManager.Current.Estimates.SignAsProvider(estimate, pngStream);
|
||||
DataManager.Current.Estimates.SaveEntity();
|
||||
DataManager.Instance.Estimates.SignAsProvider(estimate, pngStream);
|
||||
DataManager.Instance.Estimates.SaveEntity();
|
||||
await Navigation.PopAsync();
|
||||
|
||||
var ParentValidationCommand = ((EstimateSigningViewModel)BindingContext).ValidationCommand;
|
||||
|
@ -12,7 +12,7 @@ namespace BookAStar.Pages.UserProfile
|
||||
public UserFiles()
|
||||
{
|
||||
InitializeComponent();
|
||||
var current = DataManager.Current.RemoteFiles.CurrentItem;
|
||||
var current = DataManager.Instance.RemoteFiles.CurrentItem;
|
||||
if (current != null)
|
||||
BindingContext = new DirectoryInfoViewModel(current);
|
||||
else BindingContext = new DirectoryInfoViewModel
|
||||
@ -33,8 +33,8 @@ namespace BookAStar.Pages.UserProfile
|
||||
if (model != null)
|
||||
model.RefreshCommand = new Command(() =>
|
||||
{
|
||||
DataManager.Current.RemoteFiles.Execute(null);
|
||||
var item = DataManager.Current.RemoteFiles.CurrentItem;
|
||||
DataManager.Instance.RemoteFiles.Execute(null);
|
||||
var item = DataManager.Instance.RemoteFiles.CurrentItem;
|
||||
if (item != null)
|
||||
model.InnerModel = item;
|
||||
// this.dirlist.EndRefresh();
|
||||
|
@ -12,7 +12,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
||||
public BookQueriesViewModel()
|
||||
{
|
||||
queries = new ObservableCollection<BookQueryViewModel>
|
||||
(DataManager.Current.BookQueries.Select(
|
||||
(DataManager.Instance.BookQueries.Select(
|
||||
q =>
|
||||
new BookQueryViewModel(q)));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
||||
Previsionnal = data.Previsionnal;
|
||||
Id = data.Id;
|
||||
estimates = new ObservableCollection<Estimate>(
|
||||
DataManager.Current.Estimates.Where(
|
||||
DataManager.Instance.Estimates.Where(
|
||||
e => e.Query.Id == Id
|
||||
));
|
||||
this.data = data;
|
||||
@ -65,7 +65,7 @@ namespace BookAStar.ViewModels.EstimateAndBilling
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataManager.Current.EstimationCache.LocalGet(this.Id);
|
||||
return DataManager.Instance.EstimationCache.LocalGet(this.Id);
|
||||
}
|
||||
}
|
||||
private ObservableCollection<Estimate> estimates;
|
||||
|
@ -28,10 +28,10 @@ namespace BookAStar.ViewModels.Messaging
|
||||
MainSettings.UserChanged += MainSettings_UserChanged;
|
||||
Messages = new ObservableCollection<ChatMessage>();
|
||||
Notifs = new ObservableCollection<ChatMessage>();
|
||||
PVs = DataManager.Current.PrivateMessages;
|
||||
PVs = DataManager.Instance.PrivateMessages;
|
||||
Contacts =
|
||||
new ObservableCollection<UserViewModel>(
|
||||
DataManager.Current.Contacts.Select(c=>new UserViewModel { Data = c }));
|
||||
DataManager.Instance.Contacts.Select(c=>new UserViewModel { Data = c }));
|
||||
App.ChatHubProxy.On<string, string>("addMessage", (n, m) =>
|
||||
{
|
||||
Messages.Add(new ChatMessage
|
||||
|
@ -192,7 +192,7 @@ namespace BookAStar.ViewModels.UserProfile
|
||||
{
|
||||
newUserIsPro = UserIsPro;
|
||||
|
||||
newQueryCount = newUserIsPro ? DataManager.Current.BookQueries.Count : 0;
|
||||
newQueryCount = newUserIsPro ? DataManager.Instance.BookQueries.Count : 0;
|
||||
|
||||
newStatusString = newUserIsPro ?
|
||||
$"Profile professionel renseigné" :
|
||||
|
@ -198,7 +198,7 @@ namespace BookAStar.ViewModels.UserProfile
|
||||
{
|
||||
newUserIsPro = UserIsPro;
|
||||
|
||||
newQueryCount = newUserIsPro ? DataManager.Current.BookQueries.Count : 0;
|
||||
newQueryCount = newUserIsPro ? DataManager.Instance.BookQueries.Count : 0;
|
||||
|
||||
newStatusString = newUserIsPro ?
|
||||
$"Profile professionel renseigné" :
|
||||
|
@ -6,7 +6,6 @@ using Microsoft.Data.Entity;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Models;
|
||||
using ViewModels.Chat;
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace YavscLib
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
public interface IBlackListed
|
||||
{
|
||||
|
@ -57,8 +57,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="project.json" />
|
||||
<Content Include="IBlackListed.cs" />
|
||||
<Content Include="IChatUserInfo.cs" />
|
||||
<Compile Include="IChatUserInfo.cs" />
|
||||
<Compile Include="IBlackListed.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
Reference in New Issue
Block a user