淘宝买手登录 70%
This commit is contained in:
1 parent
97278249ae
commit
78ef8eedf3
10 files changed
+1117
-93
No files matched your search
@@ -0,0 +1,62 @@
|
||||
<UserControl
|
||||
x:Class="_29WxOrderWpf.Views.TaobaoLoginView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:basewindows="clr-namespace:_29WxOrderWpf.BaseWindows"
|
||||
xmlns:comn="clr-namespace:_29WxOrderWpf.Common"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:wpf="WPFCommon"
|
||||
x:Name="taobaoLoginView"
|
||||
Width="1280"
|
||||
Height="800"
|
||||
MinWidth="800"
|
||||
MinHeight="600"
|
||||
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
|
||||
comn:DialogWindowProperty.ShowMinButton="False"
|
||||
comn:DialogWindowProperty.Width="1300"
|
||||
Loaded="TaobaoLoginView_Loaded"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
</UserControl.Resources>
|
||||
<Grid Background="White">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 地址栏 -->
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Background="White"
|
||||
BorderBrush="#E0E0E0"
|
||||
BorderThickness="0,0,0,1">
|
||||
<TextBox
|
||||
x:Name="txtAddress"
|
||||
Margin="3,2"
|
||||
VerticalContentAlignment="Center"
|
||||
BorderBrush="#D0D0D0"
|
||||
BorderThickness="1"
|
||||
KeyDown="txtAddress_KeyDown"
|
||||
Text="{Binding Address, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</Border>
|
||||
|
||||
<!-- 主区域:浏览器 + 右侧面板 -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 浏览器容器 -->
|
||||
<Grid
|
||||
x:Name="BrowserHost"
|
||||
Grid.Column="0"
|
||||
Background="White"
|
||||
ClipToBounds="True" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,63 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using _29WxOrderWpf.ViewModels;
|
||||
using AllBase.Model.DBModel;
|
||||
using CefSharp.Wpf;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace _29WxOrderWpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// 淘宝买手登录窗口(WPF 版 TaobaoLoginView)
|
||||
/// </summary>
|
||||
public partial class TaobaoLoginView : UserControl
|
||||
{
|
||||
/// <summary>视图模型</summary>
|
||||
public TaobaoLoginViewModel ViewModel { get; }
|
||||
|
||||
public TaobaoLoginView(BuyerLoginInfo buyerInfo)
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
ViewModel = new TaobaoLoginViewModel(buyerInfo);
|
||||
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
|
||||
ViewModel.RequestClose += ViewModel_RequestClose;
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void TaobaoLoginView_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.Start();
|
||||
}
|
||||
|
||||
private void TaobaoLoginView_Closed(object sender, System.EventArgs e)
|
||||
{
|
||||
ViewModel.Stop();
|
||||
}
|
||||
|
||||
private void ViewModel_BrowserCreated(ChromiumWebBrowser browser)
|
||||
{
|
||||
Grid.SetRow(browser, 0);
|
||||
Grid.SetColumn(browser, 0);
|
||||
BrowserHost.Children.Add(browser);
|
||||
}
|
||||
|
||||
private void ViewModel_RequestClose()
|
||||
{
|
||||
Window parentWindow = Window.GetWindow(this);
|
||||
if (this.IsLoaded && parentWindow != null)
|
||||
parentWindow.Close();
|
||||
}
|
||||
|
||||
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
ViewModel.ReloadCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user