修改主窗口 header 拖动bug.

拼多多登录 改为WPF 。PddMobileLoginForm 不再使用
This commit is contained in:
chfei committed 2026-09-01 14:30:25 +08:00
1 parent ce828fe467
commit 446224f4cf
15 files changed
+1328 -467

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
<UserControl
x:Class="_29WxOrderWpf.Views.PddMobileLoginView"
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="pddMobileLoginView"
Width="1024"
Height="768"
MinWidth="800"
MinHeight="600"
comn:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
comn:DialogWindowProperty.ShowMinButton="False"
comn:DialogWindowProperty.Width="1300"
Loaded="PddMobileLoginView_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="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="530" />
</Grid.ColumnDefinitions>
<!-- 浏览器容器 -->
<Grid
x:Name="BrowserHost"
Grid.Column="0"
Background="White"
ClipToBounds="True" />
<GridSplitter
Grid.Column="1"
Width="3"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#E0E0E0"
ResizeBehavior="PreviousAndNext"
ShowsPreview="True" />
<!-- 右侧面板 -->
<Border
Grid.Column="2"
Background="White"
BorderBrush="#E0E0E0"
BorderThickness="1,0,0,0">
<StackPanel Margin="24,24,24,0">
<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
FontSize="15"
Foreground="#333333"
Text="请使用拼多多手机版扫码登录"
Visibility="{Binding IsLoginMode, Converter={StaticResource BoolToVis}}" />
<StackPanel Visibility="{Binding IsLoginMode, Converter={StaticResource BoolToVis}}">
<TextBlock
Margin="0,0,0,8"
Foreground="#555555"
Text="导入PDDAccessToken:" />
<TextBox
x:Name="txtAccessToken"
Height="120"
VerticalContentAlignment="Top"
AcceptsReturn="True"
BorderBrush="#D0D0D0"
BorderThickness="1"
Text="{Binding AccessToken, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
<Button
Width="64"
Height="26"
Margin="0,10,0,0"
HorizontalAlignment="Right"
Command="{Binding SaveCookieCommand}"
Content="保存"
Style="{StaticResource BasePageButtonStyle}" />
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,61 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.ViewModels;
using AllBase.Model.DBModel;
using CefSharp.Wpf;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace _29WxOrderWpf.Views
{
/// <summary>
/// 拼多多买手移动版登录窗口(WPF 版 PddMobileLoginForm)
/// </summary>
public partial class PddMobileLoginView : UserControl
{
/// <summary>视图模型</summary>
public PddMobileLoginViewModel ViewModel { get; }
public PddMobileLoginView(BuyerLoginInfo buyerInfo)
{
InitializeComponent();
ViewModel = new PddMobileLoginViewModel(buyerInfo);
ViewModel.BrowserCreated += ViewModel_BrowserCreated;
//ViewModel.RequestClose += ViewModel_RequestClose;
DataContext = ViewModel;
}
private void PddMobileLoginView_Loaded(object sender, RoutedEventArgs e)
{
ViewModel.Start();
}
private void PddMobileLoginView_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()
//{
// if (this.IsLoaded)
// this.Close();
//}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
ViewModel.ReloadCommand.Execute(null);
}
}
}
}