用户自身头像显示 未完成
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:StormChatWPF"
|
xmlns:local="clr-namespace:StormChatWPF"
|
||||||
|
xmlns:my="clr-namespace:StormChatWPF.UI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="StormChat" Height="450" Width="800"
|
Title="StormChat" Height="450" Width="800"
|
||||||
WindowStartupLocation="CenterScreen">
|
WindowStartupLocation="CenterScreen">
|
||||||
@@ -19,8 +20,7 @@
|
|||||||
<ColumnDefinition Width="200*"/>
|
<ColumnDefinition Width="200*"/>
|
||||||
<ColumnDefinition Width="200*"/>
|
<ColumnDefinition Width="200*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ListView x:Name="UsersList" Margin="0,0,0,0" IsEnabled="True" SelectionChanged="UsersList_SelectionChanged" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="198">
|
<ListView x:Name="UsersList" Margin="0,0,0,0" IsEnabled="True" SelectionChanged="UsersList_SelectionChanged" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="198"/>
|
||||||
</ListView>
|
|
||||||
<TextBox x:Name="InputBox" Margin="200,0,0,0" TextWrapping="Wrap" Text="" Grid.Row="2" Grid.ColumnSpan="4" />
|
<TextBox x:Name="InputBox" Margin="200,0,0,0" TextWrapping="Wrap" Text="" Grid.Row="2" Grid.ColumnSpan="4" />
|
||||||
<Button Content="Send" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Bottom" Width="75" Click="Button_Click" Height="20" Grid.Row="2" Grid.Column="3"/>
|
<Button Content="Send" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Bottom" Width="75" Click="Button_Click" Height="20" Grid.Row="2" Grid.Column="3"/>
|
||||||
<ScrollViewer Grid.ColumnSpan="3" Grid.Column="1" Margin="0,0,0,0" Grid.Row="1" >
|
<ScrollViewer Grid.ColumnSpan="3" Grid.Column="1" Margin="0,0,0,0" Grid.Row="1" >
|
||||||
@@ -28,6 +28,8 @@
|
|||||||
<StackPanel x:Name="OutBox" Margin="0,0,0,0" Grid.ColumnSpan="3" Grid.Column="1" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
|
<StackPanel x:Name="OutBox" Margin="0,0,0,0" Grid.ColumnSpan="3" Grid.Column="1" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
|
||||||
</ScrollViewer.Content>
|
</ScrollViewer.Content>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Button x:Name="button" Content="更改头像" Grid.Column="1" HorizontalAlignment="Left" Margin="0,64,0,-2" Grid.Row="2" VerticalAlignment="Top" Width="75" Click="button_Click_1"/>
|
<Image x:Name="User_HeadPicture" HorizontalAlignment="Left" Width="60" VerticalAlignment="Stretch"/>
|
||||||
|
<Label x:Name="User_NickNmae" Content="Label" Margin="0,0,0.4,0" Height="40" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Right" Width="138"/>
|
||||||
|
<Label x:Name="User_motto" Content="人生很长,慢慢走。" Margin="0,40,0.4,0" VerticalContentAlignment="Top" HorizontalAlignment="Right" Width="138" FontSize="6"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using Interact;
|
using Interact;
|
||||||
using StormChatWPF.UI;
|
using StormChatWPF.UI;
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace StormChatWPF
|
namespace StormChatWPF
|
||||||
{
|
{
|
||||||
@@ -12,13 +14,32 @@ namespace StormChatWPF
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
|
delegate void LoadFinish(object sender,EventArgs e);
|
||||||
public static MainWindow Instence;
|
public static MainWindow Instence;
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LoadContactsList();
|
|
||||||
Instence = this;
|
Instence = this;
|
||||||
|
MainWindowLoad += Window_Load;
|
||||||
|
MainWindowLoad.Invoke(this,null);
|
||||||
}
|
}
|
||||||
|
void Window_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadContactsList();
|
||||||
|
LoadUserMe();
|
||||||
|
}
|
||||||
|
private void LoadUserMe()
|
||||||
|
{
|
||||||
|
BitmapImage image = new BitmapImage();
|
||||||
|
User_HeadPicture.BeginInit();
|
||||||
|
image.StreamSource = User.Me.Photo;
|
||||||
|
User.Me.Photo.Seek(0, SeekOrigin.Begin);
|
||||||
|
User_HeadPicture.EndInit();
|
||||||
|
User_HeadPicture.Source = image;
|
||||||
|
User_NickNmae.Content = User.Me.NickName;
|
||||||
|
User_motto.Content = User.Me.Motto;
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadContactsList()
|
private void LoadContactsList()
|
||||||
{
|
{
|
||||||
if (Chat.ContactsList.Any())
|
if (Chat.ContactsList.Any())
|
||||||
@@ -85,5 +106,7 @@ namespace StormChatWPF
|
|||||||
{
|
{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event LoadFinish MainWindowLoad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,19 @@ namespace StormChatWPF.UI
|
|||||||
public Contacts()
|
public Contacts()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
var metadata = new FrameworkPropertyMetadata((ImageSource)null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image Head
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.HeadPicture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.HeadPicture = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user