Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Added buttons to the ContactInfoControl
Browse files Browse the repository at this point in the history
  • Loading branch information
COM8 committed Jul 27, 2019
1 parent 09d598c commit 4d3adf6
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 52 deletions.
42 changes: 5 additions & 37 deletions UWPX_UI/Controls/Chat/ChatDetailsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:controls1="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:omemoControls="using:UWPX_UI.Controls.OMEMO"
xmlns:valueconverter="using:UWPX_UI_Context.Classes.ValueConverter"
mc:Ignorable="d">
<UserControl.Resources>
Expand All @@ -15,8 +16,6 @@
<ResourceDictionary Source="ms-appx:///Resources/Styles/TransparentThemeButtonStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>

<valueconverter:OmemoBoolGlyphTextValueConverter x:Key="OmemoBoolGlyphTextValueConverter"/>
<valueconverter:OmemoBoolBrushValueConverter x:Key="OmemoBoolBrushValueConverter"/>
<valueconverter:StringEmptyEnabledBoolValueConverter x:Key="StringEmptyEnabledBoolValueConverter"/>
</ResourceDictionary>
</UserControl.Resources>
Expand Down Expand Up @@ -124,43 +123,12 @@
TextTrimming="CharacterEllipsis"
Visibility="{x:Bind VIEW_MODEL.MODEL.StatusText, Mode=OneWay, Converter={StaticResource StringEmptyVisibilityValueConverter}}"/>
</Grid>
<Button Grid.Column="2"
Height="35"
Margin="0,0,-10,0"
Background="Transparent"
Content="{x:Bind VIEW_MODEL.MODEL.OmemoEnabled, Mode=OneWay, Converter={StaticResource OmemoBoolGlyphTextValueConverter}}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="20"
FontWeight="Bold"
Foreground="{x:Bind VIEW_MODEL.MODEL.OmemoEnabled, Mode=OneWay, Converter={StaticResource OmemoBoolBrushValueConverter}}"
Style="{ThemeResource ButtonRevealStyle}"
Visibility="{x:Bind VIEW_MODEL.MODEL.OmemoVisibility, Mode=OneWay}">
<Button.Flyout>
<Flyout>
<StackPanel>
<RadioButton GroupName="OMEMO"
IsChecked="{x:Bind VIEW_MODEL.MODEL.OmemoEnabled, Mode=TwoWay}">
<controls:IconTextBlockControl Glyph="&#xE72E;"
GlyphForeground="DarkGreen"
Text="Encrypted (OMEMO)"/>
</RadioButton>
<RadioButton GroupName="OMEMO"
IsChecked="{x:Bind VIEW_MODEL.MODEL.OmemoEnabled, Mode=TwoWay, Converter={StaticResource BoolInverterValueConverter}}">
<controls:IconTextBlockControl Glyph="&#xE785;"
GlyphForeground="DarkRed"
Text="Unencrypted"/>
</RadioButton>
<HyperlinkButton x:Name="readOnOmemo_link"
Margin="0,10,0,0"
Click="ReadOnOmemo_link_Click"
Content="What is OMEMO?"/>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<omemoControls:OmemoButtonControl Grid.Column="2"
OmemoEnabled="{x:Bind VIEW_MODEL.MODEL.OmemoEnabled, Mode=TwoWay}"
Visibility="{x:Bind VIEW_MODEL.MODEL.OmemoVisibility, Mode=OneWay}"/>
<Button Grid.Column="3"
Height="35"
Margin="10,0,10,0"
Margin="0,0,10,0"
VerticalAlignment="Center"
Background="Transparent"
Content="&#xE712;"
Expand Down
5 changes: 0 additions & 5 deletions UWPX_UI/Controls/Chat/ChatDetailsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ private void Send_btn_Click(object sender, RoutedEventArgs e)
VIEW_MODEL.SendChatMessage(Chat);
}

private async void ReadOnOmemo_link_Click(object sender, RoutedEventArgs e)
{
await VIEW_MODEL.OnReadOnOmemoClickedAsync();
}

private static void OnIsDummyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is ChatDetailsControl chatDetailsControl)
Expand Down
56 changes: 51 additions & 5 deletions UWPX_UI/Controls/Chat/ContactInfoControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@
xmlns:controls1="using:UWPX_UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:omemoControls="using:UWPX_UI.Controls.OMEMO"
HorizontalAlignment="Center"
mc:Ignorable="d">

<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="IsTextSelectionEnabled" Value="True"/>
</Style>
<Style x:Key="TransparentButtonStlye"
BasedOn="{StaticResource ButtonRevealStyle}"
TargetType="Button">
<Setter Property="Height" Value="35"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="{ThemeResource SystemAccentColor}"/>
<Setter Property="Height" Value="35"/>
</Style>
</UserControl.Resources>

<controls:DropShadowPanel x:Name="mainShadow"
Expand Down Expand Up @@ -60,12 +72,25 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Margin="0,10,0,0"
IsTextSelectionEnabled="True"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="Some Name"/>
<Grid Grid.Row="0"
Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
IsTextSelectionEnabled="True"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="Some Name"/>
<Button Grid.Column="1"
Margin="5,0,0,0"
VerticalAlignment="Center"
Content="&#xE70F;"
Style="{ThemeResource TransparentButtonStlye}"
ToolTipService.ToolTip="Change Nickname"/>
</Grid>
<TextBlock Grid.Row="1"
Margin="0,10,0,0"
Text="someone@xmpp.uwpx.org"/>
Expand All @@ -74,6 +99,27 @@
<TextBlock Grid.Row="3"
Margin="0,10,0,0"
Text="This is some status Text."/>
<Grid Grid.Row="4"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<omemoControls:OmemoButtonControl Grid.Column="0"
Margin="0,10,0,0"/>
<Button Grid.Column="1"
Margin="10,10,0,0"
Content="&#xE74F;"
Style="{ThemeResource TransparentButtonStlye}"
ToolTipService.ToolTip="Mute"/>
<Button Grid.Column="2"
Margin="10,10,0,0"
Content="&#xF138;"
Style="{ThemeResource TransparentButtonStlye}"
ToolTipService.ToolTip="Presence"/>
</Grid>
</Grid>
</Grid>
</Border>
Expand Down
47 changes: 47 additions & 0 deletions UWPX_UI/Controls/OMEMO/OmemoButtonControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<UserControl x:Class="UWPX_UI.Controls.OMEMO.OmemoButtonControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:UWPX_UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:valueconverter="using:UWPX_UI_Context.Classes.ValueConverter"
mc:Ignorable="d">

<UserControl.Resources>
<valueconverter:OmemoBoolGlyphTextValueConverter x:Key="OmemoBoolGlyphTextValueConverter"/>
<valueconverter:OmemoBoolBrushValueConverter x:Key="OmemoBoolBrushValueConverter"/>
</UserControl.Resources>

