diff --git a/ContactsViewModel.h b/ContactsViewModel.h
index b4757fd866df11ac9fb0f4e842cfce4f0c54ac48..95feadf455693b8e0e7fb4e8303d295e454735ab 100644
--- a/ContactsViewModel.h
+++ b/ContactsViewModel.h
@@ -21,7 +21,7 @@ using namespace Platform::Collections;
namespace RingClientUWP
{
-delegate void NewContactSelected(Contact^ contact);
+delegate void NewContactSelected();
delegate void NoContactSelected();
namespace ViewModel {
@@ -55,7 +55,7 @@ internal:
oldItem_ = currentItem_;
currentItem_ = value;
if (value)
- newContactSelected(currentItem_);
+ newContactSelected();
else
noContactSelected();
}
diff --git a/MainPage.xaml b/MainPage.xaml
index 2fed2bc2a0c84917aedee5ccd1c0b04d0daff87a..718f292ed1009149d057875e00bfab1e0aff0482 100644
--- a/MainPage.xaml
+++ b/MainPage.xaml
@@ -62,15 +62,24 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainPage.xaml.cpp b/MainPage.xaml.cpp
index 32f3bbd78299edb79fcb2d69a9c2698055cdf714..d0e1d25b29f5d6ffb7173deb618c9e77fcd05e0b 100644
--- a/MainPage.xaml.cpp
+++ b/MainPage.xaml.cpp
@@ -17,6 +17,8 @@
**************************************************************************/
#include "pch.h"
+#include "ContactsViewModel.h"
+#include "MessageTextPage.xaml.h"
#include "SmartPanel.xaml.h"
#include "RingConsolePanel.xaml.h"
#include "VideoPage.xaml.h"
@@ -26,6 +28,7 @@
using namespace RingClientUWP;
using namespace RingClientUWP::Views;
+using namespace RingClientUWP::ViewModel;
using namespace Platform;
using namespace Windows::ApplicationModel::Core;
@@ -54,6 +57,15 @@ MainPage::MainPage()
_smartPanel_->Navigate(TypeName(RingClientUWP::Views::SmartPanel::typeid));
_consolePanel_->Navigate(TypeName(RingClientUWP::Views::RingConsolePanel::typeid));
_videoFrame_->Navigate(TypeName(RingClientUWP::Views::VideoPage::typeid));
+ _messageTextFrame_->Navigate(TypeName(RingClientUWP::Views::MessageTextPage::typeid));
+
+ /* connect to delegates */
+ ContactsViewModel::instance->newContactSelected += ref new NewContactSelected([&]() {
+ showFrame(_messageTextFrame_);
+ });
+ ContactsViewModel::instance->noContactSelected += ref new NoContactSelected([&]() {
+ showFrame(_welcomeFrame_);
+ });
}
void
@@ -69,3 +81,20 @@ void RingClientUWP::MainPage::_toggleSmartBoxButton__Click(Platform::Object^ sen
{
_innerSplitView_->IsPaneOpen = !_innerSplitView_->IsPaneOpen;
}
+
+void
+RingClientUWP::MainPage::showFrame(Windows::UI::Xaml::Controls::Frame^ frame)
+{
+ _navGrid_->SetRow(_welcomeFrame_, 0);
+ _navGrid_->SetRow(_messageTextFrame_, 0);
+ _navGrid_->SetRow(_videoFrame_, 0);
+
+ if (frame == _welcomeFrame_) {
+ _navGrid_->SetRow(_welcomeFrame_, 1);
+ } else if (frame == _videoFrame_) {
+ _navGrid_->SetRow(_videoFrame_, 1);
+ } else if (frame == _messageTextFrame_) {
+ _navGrid_->SetRow(_messageTextFrame_, 1);
+ dynamic_cast(_messageTextFrame_->Content)->updatePageContent();
+ }
+}
diff --git a/MainPage.xaml.h b/MainPage.xaml.h
index 868add8f38d8df6aa19306e426fb4c32a1da56e4..e2a9e0fd2954ee1709cce1564c49f38fe44870ba 100644
--- a/MainPage.xaml.h
+++ b/MainPage.xaml.h
@@ -18,6 +18,7 @@
**************************************************************************/
#include "MainPage.g.h"
+using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Input;
namespace RingClientUWP
@@ -33,5 +34,6 @@ protected:
virtual void OnKeyDown(KeyRoutedEventArgs^ e) override;
private:
void _toggleSmartBoxButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+ void showFrame(Windows::UI::Xaml::Controls::Frame^ frame);
};
}
\ No newline at end of file
diff --git a/MessageTextPage.xaml b/MessageTextPage.xaml
new file mode 100644
index 0000000000000000000000000000000000000000..b505878bf3628667da3aa612cdc660073b67273d
--- /dev/null
+++ b/MessageTextPage.xaml
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MessageTextPage.xaml.cpp b/MessageTextPage.xaml.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c32650428d22bd1b97ac0d7ba2f24354a1ba63fb
--- /dev/null
+++ b/MessageTextPage.xaml.cpp
@@ -0,0 +1,89 @@
+/**************************************************************************
+* Copyright (C) 2016 by Savoir-faire Linux *
+* Author: Jäger Nicolas *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program. If not, see . *
+**************************************************************************/
+#include "pch.h"
+
+#include "ContactsViewModel.h"
+#include "MainPage.xaml.h"
+
+#include "MessageTextPage.xaml.h"
+
+using namespace RingClientUWP::Views;
+using namespace RingClientUWP::ViewModel;
+
+using namespace Platform;
+using namespace Windows::Foundation;
+using namespace Windows::Foundation::Collections;
+using namespace Windows::UI::Xaml;
+using namespace Windows::UI::Xaml::Controls;
+using namespace Windows::UI::Xaml::Controls::Primitives;
+using namespace Windows::UI::Xaml::Data;
+using namespace Windows::UI::Xaml::Documents;
+using namespace Windows::UI::Xaml::Input;
+using namespace Windows::UI::Xaml::Media;
+using namespace Windows::UI::Xaml::Navigation;
+
+MessageTextPage::MessageTextPage()
+{
+ InitializeComponent();
+}
+
+void
+RingClientUWP::Views::MessageTextPage::OnNavigatedTo(NavigationEventArgs ^ e)
+{
+ updatePageContent();
+}
+
+void
+RingClientUWP::Views::MessageTextPage::updatePageContent()
+{
+ auto contact = ContactsViewModel::instance->selectedContact;
+ if (!contact)
+ return;
+
+ _title_->Text = contact->name_;
+
+ _messagesWindowOutput_->Children->Clear();
+}
+
+void
+RingClientUWP::Views::MessageTextPage::_sendBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+{
+ sendMessage();
+}
+
+void
+RingClientUWP::Views::MessageTextPage::_messageTextBox__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e)
+{
+ if (e->Key == Windows::System::VirtualKey::Enter) {
+ sendMessage();
+ }
+}
+
+void
+RingClientUWP::Views::MessageTextPage::sendMessage()
+{
+ auto contact = ContactsViewModel::instance->selectedContact;
+ auto txt = _messageTextBox_->Text;
+
+ /* empty the textbox */
+ _messageTextBox_->Text = "";
+
+ if (!contact || txt->IsEmpty())
+ return;
+
+}
diff --git a/MessageTextPage.xaml.h b/MessageTextPage.xaml.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac87884bd20426ec7f15599aef87cd6a75622d1b
--- /dev/null
+++ b/MessageTextPage.xaml.h
@@ -0,0 +1,41 @@
+/**************************************************************************
+* Copyright (C) 2016 by Savoir-faire Linux *
+* Author: Jäger Nicolas *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program. If not, see . *
+**************************************************************************/
+#pragma once
+
+#include "MessageTextPage.g.h"
+
+namespace RingClientUWP
+{
+namespace Views
+{
+public ref class MessageTextPage sealed
+{
+public:
+ MessageTextPage();
+ void updatePageContent();
+
+protected:
+ virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
+
+private:
+ void _sendBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+ void _messageTextBox__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
+ void sendMessage();
+};
+}
+}
diff --git a/SmartPanel.xaml b/SmartPanel.xaml
index 780d6a559109f35797186cc201629661cc3cae72..810edb5b9938678161048879dc5fc12c8c2b87cf 100644
--- a/SmartPanel.xaml
+++ b/SmartPanel.xaml
@@ -333,18 +333,19 @@
+ Text=""/>
diff --git a/SmartPanel.xaml.cpp b/SmartPanel.xaml.cpp
index 42c8415032b28ef6e0341d8b43cef33cab6db717..f2614f3a62e7e551ce4f8a4702d8c92411d3857d 100644
--- a/SmartPanel.xaml.cpp
+++ b/SmartPanel.xaml.cpp
@@ -1,4 +1,4 @@
-/**************************************************************************
+/***************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas *
* *
@@ -146,3 +146,12 @@ void RingClientUWP::Views::SmartPanel::_avatarWebcamCaptureBtn__Click(Platform::
});
}
+
+
+void
+SmartPanel::_smartList__SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e)
+{
+ auto listbox = safe_cast(sender);
+ auto contact = safe_cast(listbox->SelectedItem);
+ ContactsViewModel::instance->selectedContact = contact;
+}
diff --git a/SmartPanel.xaml.h b/SmartPanel.xaml.h
index 2ef2cc68e9c3c69b848141a321d6157c7ef7ab83..168f3407683419ac91ea40440448bad81a040278 100644
--- a/SmartPanel.xaml.h
+++ b/SmartPanel.xaml.h
@@ -50,6 +50,7 @@ private:
void _createAccountYes__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _createAccountNo__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void _avatarWebcamCaptureBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+ void _smartList__SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
};
}
}
\ No newline at end of file
diff --git a/ring-client-uwp.vcxproj b/ring-client-uwp.vcxproj
index 1b76f4f5f1e6e67f659500f38e6364532ac444af..ec7a626a65bfa02e2129c5b4b64f870157d9e8ab 100644
--- a/ring-client-uwp.vcxproj
+++ b/ring-client-uwp.vcxproj
@@ -162,6 +162,9 @@
+
+ MessageTextPage.xaml
+
App.xaml
@@ -175,6 +178,9 @@
SmartPanel.xaml
+
+ VideoPage.xaml
+
WelcomePage.xaml
@@ -186,9 +192,11 @@
Designer
+
+
@@ -241,6 +249,9 @@
MainPage.xaml
+
+ MessageTextPage.xaml
+
Create
Create
@@ -255,6 +266,9 @@
SmartPanel.xaml
+
+ VideoPage.xaml
+
WelcomePage.xaml
diff --git a/ring-client-uwp.vcxproj.filters b/ring-client-uwp.vcxproj.filters
index 88b0355f5583dbe17400d21bae8f321d1c2b8999..4b8a43392b6b23ca955c1a763f97532165f209a5 100644
--- a/ring-client-uwp.vcxproj.filters
+++ b/ring-client-uwp.vcxproj.filters
@@ -152,6 +152,9 @@
Views
+
+ Views
+