diff --git a/Contact.cpp b/Contact.cpp index 0b5c93e53b8681191e9c38728a11ee3d09c46815..e92cf8139958990edaeb793f2ee9e752c07a446e 100644 --- a/Contact.cpp +++ b/Contact.cpp @@ -36,7 +36,8 @@ using namespace ViewModel; Contact::Contact(String^ name, String^ ringID, String^ GUID, - unsigned int unreadmessages) + unsigned int unreadmessages, + ContactStatus contactStatus) { vCard_ = ref new VCardUtils::VCard(this); @@ -73,6 +74,8 @@ Contact::Contact(String^ name, _vcardUID = ""; _avatarImage = ref new String(L"ms-appx:///Assets/TESTS/contactAvatar.png"); _displayName = ""; + + contactStatus_ = contactStatus; } void diff --git a/Contact.h b/Contact.h index 4cb7ba328a452039916ae22944becdb0d372fc55..84a7c3eb461fbf0c008e2cac3134e97e6fce6809 100644 --- a/Contact.h +++ b/Contact.h @@ -43,12 +43,23 @@ ref class Conversation; public ref class Contact sealed : public INotifyPropertyChanged { public: - Contact(String^ name, String^ ringID, String^ GUID, unsigned int unreadmessages); + Contact(String^ name, String^ ringID, String^ GUID, unsigned int unreadmessages, ContactStatus contactStatus); JsonObject^ ToJsonObject(); virtual event PropertyChangedEventHandler^ PropertyChanged; - property String^ name_; + property String^ _name + { + String^ get() + { + return name_; + } + void set(String^ value) + { + name_ = value; + NotifyPropertyChanged("_name"); + } + } property String^ ringID_; property String^ GUID_; @@ -122,6 +133,19 @@ public: } } + property ContactStatus _contactStatus + { + ContactStatus get() + { + return contactStatus_; + } + void set(ContactStatus value) + { + contactStatus_ = value; + NotifyPropertyChanged("_contactStatus"); + } + } + VCardUtils::VCard^ getVCard(); internal: @@ -142,6 +166,8 @@ private: String^ avatarImage_; String^ displayName_; Windows::UI::Xaml::GridLength contactBarHeight_ = 0; + ContactStatus contactStatus_; + String^ name_; }; } diff --git a/ContactsViewModel.cpp b/ContactsViewModel.cpp index 74e995b94e909b0dad2bd0718972c83e342f53a7..6183254fb2d643057cd52d4110c8688b5b5fd02f 100644 --- a/ContactsViewModel.cpp +++ b/ContactsViewModel.cpp @@ -51,6 +51,8 @@ ContactsViewModel::ContactsViewModel() return; } + RingD::instance->lookUpAddress(fromRingId); + contact->_conversation->addMessage(""/* date not yet used*/, MSG_FROM_CONTACT, payload); /* save contacts conversation to disk */ @@ -67,6 +69,9 @@ ContactsViewModel::ContactsViewModel() }); RingD::instance->incomingMessage += ref new RingClientUWP::IncomingMessage(this, &RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage); + + RingD::instance->registeredNameFound += ref new RingClientUWP::RegisteredNameFound(this, &RingClientUWP::ViewModel::ContactsViewModel::OnregisteredNameFound); + } Contact^ // refacto : remove "byName" @@ -74,7 +79,7 @@ ContactsViewModel::findContactByName(String^ name) { auto trimmedName = Utils::Trim(name); for each (Contact^ contact in contactsList_) - if (contact->name_ == trimmedName) + if (contact->_name == trimmedName) return contact; return nullptr; @@ -90,12 +95,12 @@ Contact ^ RingClientUWP::ViewModel::ContactsViewModel::findContactByRingId(Strin } Contact^ -ContactsViewModel::addNewContact(String^ name, String^ ringId) +ContactsViewModel::addNewContact(String^ name, String^ ringId, ContactStatus contactStatus) { auto trimmedName = Utils::Trim(name); if (contactsList_ && !findContactByName(trimmedName)) { //if (contactsList_ && !findContactByName(trimmedName) && !findContactByRingId(ringId)) { - Contact^ contact = ref new Contact(trimmedName, ringId, nullptr, 0); + Contact^ contact = ref new Contact(trimmedName, ringId, nullptr, 0, contactStatus); contactsList_->Append(contact); saveContactsToFile(); contactAdded(contact); @@ -178,13 +183,13 @@ ContactsViewModel::Destringify(String^ data) accountIdAssociated = contactObject->GetNamedString(accountIdAssociatedKey); vcardUID = contactObject->GetNamedString(vcardUIDKey); } - auto contact = ref new Contact(name, ringid, guid, unreadmessages); + auto contact = ref new Contact(name, ringid, guid, unreadmessages, ContactStatus::READY); contact->_displayName = displayname; contact->_accountIdAssociated = accountIdAssociated; // contact image contact->_vcardUID = vcardUID; std::string contactImageFile = RingD::instance->getLocalFolder() + ".vcards\\" - + Utils::toString(contact->_vcardUID) + ".png"; + + Utils::toString(contact->_vcardUID) + ".png"; if (Utils::fileExists(contactImageFile)) { contact->_avatarImage = Utils::toPlatformString(contactImageFile); } @@ -233,10 +238,23 @@ void RingClientUWP::ViewModel::ContactsViewModel::OnincomingMessage(Platform::St saveContactsToFile(); } } + } void ContactsViewModel::modifyContact(Contact^ contact) { contactDataModified(contact); -} +} + + +void RingClientUWP::ViewModel::ContactsViewModel::OnregisteredNameFound(RingClientUWP::LookupStatus status, const std::string &address, const std::string &name) +{ + if (status == LookupStatus::SUCCESS) { + for each (Contact^ contact in contactsList_) + if (contact->ringID_ == Utils::toPlatformString(address)) { + contact->_name = Utils::toPlatformString(name); + saveContactsToFile(); + } + } +} diff --git a/ContactsViewModel.h b/ContactsViewModel.h index bda642e30d462e2a7bc2166244a82c55c8967824..4be7753c478da7bc5fb0f1bd8fa3b14ca512a353 100644 --- a/ContactsViewModel.h +++ b/ContactsViewModel.h @@ -47,7 +47,7 @@ internal: /* functions */ Contact^ findContactByName(String^ name); Contact^ findContactByRingId(String^ ringId); - Contact^ addNewContact(String^ name, String^ ringId); + Contact^ addNewContact(String^ name, String^ ringId, ContactStatus contactStatus = ContactStatus::READY); void saveContactsToFile(); void openContactsFromFile(); String^ Stringify(); @@ -76,6 +76,7 @@ private: Contact^ oldItem_; void OnincomingMessage(Platform::String ^callId, Platform::String ^payload); + void OnregisteredNameFound(RingClientUWP::LookupStatus status, const std::string &address, const std::string &name); }; } } diff --git a/Globals.h b/Globals.h index 957c1a23810272fe12fa8a8f8e49484f1eda5333..ad6a493cd20885ee546054217d2e89ea8734e051 100644 --- a/Globals.h +++ b/Globals.h @@ -20,4 +20,9 @@ public enum class LookupStatus { ERRORR // one cannot simply use ERROR }; +public enum class ContactStatus { + WAITING_FOR_ACTIVATION, // waiting for lookup + READY +}; + } \ No newline at end of file diff --git a/MainPage.xaml.cpp b/MainPage.xaml.cpp index 61d51099660dbeef741ce4edb455cb6b15407f75..f219fb1b1632ea98086a724cea2a21c70d5c15c9 100644 --- a/MainPage.xaml.cpp +++ b/MainPage.xaml.cpp @@ -96,7 +96,7 @@ MainPage::MainPage() RingD::instance->registrationStateRegistered += ref new RingClientUWP::RegistrationStateRegistered(this, &RingClientUWP::MainPage::OnregistrationStateRegistered); RingD::instance->callPlaced += ref new RingClientUWP::CallPlaced(this, &RingClientUWP::MainPage::OncallPlaced); - RingD::instance->setLoadingStatusText += ref new SetLoadingStatusText([this](String^ statusText, String^ color){ + RingD::instance->setLoadingStatusText += ref new SetLoadingStatusText([this](String^ statusText, String^ color) { _loadingStatus_->Text = statusText; auto col = Utils::ColorFromString(color); auto brush = ref new Windows::UI::Xaml::Media::SolidColorBrush(col); diff --git a/MessageTextPage.xaml b/MessageTextPage.xaml index a2cc4f619535517d144763275e1592f7367b56fd..c09347c6a2bd687c7a685bbf226ed064567acc97 100644 --- a/MessageTextPage.xaml +++ b/MessageTextPage.xaml @@ -136,13 +136,13 @@ <Grid Background="#FFF2F2F2"> <Grid.RowDefinitions> - <RowDefinition Height="61" /> + <RowDefinition Height="auto" /> <RowDefinition Height="*"/> <RowDefinition Height="auto" /> </Grid.RowDefinitions> <Grid Grid.Row="0" Background="White" - Height="61"> + Height="auto"> <Grid.ColumnDefinitions> <ColumnDefinition Width="60"/> <ColumnDefinition Width="auto"/> @@ -157,7 +157,8 @@ </Ellipse> <Grid Grid.Column="1"> <Grid.RowDefinitions> - <RowDefinition Height="31" /> + <RowDefinition Height="25" /> + <RowDefinition Height="25" /> <RowDefinition Height="30" /> </Grid.RowDefinitions> <Grid Grid.Row="0"> @@ -169,7 +170,7 @@ </Grid> <TextBlock x:Name="_title_" Grid.Column="0" - Text="[TEXT MISSING]" + Text="" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" @@ -186,7 +187,14 @@ </ComboBox.ItemTemplate> </ComboBox> </Grid> - <Grid Grid.Row="1"> + <TextBlock x:Name="_profilName_" + Grid.Row="1" + Text="" + FontStyle="Italic" + VerticalAlignment="Center" + FontSize="16" + Margin="4,0,4,0" /> + <Grid Grid.Row="2"> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="auto"/> diff --git a/MessageTextPage.xaml.cpp b/MessageTextPage.xaml.cpp index bef1e38a141a194e99229fffcb3583ee9688577d..5094ae7a4557130ffa0263becf207076380bec16 100644 --- a/MessageTextPage.xaml.cpp +++ b/MessageTextPage.xaml.cpp @@ -42,6 +42,7 @@ using namespace Windows::UI::Core; using namespace Windows::UI::Popups; +// refacto : the message text page should be MessageTextPage::MessageTextPage() { InitializeComponent(); @@ -69,13 +70,18 @@ RingClientUWP::Views::MessageTextPage::updatePageContent() return; /* show the name of contact on the page */ - _title_->Text = contact->name_; + _title_->Text = contact->_name; + _profilName_->Text = contact->_displayName; String^ image_path = Utils::toPlatformString(RingD::instance->getLocalFolder()) + ".vcards\\" + contact->_vcardUID + ".png"; if (Utils::fileExists(Utils::toString(image_path))) { auto uri = ref new Windows::Foundation::Uri(image_path); _contactBarAvatar_->ImageSource = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage(uri); } + else { + auto uri = ref new Windows::Foundation::Uri("ms-appx:///Assets/TESTS/contactAvatar.png"); + _contactBarAvatar_->ImageSource = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage(uri); + } /* show messages */ _messagesList_->ItemsSource = contact->_conversation->_messages; diff --git a/RingConsolePanel.xaml.cpp b/RingConsolePanel.xaml.cpp index 18292d198b0f9b5f945509a1c685a028737bd2c3..ddc177749b6ebdd639c4818cfe430a2e0101db1f 100644 --- a/RingConsolePanel.xaml.cpp +++ b/RingConsolePanel.xaml.cpp @@ -151,7 +151,7 @@ void RingConsolePanel::sendCommand() auto list = ContactsViewModel::instance->contactsList; MSG_("list of calls returned by the daemon :"); for (auto contact : list) { - MSG_("name : " + Utils::toString(contact->name_)); + MSG_("name : " + Utils::toString(contact->_name)); MSG_("ringId : " + Utils::toString(contact->ringID_)); } return; diff --git a/RingD.cpp b/RingD.cpp index 07a5988e2093a38641cd74d34f757f0fc547bf80..07a3c3f1b73d9e9985261c4774876a3162f44dfb 100644 --- a/RingD.cpp +++ b/RingD.cpp @@ -906,7 +906,9 @@ RingD::dequeueTasks() item->_callId = Utils::toPlatformString(callId); //MSG_("$1 place call with id : " + Utils::toString(item->_callId)); - callPlaced(Utils::toPlatformString(callId)); + /* if for any reason there is no callid, do not propagate the event*/ + if (!callId.empty()) + callPlaced(Utils::toPlatformString(callId)); })); } @@ -1118,7 +1120,7 @@ RingD::dequeueTasks() } case Request::LookUpAddress: { - //DRing::lookupAddress(accountID.toStdString(), nameServiceURL.toStdString(), address.toStdString()); + DRing::lookupAddress("", "", Utils::toString(task->_address)); break; } case Request::RegisterName: @@ -1129,12 +1131,14 @@ RingD::dequeueTasks() if (accountDetails[DRing::Account::ConfProperties::USERNAME].empty()) registerName_new(task->_accountId_new, task->_password_new, task->_publicUsername_new); else + { result = DRing::registerName(task->_accountId_new, task->_password_new, task->_publicUsername_new); - CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High, - ref new DispatchedHandler([=]() { - nameRegistred(result); - })); + CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High, + ref new DispatchedHandler([=]() { + nameRegistred(result); + })); + } //const wchar_t* toto = task->_accountId->Data(); diff --git a/SmartPanel.xaml b/SmartPanel.xaml index 89ecb167b716a5c0a811404c259a4a0616743284..019d21f3f6d347843151c2ad27f914e75748ea7b 100644 --- a/SmartPanel.xaml +++ b/SmartPanel.xaml @@ -36,6 +36,7 @@ <views:AccountTypeToSourceImage x:Key="_AccountTypeToSourceImage_" /> <views:AccountSelectedToVisibility x:Key="_AccountSelectedToVisibility_" /> <views:CollapseEmptyString x:Key="_CollapseEmptyString_" /> + <views:ContactStatusNotification x:Key="_ContactStatusNotification_" /> <!-- template for contacts. --> <DataTemplate x:Key="ContactTemplate" @@ -81,7 +82,7 @@ <!-- name of the contact. --> <TextBlock x:Name="_contactName_" Grid.Row="0" - Text="{x:Bind name_}" + Text="{x:Bind _name, Mode=OneWay}" TextTrimming="CharacterEllipsis"> </TextBlock> </Grid> @@ -152,7 +153,17 @@ <RowDefinition Height="auto"/> </Grid.RowDefinitions> <!--helper to detect mouse overing--> - <Rectangle Fill="Transparent" Grid.Row="0"/> + <Rectangle Fill="Transparent" + Grid.Row="0"/> + <!-- curtain over item with contact not ready (e.g. lookup is in progress) --> + <Rectangle Fill="White" + Grid.Row="0" + Canvas.ZIndex="2" + Opacity="0.6" + Visibility="{x:Bind _contact._contactStatus, Converter={StaticResource _ContactStatusNotification_}, Mode=OneWay}"/> + <ProgressBar Canvas.ZIndex="3" + Visibility="{x:Bind _contact._contactStatus, Converter={StaticResource _ContactStatusNotification_}, Mode=OneWay}" + IsIndeterminate="True"/> <!-- contact. --> <Grid Grid.Row="0"> <Grid.ColumnDefinitions> @@ -207,9 +218,10 @@ <RowDefinition Height="30"/> </Grid.RowDefinitions> <!-- name of the contact. --> + <!-- (XXX) Foreground="{x:Bind _contact._contactStatus, Converter={StaticResource _ContactStatusNotification_}, Mode=OneWay}"--> <TextBlock x:Name="_contactName_" Grid.Row="0" - Text="{x:Bind _contact.name_}" + Text="{x:Bind _contact._name, Mode=OneWay}" TextTrimming="CharacterEllipsis"> </TextBlock> <!-- call button. --> @@ -381,10 +393,15 @@ <!--sub menus like the accounts list or the share menu are just below, technicaly they are nested inside the same row. To summon them we use the visibility of their own grid, by linking it to a toggle button--> + + + + </Grid> + <!-- smartList and settings. --> + <Grid Grid.Row="1"> <!-- accounts menu. --> <Grid x:Name="_accountsMenuGrid_" - MaxHeight="350" - Grid.Row="1" + Grid.Row="0" Visibility="Collapsed" Background="#3bc1d3"> <Grid.RowDefinitions> @@ -420,17 +437,183 @@ Style="{StaticResource ButtonStyle5}"/> </StackPanel> </Grid> + <!-- account edition menu. --> + <Grid x:Name="_accountEditionGrid_" + Grid.Row="0" + Visibility="Collapsed" + Background="#3bc1d3"> + <Grid.RowDefinitions> + <RowDefinition Height="*"/> + <RowDefinition Height="30"/> + </Grid.RowDefinitions> + <ScrollViewer x:Name="_scrollViewerEditionMenu_" + Grid.Row="0"> + <StackPanel Orientation="Vertical" + Padding="10,0" + Grid.Row="0" + Background="#FFE4F1F9"> + <!-- alias sub menu. --> + <StackPanel Orientation="Horizontal" + Margin="0,20"> + <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" + Margin="0,0,10,0" + Text=""/> + <TextBlock Text="Alias"/> + </StackPanel> + <Grid Margin="10,0,10,10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="25"/> + </Grid.ColumnDefinitions> + <TextBox x:Name="_accountAliasTextBoxEdition_" + Grid.Column="0" + TextChanged="_accountAliasTextBoxEdition__TextChanged" + PlaceholderText="Enter alias"/> + <TextBlock x:Name="_accountAliasValidEdition_" + Grid.Column="1" + Padding="10,0" + Style="{StaticResource TextSegoeStyle-20pt-green}" + Visibility="Collapsed" + Text=""/> + <TextBlock x:Name="_accountAliasInvalidEdition_" + Grid.Column="1" + Padding="10,0" + Style="{StaticResource TextSegoeStyle-20pt-red}" + Text=""/> + </Grid> + <!-- edition sub menu. --> + <StackPanel x:Name="_ringStackEdition_"> + <!-- register account on blockachain --> + <StackPanel Orientation="Horizontal" + Margin="0,20"> + <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" + Margin="0,0,10,0" + Text=""/> + <TextBlock Text="Register public username"/> + </StackPanel> + <ToggleSwitch x:Name="_RegisterStateEdition_" + IsOn="True" + Toggled="_RegisterStateEdition__Toggled" + Margin="0,10"/> + <TextBlock x:Name="_whatWilHappenEdition_" + Margin="0,10,0,0" + Style="{StaticResource BodyTextBlockStyle}" + Text="peoples will find you with your username"/> + <HyperlinkButton Content="Learn more" + Margin="0,0,0,10" + NavigateUri="http://ring.cx"/> + <Grid Margin="10"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="25"/> + </Grid.ColumnDefinitions> + <TextBox x:Name="_usernameTextBoxEdition_" + Grid.Column="0" + PlaceholderText="Enter your full name" + KeyUp="_usernameTextBoxEdition__KeyUp"/> + <TextBlock x:Name="_usernameValidEdition_" + Grid.Column="1" + Padding="10,0" + Style="{StaticResource TextSegoeStyle-20pt-green}" + Visibility="Collapsed" + Text=""/> + <TextBlock x:Name="_usernameInvalidEdition_" + Grid.Column="1" + Padding="10,0" + Style="{StaticResource TextSegoeStyle-20pt-red}" + Text=""/> + </Grid> + <Button x:Name="_registerOnBlockchainEdition_" + Content="register" + Visibility="Collapsed" + Click="_registerOnBlockchainEdition__Click"/> + <StackPanel Orientation="Horizontal" Margin="10"> + <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" + Text=""/> + <TextBlock Text="UPnP" Margin="10"/> + </StackPanel> + <ToggleSwitch x:Name="_upnpState_" + Margin="20,10"/> + </StackPanel> + <!-- SIP parameters. --> + <StackPanel x:Name="_sipAccountStackEdition_" + Visibility="Collapsed"> + <StackPanel Orientation="Horizontal" + Margin="10"> + <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" + Text=""/> + <TextBlock Text="SIP account parameters" + Margin="10"/> + </StackPanel> + <TextBox x:Name="_sipHostnameEdition_" + Margin="10" + PlaceholderText="Enter hostname"/> + <TextBox x:Name="_sipUsernameEditionTextBox_" + Margin="10" + PlaceholderText="Enter username"/> + <PasswordBox x:Name="_sipPasswordEdition_" + Margin="10" + PlaceholderText="Enter password"/> + </StackPanel> + <!-- delete account sub menu. --> + <StackPanel Orientation="Horizontal" Margin="10"> + <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" + Text=""/> + <TextBlock Text="Delete account" Margin="10"/> + </StackPanel> + <ToggleSwitch x:Name="_deleteAccountEdition_" + Toggled="_deleteAccountEdition__Toggled" + Margin="20,10"/> + <TextBlock x:Name="_whatWilHappendeleteRingAccountEdition_" + Margin="0,10,0,0" + Style="{StaticResource BodyTextBlockStyle}" + Foreground="Red" + Visibility="Collapsed" + Text="Your account will be deleted from this computer. Other devices are not affected. Your public registration can never be deleted."/> + <TextBlock x:Name="_whatWilHappendeleteSipAccountEdition_" + Margin="0,10,0,0" + Style="{StaticResource BodyTextBlockStyle}" + Foreground="Red" + Visibility="Collapsed" + Text="Your account will be deleted from this computer."/> + <HyperlinkButton x:Name="_learnMoreDeleteAccountEdition_" + Content="Learn more" + Visibility="Collapsed" + Margin="0,0,0,10" + NavigateUri="http://ring.cx"/> + </StackPanel> + </ScrollViewer> + <!-- buttons yes/no to accept the modification. --> + <Grid Grid.Row="1"> + <StackPanel Orientation="Horizontal" + HorizontalAlignment="Center"> + <Button x:Name="_acceptAccountModification_" + Grid.Row="1" + VerticalAlignment="Center" + HorizontalAlignment="Center" + Content="" + Click="_acceptAccountModification__Click" + Style="{StaticResource ButtonStyle5}"/> + <Button x:Name="_cancelAccountModification_" + Grid.Row="1" + VerticalAlignment="Center" + HorizontalAlignment="Center" + Content="" + Click="_cancelAccountModification__Click" + Style="{StaticResource ButtonStyle5}"/> + </StackPanel> + </Grid> + </Grid> <!-- account creation menu. --> <Grid x:Name="_accountCreationMenuGrid_" - Grid.Row="2" + Grid.Row="0" Visibility="Collapsed" Background="#3bc1d3"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> - <ScrollViewer Grid.Row="0" - MaxHeight="400"> + <ScrollViewer Grid.Row="0"> <StackPanel Orientation="Vertical" Padding="10,0" Background="#FFE4F1F9"> @@ -635,7 +818,7 @@ <!-- add account menu. --> <Grid x:Name="_accountAddMenuGrid_" Visibility="Collapsed" - Grid.Row="2" + Grid.Row="0" Background="#3bc1d3"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> @@ -711,184 +894,9 @@ </StackPanel> </Grid> </Grid> - <!--<StackPanel Orientation="Horizontal" - Margin="0,20"> - <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" - Margin="0,0,10,0" - Text=""/> - <TextBlock Text="Alias"/> - </StackPanel>--> - <!-- account edition menu. --> - <Grid x:Name="_accountEditionGrid_" - Grid.Row="2" - Visibility="Collapsed" - Background="#3bc1d3"> - <Grid.RowDefinitions> - <RowDefinition Height="*"/> - <RowDefinition Height="30"/> - </Grid.RowDefinitions> - <ScrollViewer x:Name="_scrollViewerEditionMenu_" - Grid.Row="0" - MaxHeight="400"> - <StackPanel Orientation="Vertical" - Padding="10,0" - Grid.Row="0" - Background="#FFE4F1F9"> - <!-- alias sub menu. --> - <StackPanel Orientation="Horizontal" - Margin="0,20"> - <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" - Margin="0,0,10,0" - Text=""/> - <TextBlock Text="Alias"/> - </StackPanel> - <Grid Margin="10,0,10,10"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*"/> - <ColumnDefinition Width="25"/> - </Grid.ColumnDefinitions> - <TextBox x:Name="_accountAliasTextBoxEdition_" - Grid.Column="0" - TextChanged="_accountAliasTextBoxEdition__TextChanged" - PlaceholderText="Enter alias"/> - <TextBlock x:Name="_accountAliasValidEdition_" - Grid.Column="1" - Padding="10,0" - Style="{StaticResource TextSegoeStyle-20pt-green}" - Visibility="Collapsed" - Text=""/> - <TextBlock x:Name="_accountAliasInvalidEdition_" - Grid.Column="1" - Padding="10,0" - Style="{StaticResource TextSegoeStyle-20pt-red}" - Text=""/> - </Grid> - <!-- edition sub menu. --> - <StackPanel x:Name="_ringStackEdition_"> - <!-- register account on blockachain --> - <StackPanel Orientation="Horizontal" - Margin="0,20"> - <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" - Margin="0,0,10,0" - Text=""/> - <TextBlock Text="Register public username"/> - </StackPanel> - <ToggleSwitch x:Name="_RegisterStateEdition_" - IsOn="True" - Toggled="_RegisterStateEdition__Toggled" - Margin="0,10"/> - <TextBlock x:Name="_whatWilHappenEdition_" - Margin="0,10,0,0" - Style="{StaticResource BodyTextBlockStyle}" - Text="peoples will find you with your username"/> - <HyperlinkButton Content="Learn more" - Margin="0,0,0,10" - NavigateUri="http://ring.cx"/> - <Grid Margin="10"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*"/> - <ColumnDefinition Width="25"/> - </Grid.ColumnDefinitions> - <TextBox x:Name="_usernameTextBoxEdition_" - Grid.Column="0" - PlaceholderText="Enter your full name" - KeyUp="_usernameTextBoxEdition__KeyUp"/> - <TextBlock x:Name="_usernameValidEdition_" - Grid.Column="1" - Padding="10,0" - Style="{StaticResource TextSegoeStyle-20pt-green}" - Visibility="Collapsed" - Text=""/> - <TextBlock x:Name="_usernameInvalidEdition_" - Grid.Column="1" - Padding="10,0" - Style="{StaticResource TextSegoeStyle-20pt-red}" - Text=""/> - </Grid> - <Button x:Name="_registerOnBlockchainEdition_" - Content="register" - Visibility="Collapsed" - Click="_registerOnBlockchainEdition__Click"/> - <StackPanel Orientation="Horizontal" Margin="10"> - <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" - Text=""/> - <TextBlock Text="UPnP" Margin="10"/> - </StackPanel> - <ToggleSwitch x:Name="_upnpState_" - Margin="20,10"/> - </StackPanel> - <!-- SIP parameters. --> - <StackPanel x:Name="_sipAccountStackEdition_" - Visibility="Collapsed"> - <StackPanel Orientation="Horizontal" - Margin="10"> - <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" - Text=""/> - <TextBlock Text="SIP account parameters" - Margin="10"/> - </StackPanel> - <TextBox x:Name="_sipHostnameEdition_" - Margin="10" - PlaceholderText="Enter hostname"/> - <TextBox x:Name="_sipUsernameEditionTextBox_" - Margin="10" - PlaceholderText="Enter username"/> - <PasswordBox x:Name="_sipPasswordEdition_" - Margin="10" - PlaceholderText="Enter password"/> - </StackPanel> - <!-- delete account sub menu. --> - <StackPanel Orientation="Horizontal" Margin="10"> - <TextBlock Style="{StaticResource TextSegoeStyle-20pt-black}" - Text=""/> - <TextBlock Text="Delete account" Margin="10"/> - </StackPanel> - <ToggleSwitch x:Name="_deleteAccountEdition_" - Toggled="_deleteAccountEdition__Toggled" - Margin="20,10"/> - <TextBlock x:Name="_whatWilHappendeleteRingAccountEdition_" - Margin="0,10,0,0" - Style="{StaticResource BodyTextBlockStyle}" - Foreground="Red" - Visibility="Collapsed" - Text="Your account will be deleted from this computer. Other devices are not affected. Your public registration can never be deleted."/> - <TextBlock x:Name="_whatWilHappendeleteSipAccountEdition_" - Margin="0,10,0,0" - Style="{StaticResource BodyTextBlockStyle}" - Foreground="Red" - Visibility="Collapsed" - Text="Your account will be deleted from this computer."/> - <HyperlinkButton x:Name="_learnMoreDeleteAccountEdition_" - Content="Learn more" - Visibility="Collapsed" - Margin="0,0,0,10" - NavigateUri="http://ring.cx"/> - </StackPanel> - </ScrollViewer> - <!-- buttons yes/no to accept the modification. --> - <Grid Grid.Row="1"> - <StackPanel Orientation="Horizontal" - HorizontalAlignment="Center"> - <Button x:Name="_acceptAccountModification_" - Grid.Row="1" - VerticalAlignment="Center" - HorizontalAlignment="Center" - Content="" - Click="_acceptAccountModification__Click" - Style="{StaticResource ButtonStyle5}"/> - <Button x:Name="_cancelAccountModification_" - Grid.Row="1" - VerticalAlignment="Center" - HorizontalAlignment="Center" - Content="" - Click="_cancelAccountModification__Click" - Style="{StaticResource ButtonStyle5}"/> - </StackPanel> - </Grid> - </Grid> <!-- share menu. --> <Grid x:Name="_shareMenuGrid_" - Grid.Row="2" + Grid.Row="0" Visibility="Collapsed" Background="#3bc1d3"> <Grid.RowDefinitions> @@ -897,13 +905,14 @@ </Grid.RowDefinitions> <Grid Background="#FFE4F1F9"> <Grid.RowDefinitions> - <RowDefinition Height="*"/> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> + <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid Background="white" Margin="10" MaxHeight="140" + Grid.Row="0" MaxWidth="140" Padding="5"> <Image x:Name="_selectedAccountQrCode_" @@ -914,7 +923,7 @@ Height="200"/> </Grid> <TextBlock x:Name="_ringId_" - Padding="5" + Padding="1" Style="{StaticResource TextStyle4}" Text="" Grid.Row="1" @@ -931,7 +940,7 @@ </Grid> <!-- devices menu. --> <Grid x:Name="_devicesMenuGrid_" - Grid.Row="2" + Grid.Row="0" Visibility="Collapsed" Background="#3bc1d3"> <Grid.RowDefinitions> @@ -995,7 +1004,7 @@ </Grid> <!-- add device (pin generator) menu. --> <Grid x:Name="_addingDeviceGrid_" - Grid.Row="2" + Grid.Row="0" Visibility="Collapsed" Background="#3bc1d3"> <Grid.RowDefinitions> @@ -1041,7 +1050,7 @@ </Grid> <!-- waiting for a PIN. --> <Grid x:Name="_waitingForPin_" - Grid.Row="2" + Grid.Row="0" Visibility="Collapsed" Background="#3bc1d3"> <Grid.RowDefinitions> @@ -1074,10 +1083,6 @@ </StackPanel> </Grid> </Grid> - - </Grid> - <!-- smartList and settings. --> - <Grid Grid.Row="1"> <!-- contacts + calls => smartpanelitems. --> <Grid x:Name="_smartGrid_" Grid.Row="0"> diff --git a/SmartPanel.xaml.cpp b/SmartPanel.xaml.cpp index c13c4ba039babd6b6e7b927f7c21316bca8bdaae..3a82cb8b3cda829616e6a8c318c91f6464ce98d7 100644 --- a/SmartPanel.xaml.cpp +++ b/SmartPanel.xaml.cpp @@ -170,6 +170,8 @@ SmartPanel::SmartPanel() RingD::instance->registrationStateErrorGeneric += ref new RingClientUWP::RegistrationStateErrorGeneric(this, &RingClientUWP::Views::SmartPanel::OnregistrationStateErrorGeneric); RingD::instance->registrationStateRegistered += ref new RingClientUWP::RegistrationStateRegistered(this, &RingClientUWP::Views::SmartPanel::OnregistrationStateRegistered); RingD::instance->callPlaced += ref new RingClientUWP::CallPlaced(this, &RingClientUWP::Views::SmartPanel::OncallPlaced); + + menuOpen = MenuOpen::CONTACTS_LIST; } void @@ -233,6 +235,7 @@ void RingClientUWP::Views::SmartPanel::_smartGridButton__Clicked(Object^ sender, void RingClientUWP::Views::SmartPanel::_accountsMenuButton__Checked(Object^ sender, RoutedEventArgs^ e) { + menuOpen = MenuOpen::ACCOUNTS_LIST; _settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _settingsMenuButton_->IsChecked = false; _shareMenuButton_->IsChecked = false; @@ -247,6 +250,7 @@ void RingClientUWP::Views::SmartPanel::_accountsMenuButton__Checked(Object^ send void RingClientUWP::Views::SmartPanel::_accountsMenuButton__Unchecked(Object^ sender, RoutedEventArgs^ e) { + menuOpen = MenuOpen::CONTACTS_LIST; _accountsMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _accountCreationMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _accountEditionGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; @@ -257,6 +261,7 @@ void RingClientUWP::Views::SmartPanel::_accountsMenuButton__Unchecked(Object^ se void RingClientUWP::Views::SmartPanel::_settingsMenu__Checked(Object^ sender, RoutedEventArgs^ e) { + menuOpen - MenuOpen::SETTINGS; _accountsMenuButton__Unchecked(nullptr,nullptr); _accountsMenuButton_->IsChecked = false; _shareMenuButton__Unchecked(nullptr,nullptr); @@ -279,6 +284,7 @@ void RingClientUWP::Views::SmartPanel::_settingsMenu__Checked(Object^ sender, Ro void RingClientUWP::Views::SmartPanel::_settingsMenu__Unchecked(Object^ sender, RoutedEventArgs^ e) { + menuOpen = MenuOpen::CONTACTS_LIST; _settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _smartGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible; @@ -327,6 +333,7 @@ void RingClientUWP::Views::SmartPanel::setMode(RingClientUWP::Views::SmartPanel: void RingClientUWP::Views::SmartPanel::_shareMenuButton__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { + menuOpen = MenuOpen::SHARE; _settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _settingsMenuButton_->IsChecked = false; _shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Visible; @@ -345,6 +352,7 @@ void RingClientUWP::Views::SmartPanel::_shareMenuButton__Checked(Platform::Objec void RingClientUWP::Views::SmartPanel::_shareMenuButton__Unchecked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { + menuOpen = MenuOpen::CONTACTS_LIST; _shareMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _accountsMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _accountEditionGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; @@ -414,6 +422,13 @@ SmartPanel::_smartList__SelectionChanged(Platform::Object^ sender, Windows::UI:: { auto listbox = dynamic_cast<ListBox^>(sender); auto item = dynamic_cast<SmartPanelItem^>(listbox->SelectedItem); + + if (item) + if (item->_contact->_contactStatus == ContactStatus::WAITING_FOR_ACTIVATION) { + listbox->SelectedItem = nullptr; + return; + } + SmartPanelItemsViewModel::instance->_selectedItem = item; if (!item) { @@ -467,27 +482,28 @@ SmartPanel::_accountList__SelectionChanged(Platform::Object^ sender, Windows::UI updatePageContent(); } +// (XXX) use only KeyUp void RingClientUWP::Views::SmartPanel::_ringTxtBx__KeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { /* add contact, test purpose but will be reused later in some way */ - if (e->Key == Windows::System::VirtualKey::Enter && !_ringTxtBx_->Text->IsEmpty()) { - for (auto it : SmartPanelItemsViewModel::instance->itemsList) { - if (it->_contact->name_ == _ringTxtBx_->Text) { - _smartList_->SelectedItem = it; - _ringTxtBx_->Text = ""; - return; - } - } + //if (e->Key == Windows::System::VirtualKey::Enter && !_ringTxtBx_->Text->IsEmpty()) { + // for (auto it : SmartPanelItemsViewModel::instance->itemsList) { + // if (it->_contact->name_ == _ringTxtBx_->Text) { + // _smartList_->SelectedItem = it; + // _ringTxtBx_->Text = ""; + // return; + // } + // } - /* if the string has 40 chars, we simply consider it as a ring id. It has to be improved */ - if (_ringTxtBx_->Text->Length() == 40) { - ContactsViewModel::instance->addNewContact(_ringTxtBx_->Text, _ringTxtBx_->Text); - _ringTxtBx_->Text = ""; - } + // /* if the string has 40 chars, we simply consider it as a ring id. It has to be improved */ + // if (_ringTxtBx_->Text->Length() == 40) { + // ContactsViewModel::instance->addNewContact(_ringTxtBx_->Text, _ringTxtBx_->Text); + // _ringTxtBx_->Text = ""; + // } - RingD::instance->lookUpName(_ringTxtBx_->Text); - } + // RingD::instance->lookUpName(_ringTxtBx_->Text); + //} } void RingClientUWP::Views::SmartPanel::_ringTxtBx__Click(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) @@ -907,6 +923,7 @@ RingClientUWP::Views::NewMessageBubleNotification::NewMessageBubleNotification() void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Unchecked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { + menuOpen = MenuOpen::CONTACTS_LIST; _devicesMenuGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _addingDeviceGrid_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _waitingForPin_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; @@ -920,6 +937,7 @@ void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Unchecked(Platform::O void RingClientUWP::Views::SmartPanel::_devicesMenuButton__Checked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { + menuOpen = MenuOpen::DEVICE; _settingsMenu_->Visibility = Windows::UI::Xaml::Visibility::Collapsed; _settingsMenuButton_->IsChecked = false; @@ -1333,10 +1351,10 @@ void RingClientUWP::Views::SmartPanel::_usernameTextBoxEdition__KeyUp(Platform:: checkStateEditionMenu(); } - +// (XXX) il ne faudrait plus de ringtextbox dans cette fonction, elle devrait etre vider avant de receveoir le resultat void RingClientUWP::Views::SmartPanel::OnregisteredNameFound(RingClientUWP::LookupStatus status, const std::string& address, const std::string& name) { - if (_ringTxtBx_->Text->IsEmpty()) { // if true, we consider we did the lookup for a new account + if (menuOpen == MenuOpen::ACCOUNTS_LIST) { // if true, we did the lookup for a new account /* note : this code do both check for edit and creation menu. It doesn't affect the use and it's easier to implement. */ auto currentNameEdition = Utils::toString(_usernameTextBoxEdition_->Text); @@ -1389,35 +1407,54 @@ void RingClientUWP::Views::SmartPanel::OnregisteredNameFound(RingClientUWP::Look return; } - } else {// if false, we consider we are looking for a registered user + } + else { // if false, we are looking for a registered user (contact) + auto contact = ContactsViewModel::instance->findContactByName(Utils::toPlatformString(name)); + + if (contact == nullptr) + return; + switch (status) { case LookupStatus::SUCCESS: - ContactsViewModel::instance->addNewContact(Utils::toPlatformString(name), Utils::toPlatformString(address)); - ringTxtBxPlaceHolderDelay("username found and added.", 1500); + if (contact->_contactStatus == ContactStatus::WAITING_FOR_ACTIVATION) { + contact->_contactStatus = ContactStatus::READY; + contact->ringID_ = Utils::toPlatformString(address); + ringTxtBxPlaceHolderDelay("username found and added.", 5000); + ContactsViewModel::instance->saveContactsToFile(); + } break; case LookupStatus::INVALID_NAME: - ringTxtBxPlaceHolderDelay("username invalid.", 1500); + if (name.length() == 40) { + ringTxtBxPlaceHolderDelay("ring id added.", 5000); // (XXX) on devrait valider que ce soit bien une clee ring + contact->ringID_ = Utils::toPlatformString(name); + contact->_contactStatus = ContactStatus::READY; + ContactsViewModel::instance->saveContactsToFile(); + } + else { + ringTxtBxPlaceHolderDelay("username invalid.", 5000); + auto item = SmartPanelItemsViewModel::instance->findItem(contact); + ContactsViewModel::instance->deleteContact(contact); + SmartPanelItemsViewModel::instance->removeItem(item); + ContactsViewModel::instance->saveContactsToFile(); + } break; case LookupStatus::NOT_FOUND: { - ringTxtBxPlaceHolderDelay("username not found.", 1500); + ringTxtBxPlaceHolderDelay("username not found.", 5000); + auto item = SmartPanelItemsViewModel::instance->findItem(contact); + ContactsViewModel::instance->deleteContact(contact); + SmartPanelItemsViewModel::instance->removeItem(item); + ContactsViewModel::instance->saveContactsToFile(); break; } case LookupStatus::ERRORR: - ringTxtBxPlaceHolderDelay("network error!", 1500); + ringTxtBxPlaceHolderDelay("network error!", 5000); + auto item = SmartPanelItemsViewModel::instance->findItem(contact); + ContactsViewModel::instance->deleteContact(contact); + SmartPanelItemsViewModel::instance->removeItem(item); + ContactsViewModel::instance->saveContactsToFile(); break; } - - _ringTxtBx_->Text = ""; - - for (auto it : SmartPanelItemsViewModel::instance->itemsList) { - if (it->_contact->ringID_ == Utils::toPlatformString(address)) { - _smartList_->SelectedItem = it; - return; - } - } - - _smartList_->SelectedItem = nullptr; } } @@ -1660,9 +1697,20 @@ SmartPanel::populateVideoRateSettingsComboBox() void RingClientUWP::Views::SmartPanel::_ringTxtBx__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) { - if (e->Key == Windows::System::VirtualKey::Enter ) { + if (e->Key == Windows::System::VirtualKey::Enter) { + /// (XXX) RingD::instance->lookUpName(_ringTxtBx_->Text); + for (auto item : SmartPanelItemsViewModel::instance->itemsList) { + if (item->_contact->_name == _ringTxtBx_->Text) { + _smartList_->SelectedItem = item; + return; + } + } + + auto contact = ContactsViewModel::instance->addNewContact(_ringTxtBx_->Text, "", ContactStatus::WAITING_FOR_ACTIVATION); RingD::instance->lookUpName(_ringTxtBx_->Text); + _ringTxtBx_->Text = ""; + for (auto item : SmartPanelItemsViewModel::instance->itemsList) { item->_showMe = Windows::UI::Xaml::Visibility::Visible; } @@ -1670,7 +1718,7 @@ void RingClientUWP::Views::SmartPanel::_ringTxtBx__KeyUp(Platform::Object^ sende } for (auto item : SmartPanelItemsViewModel::instance->itemsList) { - auto str1 = Utils::toString(item->_contact->name_); + auto str1 = Utils::toString(item->_contact->_name); auto str2 = Utils::toString(_ringTxtBx_->Text); if (str1.find(str2) != std::string::npos) @@ -1750,3 +1798,21 @@ void RingClientUWP::Views::SmartPanel::OncallPlaced(Platform::String ^callId) { _smartList_->SelectedItem = nullptr; } + +Object ^ RingClientUWP::Views::ContactStatusNotification::Convert(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language) +{ + auto contactStatus = static_cast<ContactStatus>(value); + + if (contactStatus == ContactStatus::WAITING_FOR_ACTIVATION) + return Windows::UI::Xaml::Visibility::Visible; + else + return Windows::UI::Xaml::Visibility::Collapsed; +} + +Object ^ RingClientUWP::Views::ContactStatusNotification::ConvertBack(Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object ^ parameter, String ^ language) +{ + throw ref new Platform::NotImplementedException(); +} + +RingClientUWP::Views::ContactStatusNotification::ContactStatusNotification() +{} diff --git a/SmartPanel.xaml.h b/SmartPanel.xaml.h index 42168a0cf7d4289e834e26ac8e74945e3b72e009..ec1cc2f4126d3a6f9619e5849118268af55680c2 100644 --- a/SmartPanel.xaml.h +++ b/SmartPanel.xaml.h @@ -80,6 +80,13 @@ public: CollapseEmptyString(); }; +public ref class ContactStatusNotification sealed : IValueConverter { +public: + virtual Object^ Convert(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); + virtual Object^ ConvertBack(Object^ value, Windows::UI::Xaml::Interop::TypeName targetType, Object^ parameter, String^ language); + ContactStatusNotification(); +}; + public ref class SmartPanel sealed { public: @@ -172,6 +179,16 @@ private: void _PINTextBox__GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnregistrationStateRegistered(); void OncallPlaced(Platform::String ^callId); + + enum class MenuOpen { + CONTACTS_LIST, + ACCOUNTS_LIST, + SHARE, + DEVICE, + SETTINGS + }; + + MenuOpen menuOpen; }; } } diff --git a/VideoPage.xaml.cpp b/VideoPage.xaml.cpp index c2129907c70524dddd49c6d5ec5638ee15baf2b1..0798d2fbfadd6f7d84271e75a3552a8b624b74f3 100644 --- a/VideoPage.xaml.cpp +++ b/VideoPage.xaml.cpp @@ -169,7 +169,7 @@ void RingClientUWP::Views::VideoPage::updatePageContent() if (!contact) return; - _callee_->Text = contact->name_; + _callee_->Text = contact->_name; _messagesList_->ItemsSource = contact->_conversation->_messages; diff --git a/WelcomePage.xaml b/WelcomePage.xaml index baa3bd60803c09fe52dc960759d7ea3e54522d7b..b23282ef28d33b24e96910683a962503be8bcedb 100644 --- a/WelcomePage.xaml +++ b/WelcomePage.xaml @@ -28,28 +28,26 @@ <Grid> <Grid.RowDefinitions> <RowDefinition Height="1*"/> + <RowDefinition Height="auto"/> + <RowDefinition Height="2*"/> <RowDefinition Height="2*"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <StackPanel x:Name="_welcomePage_" Grid.Row="1"> - <!--<TextBlock x:Uid="_welcomeMsg" - x:Name="_welcomeMsg_" - Style="{StaticResource TextStyle1}" - HorizontalAlignment="Center" - VerticalAlignment="Center" - TextWrapping="Wrap" />--> - <Image x:Name="_welcomeImage_" + <StackPanel Grid.Row="1"> + <Image x:Name="_welcomeImage_" + Source="Assets\Wide310x150Logo.scale-200.png" Width="310" HorizontalAlignment="Center" Margin="0 10 0 30" Height="150"/> - <TextBlock Text="Ring is free software for universal communication wich respects the freedoms and privacy of its users." + <TextBlock Text="Ring is free software for universal communication wich respects the freedoms and privacy of its users." Foreground="#707370" - MaxWidth="410" - TextWrapping="WrapWholeWords" + MaxWidth="500" + Width="310" + TextWrapping="Wrap" TextAlignment="Justify" - FontSize="18" + FontSize="12" FontWeight="Bold" HorizontalAlignment="Center"/> </StackPanel> diff --git a/WelcomePage.xaml.cpp b/WelcomePage.xaml.cpp index f50c2b72af8f5a409d2a3432d2ffadbcb2b5407a..87c4b3bd88b78b0ba0201d30f5a4927e1e704071 100644 --- a/WelcomePage.xaml.cpp +++ b/WelcomePage.xaml.cpp @@ -33,12 +33,12 @@ WelcomePage::WelcomePage() void WelcomePage::PositionImage() { - Rect imageBounds; + /*Rect imageBounds; imageBounds.Width = static_cast<float>(_welcomePage_->ActualWidth); imageBounds.Height = static_cast<float>(_welcomePage_->ActualHeight); _welcomeImage_->SetValue(Canvas::LeftProperty, imageBounds.Width * 0.5 - _welcomeImage_->Width * 0.5); - _welcomeImage_->SetValue(Canvas::TopProperty, imageBounds.Height * 0.5 - _welcomeImage_->Height * 0.5); + _welcomeImage_->SetValue(Canvas::TopProperty, imageBounds.Height * 0.5 - _welcomeImage_->Height * 0.5);*/ } void