blob: e093cca82eea4b342665d3bff5be44e8dae4b8be [file] [log] [blame]
Nicolas Jager7c409f32016-09-08 09:35:16 -04001/**************************************************************************
2* Copyright (C) 2016 by Savoir-faire Linux *
3* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
4* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
5* *
6* This program is free software; you can redistribute it and/or modify *
7* it under the terms of the GNU General Public License as published by *
8* the Free Software Foundation; either version 3 of the License, or *
9* (at your option) any later version. *
10* *
11* This program is distributed in the hope that it will be useful, *
12* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14* GNU General Public License for more details. *
15* *
16* You should have received a copy of the GNU General Public License *
17* along with this program. If not, see <http://www.gnu.org/licenses/>. *
18**************************************************************************/
19#include "pch.h"
20
21#include "SmartPanelItem.h"
22
23using namespace Windows::ApplicationModel::Core;
24using namespace Platform;
25using namespace Windows::Data::Json;
26using namespace Windows::UI::Core;
27
28using namespace RingClientUWP;
29using namespace RingClientUWP::Controls;
30using namespace ViewModel;
31
32SmartPanelItem::SmartPanelItem()
Nicolas Jagerc551c362016-10-01 19:24:50 -040033{
Nicolas Jager9edbea32016-10-03 09:13:53 -040034 _callId = "";
Nicolas Jager61e6f0e2016-11-04 15:12:08 -040035 videoMuted_ = false;
Nicolas Jager9d85be92016-12-10 16:10:31 -050036 isSelected_ = false;
37 isHovered_ = false;
Nicolas Jager9edbea32016-10-03 09:13:53 -040038
Nicolas Jager083b3ae2016-10-04 08:46:19 -040039 RingD::instance->callPlaced += ref new RingClientUWP::CallPlaced(this, &RingClientUWP::Controls::SmartPanelItem::OncallPlaced);
Nicolas Jagerc551c362016-10-01 19:24:50 -040040}
Nicolas Jager7c409f32016-09-08 09:35:16 -040041
Nicolas Jager61e6f0e2016-11-04 15:12:08 -040042void RingClientUWP::Controls::SmartPanelItem::muteVideo(bool state)
43{
44 videoMuted_ = state;
45 RingD::instance->muteVideo(_callId, state);
46}
47
Nicolas Jager7c409f32016-09-08 09:35:16 -040048void
49SmartPanelItem::NotifyPropertyChanged(String^ propertyName)
50{
51 CoreApplicationView^ view = CoreApplication::MainView;
52 view->CoreWindow->Dispatcher->RunAsync(
Nicolas Jager9edbea32016-10-03 09:13:53 -040053 CoreDispatcherPriority::High,
Nicolas Jager7c409f32016-09-08 09:35:16 -040054 ref new DispatchedHandler([this, propertyName]()
55 {
56 PropertyChanged(this, ref new PropertyChangedEventArgs(propertyName));
57 }));
Nicolas Jager083b3ae2016-10-04 08:46:19 -040058}
59
60void RingClientUWP::Controls::SmartPanelItem::OncallPlaced(Platform::String ^callId)
61{
62 if (_callId == callId) {
atraczyk85e12312016-11-03 10:31:23 -040063 _callStatus = CallStatus::SEARCHING;
Nicolas Jager083b3ae2016-10-04 08:46:19 -040064 }
65}