<Button Grid.Column="2"
Height="35"
Background="Transparent"
Content="{x:Bind OmemoEnabled, Mode=OneWay, Converter={StaticResource OmemoBoolGlyphTextValueConverter}}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="20"
FontWeight="Bold"
Foreground="{x:Bind OmemoEnabled, Mode=OneWay, Converter={StaticResource OmemoBoolBrushValueConverter}}"
Style="{ThemeResource ButtonRevealStyle}">
<Button.Flyout>
<Flyout>
<StackPanel>
<RadioButton GroupName="OMEMO"
IsChecked="{x:Bind OmemoEnabled, Mode=TwoWay}">
<controls:IconTextBlockControl Glyph="&#xE72E;"
GlyphForeground="DarkGreen"
Text="Encrypted (OMEMO)"/>
</RadioButton>
<RadioButton GroupName="OMEMO"
IsChecked="{x:Bind OmemoEnabled, Mode=TwoWay, Converter={StaticResource BoolInverterValueConverter}}">
<controls:IconTextBlockControl Glyph="&#xE785;"
GlyphForeground="DarkRed"
Text="Unencrypted"/>
</RadioButton>
<HyperlinkButton x:Name="readOnOmemo_link"
Margin="0,10,0,0"
Click="ReadOnOmemo_link_Click"
Content="What is OMEMO?"/>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</UserControl>
58 changes: 58 additions & 0 deletions UWPX_UI/Controls/OMEMO/OmemoButtonControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using UWPX_UI_Context.Classes.DataContext.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace UWPX_UI.Controls.OMEMO
{
public sealed partial class OmemoButtonControl: UserControl
{
//--------------------------------------------------------Attributes:-----------------------------------------------------------------\\
#region --Attributes--
public bool OmemoEnabled
{
get { return (bool)GetValue(OmemoEnabledProperty); }
set { SetValue(OmemoEnabledProperty, value); }
}
public static readonly DependencyProperty OmemoEnabledProperty = DependencyProperty.Register(nameof(OmemoEnabled), typeof(bool), typeof(OmemoButtonControl), new PropertyMetadata(false));

public readonly OmemoButtonControlContext VIEW_MODEL = new OmemoButtonControlContext();

#endregion
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\
#region --Constructors--
public OmemoButtonControl()
{
InitializeComponent();
}

#endregion
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
#region --Set-, Get- Methods--


#endregion
//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
#region --Misc Methods (Public)--


#endregion

#region --Misc Methods (Private)--


#endregion

#region --Misc Methods (Protected)--


#endregion
//--------------------------------------------------------Events:---------------------------------------------------------------------\\
#region --Events--
private async void ReadOnOmemo_link_Click(object sender, RoutedEventArgs e)
{
await VIEW_MODEL.OnReadOnOmemoClickedAsync();
}

#endregion
}
}
7 changes: 7 additions & 0 deletions UWPX_UI/UWPX_UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@
<Compile Include="Controls\LoadingContentControl.xaml.cs">
<DependentUpon>LoadingContentControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\OMEMO\OmemoButtonControl.xaml.cs">
<DependentUpon>OmemoButtonControl.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\OMEMO\OmemoDeviceListControl.xaml.cs">
<DependentUpon>OmemoDeviceListControl.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -615,6 +618,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\OMEMO\OmemoButtonControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\OMEMO\OmemoDeviceListControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ public void OnChatMessageKeyDown(KeyRoutedEventArgs args, ChatDataTemplate chat)
}
}

public async Task OnReadOnOmemoClickedAsync()
{
await UiUtils.LaunchUriAsync(new Uri("https://conversations.im/omemo/"));
}

public async Task LeaveMucAsync(ChatDataTemplate chatTemplate)
{
if (!MODEL.isDummy)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Threading.Tasks;
using UWPX_UI_Context.Classes.DataTemplates.Controls;

namespace UWPX_UI_Context.Classes.DataContext.Controls
{
public sealed class OmemoButtonControlContext
{
//--------------------------------------------------------Attributes:-----------------------------------------------------------------\\
#region --Attributes--
public readonly OmemoButtonControlDataTemplate MODEL = new OmemoButtonControlDataTemplate();

#endregion
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\
#region --Constructors--


#endregion
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
#region --Set-, Get- Methods--


#endregion
//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
#region --Misc Methods (Public)--
public async Task OnReadOnOmemoClickedAsync()
{
await UiUtils.LaunchUriAsync(new Uri("https://conversations.im/omemo/"));
}

#endregion

#region --Misc Methods (Private)--


#endregion

#region --Misc Methods (Protected)--


#endregion
//--------------------------------------------------------Events:---------------------------------------------------------------------\\
#region --Events--


#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace UWPX_UI_Context.Classes.DataTemplates.Controls
{
public class OmemoButtonControlDataTemplate
{
//--------------------------------------------------------Attributes:-----------------------------------------------------------------\\
#region --Attributes--


#endregion
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\
#region --Constructors--


#endregion
//--------------------------------------------------------Set-, Get- Methods:---------------------------------------------------------\\
#region --Set-, Get- Methods--


#endregion
//--------------------------------------------------------Misc Methods:---------------------------------------------------------------\\
#region --Misc Methods (Public)--


#endregion

#region --Misc Methods (Private)--


#endregion

#region --Misc Methods (Protected)--


#endregion
//--------------------------------------------------------Events:---------------------------------------------------------------------\\
#region --Events--


#endregion
}
}
Loading

0 comments on commit 4d3adf6

Please sign in to comment.