用户自身头像显示 未完成
This commit is contained in:
@@ -44,7 +44,7 @@ namespace StormChatWPF
|
||||
private void OnHaveLogin(ResultHead head, User user)
|
||||
{
|
||||
if (head.Error == "")
|
||||
{
|
||||
{
|
||||
User.Me = user;
|
||||
StormClient.QueueGetUserList();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:StormChatWPF"
|
||||
xmlns:my="clr-namespace:StormChatWPF.UI"
|
||||
mc:Ignorable="d"
|
||||
Title="StormChat" Height="450" Width="800"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
@@ -19,8 +20,7 @@
|
||||
<ColumnDefinition Width="200*"/>
|
||||
<ColumnDefinition Width="200*"/>
|
||||
</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>
|
||||
<ListView x:Name="UsersList" Margin="0,0,0,0" IsEnabled="True" SelectionChanged="UsersList_SelectionChanged" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="198"/>
|
||||
<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"/>
|
||||
<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"/>
|
||||
</ScrollViewer.Content>
|
||||
</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>
|
||||
</Window>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Interact;
|
||||
using StormChatWPF.UI;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace StormChatWPF
|
||||
{
|
||||
@@ -12,13 +14,32 @@ namespace StormChatWPF
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
delegate void LoadFinish(object sender,EventArgs e);
|
||||
public static MainWindow Instence;
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadContactsList();
|
||||
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()
|
||||
{
|
||||
if (Chat.ContactsList.Any())
|
||||
@@ -85,5 +106,7 @@ namespace StormChatWPF
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
event LoadFinish MainWindowLoad;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,19 @@ namespace StormChatWPF.UI
|
||||
public Contacts()
|
||||
{
|
||||
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