Merge branch 'client-csharp' of https://github.com/mattuylee/stormchat.git
This commit is contained in:
@@ -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"/>
|
<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="Button" Grid.Column="2" HorizontalAlignment="Left" Margin="73,31,0,0" Grid.Row="2" VerticalAlignment="Top" Width="75" Click="button_Click_1"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,17 +1,8 @@
|
|||||||
using Interact;
|
using Interact;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
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
|
namespace StormChatWPF
|
||||||
{
|
{
|
||||||
@@ -65,7 +56,7 @@ namespace StormChatWPF
|
|||||||
if (message.To == User.Me)
|
if (message.To == User.Me)
|
||||||
{
|
{
|
||||||
App.Current.Dispatcher.Invoke(
|
App.Current.Dispatcher.Invoke(
|
||||||
delegate ()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Left));
|
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Left));
|
||||||
});
|
});
|
||||||
@@ -73,11 +64,20 @@ namespace StormChatWPF
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
App.Current.Dispatcher.Invoke(
|
App.Current.Dispatcher.Invoke(
|
||||||
delegate ()
|
(Action)delegate()
|
||||||
{
|
{
|
||||||
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Right));
|
OutBox.Children.Add(new ChatBubble(message, HorizontalAlignment.Right));
|
||||||
});
|
});
|
||||||
}//发送的的消息
|
}//发送的的消息
|
||||||
}//将消息展现于UI界面
|
}//将消息展现于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" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xaml">
|
<Reference Include="System.Xaml">
|
||||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -66,6 +66,11 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ScrollViewer.cs" />
|
<Compile Include="ScrollViewer.cs" />
|
||||||
<Compile Include="UI\ChatBubble.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">
|
<Page Include="LogWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -82,6 +87,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Window1.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user