atraczyk | 25608ed | 2016-09-15 11:12:16 -0400 | [diff] [blame] | 1 | /***************************************************************************
|
| 2 | * Copyright (C) 2016 by Savoir-faire Linux *
|
| 3 | * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
|
| 4 | * Author: Traczyk Andreas <andreas.traczyk@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 "SmartPanelItemsViewModel.h"
|
| 22 |
|
| 23 | using namespace Windows::ApplicationModel::Core;
|
| 24 | using namespace Windows::Data::Json;
|
| 25 | using namespace Windows::Storage;
|
| 26 | using namespace Windows::Storage::Streams;
|
| 27 | using namespace Windows::UI::Core;
|
| 28 |
|
| 29 |
|
| 30 | using namespace RingClientUWP;
|
| 31 | using namespace ViewModel;
|
| 32 |
|
| 33 | SmartPanelItemsViewModel::SmartPanelItemsViewModel()
|
| 34 | {
|
| 35 | itemsList_ = ref new Vector<SmartPanelItem^>();
|
| 36 | }
|
| 37 |
|
| 38 | SmartPanelItem^
|
Nicolas Jager | 083b3ae | 2016-10-04 08:46:19 -0400 | [diff] [blame] | 39 | SmartPanelItemsViewModel::findItem(String^ callId)
|
atraczyk | 25608ed | 2016-09-15 11:12:16 -0400 | [diff] [blame] | 40 | {
|
| 41 | for each (SmartPanelItem^ item in itemsList)
|
Nicolas Jager | 083b3ae | 2016-10-04 08:46:19 -0400 | [diff] [blame] | 42 | if (item->_callId == callId)
|
atraczyk | 25608ed | 2016-09-15 11:12:16 -0400 | [diff] [blame] | 43 | return item;
|
| 44 |
|
| 45 | return nullptr;
|
| 46 | }
|
| 47 |
|
| 48 | SmartPanelItem^
|
| 49 | SmartPanelItemsViewModel::findItem(Contact^ contact)
|
| 50 | {
|
| 51 | for each (SmartPanelItem^ item in itemsList)
|
| 52 | if (item->_contact == contact)
|
| 53 | return item;
|
| 54 |
|
| 55 | return nullptr;
|
| 56 | }
|
| 57 |
|
| 58 | unsigned int
|
Nicolas Jager | 083b3ae | 2016-10-04 08:46:19 -0400 | [diff] [blame] | 59 | SmartPanelItemsViewModel::getIndex(String^ callId)
|
atraczyk | 25608ed | 2016-09-15 11:12:16 -0400 | [diff] [blame] | 60 | {
|
| 61 | unsigned int i;
|
| 62 | for (i = 0; i < itemsList_->Size; i++) {
|
Nicolas Jager | 083b3ae | 2016-10-04 08:46:19 -0400 | [diff] [blame] | 63 | if (itemsList_->GetAt(i)->_callId == callId)
|
atraczyk | 25608ed | 2016-09-15 11:12:16 -0400 | [diff] [blame] | 64 | break;
|
| 65 | }
|
| 66 | return i;
|
| 67 | }
|
| 68 |
|
| 69 | unsigned int
|
| 70 | SmartPanelItemsViewModel::getIndex(Contact^ contact)
|
| 71 | {
|
| 72 | unsigned int i;
|
| 73 | for (i = 0; i < itemsList_->Size; i++) {
|
| 74 | if (itemsList_->GetAt(i)->_contact == contact)
|
| 75 | break;
|
| 76 | }
|
| 77 | return i;
|
| 78 | } |