From 9c33c32674351ea6f285938de58b82136e812b57 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Thu, 15 Dec 2016 02:32:49 +0100 Subject: [PATCH] WIP Chat --- BookAStar/BookAStar/BookAStar.csproj | 6 ++-- BookAStar/BookAStar/Data/DataManager.cs | 7 +++- .../BookAStar/Model/Access/BlackListed.cs | 2 +- .../PrivateMessage.cs => Chat/ChatMessage.cs} | 4 --- .../Social/{Messaging => Chat}/ChatStatus.cs | 0 .../Model/Social/Chat/ChatUserInfo.cs | 33 +++++++++++++++++++ .../BookAStar/Model/Social/Chat/Connection.cs | 27 +++++++++++++++ BookAStar/BookAStar/Model/Tag.cs | 2 +- .../BookAStar/Pages/Chat/ChatPage.xaml.cs | 3 +- .../Pages/Chat/PrivateChatPage.xaml.cs | 3 +- 10 files changed, 76 insertions(+), 11 deletions(-) rename BookAStar/BookAStar/Model/Social/{Messaging/PrivateMessage.cs => Chat/ChatMessage.cs} (70%) rename BookAStar/BookAStar/Model/Social/{Messaging => Chat}/ChatStatus.cs (100%) create mode 100644 BookAStar/BookAStar/Model/Social/Chat/ChatUserInfo.cs create mode 100644 BookAStar/BookAStar/Model/Social/Chat/Connection.cs diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj index 9598760b..fad3da48 100644 --- a/BookAStar/BookAStar/BookAStar.csproj +++ b/BookAStar/BookAStar/BookAStar.csproj @@ -60,8 +60,10 @@ - - + + + + PrivateChatPage.xaml diff --git a/BookAStar/BookAStar/Data/DataManager.cs b/BookAStar/BookAStar/Data/DataManager.cs index 6bb5dd38..630409bd 100644 --- a/BookAStar/BookAStar/Data/DataManager.cs +++ b/BookAStar/BookAStar/Data/DataManager.cs @@ -8,11 +8,13 @@ using NonCrUD; using ViewModels; using Model.Access; + using Model.Social.Chat; public class DataManager { // TODO estimatetemplate rating service product tag public RemoteEntityRO BookQueries { get; set; } + public RemoteEntityRO ChatUsers { get; set; } public EstimateEntity Estimates { get; set; } public RemoteEntity Blogspot { get; set; } internal RemoteFilesEntity RemoteFiles { get; set; } @@ -49,7 +51,9 @@ EstimateLinesTemplates = new LocalEntity(l => l.Description); PrivateMessages = new LocalEntity(m=> m.GetHashCode()); RemoteFiles = new RemoteFilesEntity (); - + BlackList = new RemoteEntity("blacklist",u => u.Id); + ChatUsers = new RemoteEntityRO + ("chat/users", u => u.UserId); PrivateMessages.Load(); BookQueries.Load(); Estimates.Load(); @@ -59,6 +63,7 @@ EstimationCache.Load(); EstimateLinesTemplates.Load(); RemoteFiles.Load(); + BlackList.Load(); } } } diff --git a/BookAStar/BookAStar/Model/Access/BlackListed.cs b/BookAStar/BookAStar/Model/Access/BlackListed.cs index 7e0866f2..b057844c 100644 --- a/BookAStar/BookAStar/Model/Access/BlackListed.cs +++ b/BookAStar/BookAStar/Model/Access/BlackListed.cs @@ -8,7 +8,7 @@ using Yavsc.Models; namespace BookAStar.Model.Access { - class BlackListed : IBlackListed + public class BlackListed : IBlackListed { public long Id { diff --git a/BookAStar/BookAStar/Model/Social/Messaging/PrivateMessage.cs b/BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs similarity index 70% rename from BookAStar/BookAStar/Model/Social/Messaging/PrivateMessage.cs rename to BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs index 8dae22c6..72f55a43 100644 --- a/BookAStar/BookAStar/Model/Social/Messaging/PrivateMessage.cs +++ b/BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace BookAStar.Model.Social.Messaging { diff --git a/BookAStar/BookAStar/Model/Social/Messaging/ChatStatus.cs b/BookAStar/BookAStar/Model/Social/Chat/ChatStatus.cs similarity index 100% rename from BookAStar/BookAStar/Model/Social/Messaging/ChatStatus.cs rename to BookAStar/BookAStar/Model/Social/Chat/ChatStatus.cs diff --git a/BookAStar/BookAStar/Model/Social/Chat/ChatUserInfo.cs b/BookAStar/BookAStar/Model/Social/Chat/ChatUserInfo.cs new file mode 100644 index 00000000..2b14e6d9 --- /dev/null +++ b/BookAStar/BookAStar/Model/Social/Chat/ChatUserInfo.cs @@ -0,0 +1,33 @@ + +using YavscLib; + +namespace BookAStar.Model.Social.Chat +{ + public class ChatUserInfo : IChatUserInfo + { + public string Avatar + { + get; set; + } + + public IConnection[] Connections + { + get; set; + } + + public string[] Roles + { + get; set; + } + + public string UserId + { + get; set; + } + + public string UserName + { + get; set; + } + } +} diff --git a/BookAStar/BookAStar/Model/Social/Chat/Connection.cs b/BookAStar/BookAStar/Model/Social/Chat/Connection.cs new file mode 100644 index 00000000..83fe7153 --- /dev/null +++ b/BookAStar/BookAStar/Model/Social/Chat/Connection.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using YavscLib; + +namespace BookAStar.Model.Social.Chat +{ + public class Connection : IConnection + { + public bool Connected + { + get; set; + } + + public string ConnectionId + { + get; set; + } + + public string UserAgent + { + get; set; + } + } +} diff --git a/BookAStar/BookAStar/Model/Tag.cs b/BookAStar/BookAStar/Model/Tag.cs index 2fb40866..ec9458df 100644 --- a/BookAStar/BookAStar/Model/Tag.cs +++ b/BookAStar/BookAStar/Model/Tag.cs @@ -1,5 +1,5 @@ -namespace Yavsc.Models +namespace Yavsc.Model { public partial class Tag { diff --git a/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs b/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs index e29ccbe8..45c5dfa3 100644 --- a/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs +++ b/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs @@ -18,10 +18,11 @@ namespace BookAStar.Pages.Chat InitializeComponent(); Title = "Chat"; + /* ToolbarItems.Add(new ToolbarItem( name: "...", icon: null, - activated: () => { })); + activated: () => { })); */ BindingContext = new ChatViewModel(); App.ChatHubConnection.StateChanged += ChatHubConnection_StateChanged; sendButton.Clicked += async (sender, args) => diff --git a/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml.cs b/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml.cs index 3c6c5233..45652bf1 100644 --- a/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml.cs +++ b/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml.cs @@ -13,10 +13,11 @@ namespace BookAStar.Pages.Chat public PrivateChatPage() { InitializeComponent(); + /* ToolbarItems.Add(new ToolbarItem( name: "...", icon: null, - activated: () => { })); + activated: () => { }));*/ } } }