diff --git a/BookAStar/BookAStar/App.xaml b/BookAStar/BookAStar/App.xaml index a9fb0040..aee77e6f 100644 --- a/BookAStar/BookAStar/App.xaml +++ b/BookAStar/BookAStar/App.xaml @@ -9,6 +9,8 @@ #FFAAAAFF + #FFCCCCFF + #80FFFFFF #FFFFFFFF #FFFFFFFF @@ -24,7 +26,10 @@ #207AFAFA #800080 #404040 + #909090 + #ffffff + @@ -90,11 +95,14 @@ - - + + \ No newline at end of file diff --git a/BookAStar/BookAStar/App.xaml.cs b/BookAStar/BookAStar/App.xaml.cs index 00809aa3..36361d35 100644 --- a/BookAStar/BookAStar/App.xaml.cs +++ b/BookAStar/BookAStar/App.xaml.cs @@ -357,7 +357,6 @@ namespace BookAStar msg ); DataManager.Instance.ChatUsers.OnPrivateMessage(msg); - }); } diff --git a/BookAStar/BookAStar/BookAStar.csproj b/BookAStar/BookAStar/BookAStar.csproj index c9d2a431..898fa16d 100644 --- a/BookAStar/BookAStar/BookAStar.csproj +++ b/BookAStar/BookAStar/BookAStar.csproj @@ -513,6 +513,9 @@ Designer + + + diff --git a/BookAStar/BookAStar/Images/Chat/talk.png b/BookAStar/BookAStar/Images/Chat/talk.png new file mode 100644 index 00000000..abc00576 Binary files /dev/null and b/BookAStar/BookAStar/Images/Chat/talk.png differ diff --git a/BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs b/BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs index 72f55a43..37153a36 100644 --- a/BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs +++ b/BookAStar/BookAStar/Model/Social/Chat/ChatMessage.cs @@ -1,4 +1,7 @@ -using System; +using BookAStar.Data; +using Newtonsoft.Json; +using System; +using System.Linq; namespace BookAStar.Model.Social.Messaging { @@ -7,5 +10,11 @@ namespace BookAStar.Model.Social.Messaging public DateTime Date { get; set; } public string SenderId { get; set; } public string Message { get; set; } + public bool Read { get; set; } + [JsonIgnore] + public bool FromMe { get + { + return App.ChatHubConnection?.ConnectionId == SenderId; + } } } } diff --git a/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml b/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml index d1e95cd4..4e498204 100644 --- a/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml +++ b/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml @@ -8,7 +8,7 @@ xmlns:converters="clr-namespace:BookAStar.Converters;assembly=BookAStar" xmlns:local="clr-namespace:BookAStar;Assembly:BookAStar" xmlns:extensions="clr-namespace:BookAStar.Extensions;assembly=BookAStar" - > + Style="{StaticResource PageStyle}" > @@ -100,18 +100,15 @@ - - + Orientation = "Horizontal"> - - - + + + + + + diff --git a/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs b/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs index fe7c15bb..bc630dcd 100644 --- a/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs +++ b/BookAStar/BookAStar/Pages/Chat/ChatPage.xaml.cs @@ -44,25 +44,29 @@ namespace BookAStar.Pages.Chat }; chatUserList.BindingContext = DataManager.Instance.ChatUsers; - /* + sendPVButton.Clicked += async (sender, args) => { - string userName = contactPicker.SelectedItem as string; - if (string.IsNullOrEmpty(userName)) return; - var user = DataManager.Current.Contacts.Single( - c => c.UserName == userName); - IsBusy = true; - try - { - await App.ChatHubProxy.Invoke("SendPV", user.ChatHubConnectionId, pvEntry.Text); - pvEntry.Text = null; - } - catch (Exception ex) + var dest = chatUserList.SelectedUser; + if (dest!=null) { - Debug.WriteLine(ex); + IsBusy = true; + try + { + foreach (var cx in dest.ObservableConnections) + { + if (cx.Connected) + await App.ChatHubProxy.Invoke("SendPV", cx.ConnectionId, pvEntry.Text); + } + pvEntry.Text = null; + } + catch (Exception ex) + { + Debug.WriteLine(ex); + } + IsBusy = false; } - IsBusy = false; - };*/ + }; } diff --git a/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml b/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml index 795bbfc1..8fda0eb7 100644 --- a/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml +++ b/BookAStar/BookAStar/Pages/Chat/PrivateChatPage.xaml @@ -1,6 +1,7 @@  + x:Class="BookAStar.Pages.Chat.PrivateChatPage" + Style="{StaticResource PageStyle}"> \ No newline at end of file diff --git a/BookAStar/BookAStar/Pages/DocSigning.xaml b/BookAStar/BookAStar/Pages/DocSigning.xaml index 284d5707..636171f3 100644 --- a/BookAStar/BookAStar/Pages/DocSigning.xaml +++ b/BookAStar/BookAStar/Pages/DocSigning.xaml @@ -3,7 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:signature="clr-namespace:SignaturePad.Forms;assembly=SignaturePad.Forms" xmlns:views="clr-namespace:BookAStar.Views;assembly=BookAStar" - x:Class="BookAStar.ViewModels.Signing.Signing"> + x:Class="BookAStar.ViewModels.Signing.Signing" + Style="{StaticResource PageStyle}"> + x:Class="BookAStar.Pages.EstimatesProviderPage" + Style="{StaticResource PageStyle}"> diff --git a/BookAStar/BookAStar/Pages/UserProfile/AccountChooserPage.xaml b/BookAStar/BookAStar/Pages/UserProfile/AccountChooserPage.xaml index e263319c..e405395f 100644 --- a/BookAStar/BookAStar/Pages/UserProfile/AccountChooserPage.xaml +++ b/BookAStar/BookAStar/Pages/UserProfile/AccountChooserPage.xaml @@ -3,7 +3,8 @@ xmlns:local="clr-namespace:BookAStar;assembly=BookAStar" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="BookAStar.Pages.UserProfile.AccountChooserPage" - Title="{x:Static local:Strings.UserAccounts}" Style="{StaticResource PageStyle}" + Title="{x:Static local:Strings.UserAccounts}" + Style="{StaticResource PageStyle}" xmlns:lc="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms" xmlns:lb="clr-namespace:XLabs.Forms.Behaviors;assembly=XLabs.Forms"> diff --git a/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml b/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml index b5fb276b..8b3ccc0f 100644 --- a/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml +++ b/BookAStar/BookAStar/Pages/UserProfile/DashboardPage.xaml @@ -7,7 +7,7 @@ x:Class="BookAStar.Pages.UserProfile.DashboardPage" xmlns:lc="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms" xmlns:lb="clr-namespace:XLabs.Forms.Behaviors;assembly=XLabs.Forms" - Style="{StaticResource PageStyle}"> + Style="{StaticResource DashboardPageStyle}"> + + + + + + + + + + + + + - + - - - diff --git a/BookAStar/BookAStar/Views/UserListView.xaml.cs b/BookAStar/BookAStar/Views/UserListView.xaml.cs index 507f7fef..e4b080b0 100644 --- a/BookAStar/BookAStar/Views/UserListView.xaml.cs +++ b/BookAStar/BookAStar/Views/UserListView.xaml.cs @@ -1,4 +1,5 @@ using BookAStar.Model; +using BookAStar.Model.Social.Chat; using BookAStar.ViewModels.Messaging; using System; using System.Collections; @@ -18,22 +19,36 @@ namespace BookAStar.Views "ItemsSource", typeof(ChatUserCollection), typeof(UserListView), default(ChatUserCollection), BindingMode.OneWay); - public BindableProperty ItemSelectedProperty = BindableProperty.Create( - "ItemSelected", typeof(ICommand), typeof(UserListView), default(ICommand)); + public BindableProperty ItemSelectedCommandProperty = BindableProperty.Create( + "ItemSelectedCommand", typeof(ICommand), typeof(UserListView), default(ICommand)); public BindableProperty DisableSelectionProperty = BindableProperty.Create( "DisableSelection", typeof(bool), typeof(UserListView), false); + public BindableProperty HasASelectionProperty = BindableProperty.Create( + "HasASelection", typeof(bool), typeof(UserListView), false); + + public BindableProperty SelectedUserProperty = BindableProperty.Create( + "SelectedUser", typeof(ChatUserInfo), typeof(UserListView), default(ChatUserInfo)); + public ChatUserCollection ItemsSource { get { return (ChatUserCollection) GetValue(ItemsSourceProperty); } set { SetValue(ItemsSourceProperty, value); } } - - public ICommand ItemSelected + + public ChatUserInfo SelectedUser + { + get + { + return (ChatUserInfo) GetValue(SelectedUserProperty); + } + } + + public ICommand ItemSelectedCommand { - get { return (ICommand) GetValue(ItemSelectedProperty); } - set { SetValue(ItemSelectedProperty, value); } + get { return (ICommand) GetValue(ItemSelectedCommandProperty); } + set { SetValue(ItemSelectedCommandProperty, value); } } public bool DisableSelection @@ -42,12 +57,18 @@ namespace BookAStar.Views set { SetValue(DisableSelectionProperty, value); } } + public bool HasASelection + { + get { return (bool)GetValue(HasASelectionProperty); } + set { SetValue(HasASelectionProperty, value); } + } + public UserListView() { InitializeComponent(); list.ItemSelected += OnUserSelected; - } + protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); @@ -58,14 +79,19 @@ namespace BookAStar.Views list.EndRefresh(); }); } + public void OnUserSelected(object sender, SelectedItemChangedEventArgs ev) { - if (ItemSelected != null) - if (ItemSelected.CanExecute(ev.SelectedItem)) + if (ItemSelectedCommand != null) + if (ItemSelectedCommand.CanExecute(ev.SelectedItem)) { - ItemSelected.Execute(ev.SelectedItem); + ItemSelectedCommand.Execute(ev.SelectedItem); } - if (DisableSelection) list.SelectedItem = null; + if (DisableSelection) + list.SelectedItem = null; + SetValue(SelectedUserProperty, list.SelectedItem); + HasASelection = list.SelectedItem != null; } + } }