Skip to content

Ajout du bouton#26

Open
andre726 wants to merge 4 commits intouwp-squad:masterfrom
andre726:Buttonchatbranch
Open

Ajout du bouton#26
andre726 wants to merge 4 commits intouwp-squad:masterfrom
andre726:Buttonchatbranch

Conversation

@andre726
Copy link
Contributor

No description provided.


namespace Livecoding.UWP.ViewModels
{
class ChatList : ListViewItem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pourquoi cette classe ? Si elle ne fait rien de précis, elle ne doit pas exister. De plus, si c'est pour gérer l'affichage d'une ListView pour le chat, tu peux le faire sans difficulté dans la View et le ViewModel.

Copy link
Contributor Author

@andre726 andre726 Apr 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est dans quelle fichier que je dois gérer l'affichage de la liste?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu dois modifier 2 fichiers principalement : la StreamPage et le StreamViewModel. En gros, la vue et la logique de la vue.

Dans le ViewModel, il faut par exemple que tu ajoutes la propriété suivante :

private bool _showChat;
public bool ShowChat
{
    get { return _showChat; }
    set { _showChat = value; RaisePropertyChanged(); }
}

Et après dans la vue, tu fais le binding.

</DataTemplate>
</lvcontrols:LivecodingMediaTransportControls.HeaderTemplate>
</lvcontrols:LivecodingMediaTransportControls>
<AppBarButton x:Name="ChatButton"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il me semble que cet AppBarButton doit être intégré au contrôle LivecodingMediaTransportControls. Normalement, le template de ce contrôle est dans App.xaml.cs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu peut détaillé?

Icon="Contact"
Style="{StaticResource AppBarButtonStyle}"
MediaTransportControlsHelper.DropoutOrder="5"
VerticalAlignment="Center"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il manque la balise de fermeture />

</MediaPlayerElement>
<ListViewItem x:Name="ChatList" IsEnabled="False" Visibility="Collapsed"/>

</MediaPlayerElement.TransportControls>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Déjà présent. A supprimer.


</MediaPlayerElement.TransportControls>

</MediaPlayerElement>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Déjà présent. A supprimer.

</MediaPlayerElement.TransportControls>

</MediaPlayerElement>
<ListViewItem x:Name="ChatList" IsEnabled="False" Visibility="Collapsed"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A déplacer en dehors du contrôle MediaPlayerElement.

</MediaPlayerElement.TransportControls>

</MediaPlayerElement>
<ListViewItem x:Name="ChatList" IsEnabled="False" Visibility="Collapsed"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je te conseille d'utiliser le contrôle ListView plutôt que ListViewItem Et aussi, pourquoi utiliser la propriété IsEnabled, la propriété Visibility est amplement suffisante.

</MediaPlayerElement>

</Grid>
<ListView x:Name="ChatList" Visibility="Collapsed" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A renommer en ChatListView.

</MediaPlayerElement>

</Grid>
<ListView x:Name="ChatList" Visibility="Collapsed" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour mettre à jour le fait qu'elle soit visible : Visibility={Binding Path=ShowChat}

DataContext="{Binding ShowChat, Source = {StaticRessource Locator}}"
MediaTransportControlsHelper.DropoutOrder="5"
VerticalAlignment="Center"
Onclick="ChatHide_Show">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile de mettre un event OnClick, il faudra passer par une Command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quelle est la différence?

Copy link
Contributor

@Odonno Odonno Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si tu passes par des events comme OnClick par exemple, tu vas devoir gérer la logique dans le code-behind, ce qui est à éviter dans 99% des cas.

Si tu passes par une Command, tu vas pouvoir manipuler la logique dans le ViewModel. Tu peux prendre exemple sur ce ViewModel https://github.com/uwp-squad/livecoding-uwp/blob/master/LIvecoding-uwp/Livecoding/ViewModels/LivestreamsViewModel.cs#L50

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le bouton devrait se situer à proximité des autres boutons ici https://github.com/uwp-squad/livecoding-uwp/blob/master/LIvecoding-uwp/Livecoding/App.xaml#L728

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Et dans l'immédiat, tu peux faire un binding direct sur la commande de ton ViewModel pour voir ce que ça donne. Je vois pas d'autre solution simple pour le moment.

<DataTemplate>
<usercontrols:StreamHeaderControl DataContext="{Binding Stream, Source={StaticResource Locator}}" />

<controls:AppBarButton x:Name="ChatButton"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem que la fois précédente, à placer dans App.xaml.cs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mais c'est du xaml ici, pas du c#

Copy link
Contributor

@Odonno Odonno Apr 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je me suis trompé, c'est dans App.xaml. Dans le DataTemplate du control.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, je vais chercher pour voir ou le mettre :)

<controls:AppBarButton x:Name="ChatButton"
Icon="Contact"
Style="{StaticResource AppBarButtonStyle}"
DataContext="{Binding ShowChat, Source = {StaticRessource Locator}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas besoin de DataContext.


#region Properties
private ListView _chatlist;
public ListView ChatList
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A remplacer par public ObservableCollection<ChatMessage> Messages { get; } = new ObservableCollection<ChatMessage>();

dispositions des element dans appxaml, depuis bcp d'erreur
</Storyboard>
</VisualState>
</VisualStateGroup>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression de la ligne en trop

</AppBarButton.Icon>
</AppBarButton>
<AppBarButton x:Name="ChatButton"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression de la ligne en trop

<AppBarButton x:Name="ChatButton"

MediaTransportControlsHelper.DropoutOrder ="5"
Visibility="Collapsed"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le bouton est censé être toujours visible, non ? Ligne à supprimer.


MediaTransportControlsHelper.DropoutOrder ="5"
Visibility="Collapsed"
Command="ChatVisibilityChange">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voilà comment on écrit une commande généralement :

Command="{Binding ShowChatCommand}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dans notre cas, je pense plutôt qu'il faut l'appeler ToggleChatCommand.

<FontIcon Glyph="comment"/>
</AppBarButton.Icon>
</AppBarButton>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression des lignes en trop

<lvcontrols:LivecodingMediaTransportControls.HeaderTemplate>
<DataTemplate>
<usercontrols:StreamHeaderControl DataContext="{Binding Stream, Source={StaticResource Locator}}" />

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression des lignes en trop

</DataTemplate>
</lvcontrols:LivecodingMediaTransportControls.HeaderTemplate>
</lvcontrols:LivecodingMediaTransportControls>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression des lignes en trop


</MediaPlayerElement.TransportControls>


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression des lignes en trop

</MediaPlayerElement>



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppression des lignes en trop

Visibility="Collapsed"
Command="ChatVisibilityChange">
<AppBarButton.Icon>
<FontIcon Glyph="comment"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il me semble qu'il y a une majuscule pour le nom d'une glyph. Donc ce serait Comment plutôt.

@Odonno
Copy link
Contributor

Odonno commented Apr 20, 2017

Pour ce qui est de la commande, il faudra la créer dans le ViewModel. Regarde des exemples si cela peut t'aider. Comme par ici : https://github.com/uwp-squad/livecoding-uwp/blob/master/LIvecoding-uwp/Livecoding/ViewModels/LivestreamsViewModel.cs#L37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants