未完成,保存

This commit is contained in:
KaniuTayou
2018-12-24 17:53:55 +08:00
parent f28ad69067
commit fae7ce37e5
8 changed files with 256 additions and 139 deletions
@@ -27,5 +27,6 @@
<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="Button" Grid.Column="2" HorizontalAlignment="Left" Margin="73,31,0,0" Grid.Row="2" VerticalAlignment="Top" Width="75" Click="button_Click_1"/>
</Grid>
</Window>
@@ -1,17 +1,8 @@
using Interact;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace StormChatWPF
{
@@ -65,7 +56,7 @@ namespace StormChatWPF
if (message.To == User.Me)
{
App.Current.Dispatcher.Invoke(
delegate ()
(Action)delegate()
{
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Left));
});
@@ -73,11 +64,20 @@ namespace StormChatWPF
else
{
App.Current.Dispatcher.Invoke(
delegate ()
(Action)delegate()
{
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Right));
OutBox.Children.Add(new ChatBubble(message, HorizontalAlignment.Right));
});
}//发送的的消息
}//将消息展现于UI界面
private void button_Click_1(object sender, RoutedEventArgs e)
{
App.Current.Dispatcher.Invoke(
(Action)delegate ()
{
OutBox.Children.Add(new HeadPicture());
});
}
}
}
@@ -42,12 +42,12 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
@@ -66,6 +66,11 @@
</Compile>
<Compile Include="ScrollViewer.cs" />
<Compile Include="UI\ChatBubble.cs" />
<Compile Include="UI\HeadPicture.cs" />
<Compile Include="UI\UserInfo.cs" />
<Compile Include="Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon>
</Compile>
<Page Include="LogWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -82,6 +87,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Media;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.IO;
namespace StormChatWPF
{
class HeadPicture : Image
{
public HeadPicture(/*Stream imgstream*/)
{
FileStream fileStream = new FileStream(@"C:\Users\Administrator\Desktop\闪电.png", FileMode.Open);
Source = new BitmapImage()
{
StreamSource = fileStream
};
//border.Content = this;
}
private Label border = new Label()
{
};
}
}
@@ -0,0 +1,30 @@
using Interact;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;
namespace StormChatWPF
{
class UserInfo:Label
{
public UserInfo(User user)
{
}
private Image headpicture = new Image
{
HorizontalAlignment = HorizontalAlignment.Left
};
private TextBlock UserNmae=new TextBlock
{
FontFamily = new FontFamily("Comic Sans MS"),
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment=VerticalAlignment.Top
};
}
}
@@ -0,0 +1,19 @@
<Window x:Class="StormChatWPF.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:StormChatWPF"
mc:Ignorable="d"
Title="Window1" Height="300" Width="300">
<Grid>
<Label x:Name="label" HorizontalAlignment="Left" Margin="76,101,0,0" VerticalAlignment="Top" Width="86" Height="41">
<Image x:Name="image" Height="31" Width="36" Source="UI/Resources/闪电.png" Margin="0,0,0,0" HorizontalAlignment="Left" RenderTransformOrigin="0.553,0.5" VerticalAlignment="Center">
<Image.OpacityMask>
<ImageBrush ImageSource="UI/Resources/聊天气泡.png"/>
</Image.OpacityMask>
</Image>
</Label>
</Grid>
</Window>
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace StormChatWPF
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
}
}