Files
KJD/TEMUKJD/ChangeForm.cs
2026-07-04 10:29:33 +08:00

196 lines
6.5 KiB
C#

using AllBase;
using AllBase.Helper;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//using TemuKJD.ChatForms;
//using TemuKJD.DashBoardForms;
using TemuKJD.BaseForms;
using TemuKJD.WXForms.AiTalkForms;
using TemuKJD.WXForms.TalkForms;
using Work;
namespace TemuKJD
{
public partial class ChangeForm : BaseGeneralForm
{
public MainForm mf;
public ChangeForm()
{
InitializeComponent();
}
private void ChangeForm_Load(object sender, EventArgs e)
{
TitleText = "功能选择 - " + BaseClass.ToolName;
if (BaseClass.Ico != null)
{
Iconx = BaseClass.Ico;
Icon = BaseClass.Ico;
}
mf.Hide();
Text += " - " + BaseClass.ToolName;
pnlExtend.Visible = BaseClass.DarenYaoyue;
//直接登录上货工具
if (BaseClass.MainPath != "29wx") // 在此处切换是否显示登录客服选项功能
{
label1.Visible = true;
pnlChat.Visible = pnlUploadGoods.Visible = pnlAiTalk.Visible = pnlPurchase.Visible = false;
Task.Run(() =>
{
System.Threading.Thread.Sleep(100);
Invoke(new Action(() =>
{
pnlUpload_Click(this.pnlUploadGoods, null);
}));
});
}
else
{
label1.Visible = false;
pnlChat.Visible = pnlUploadGoods.Visible = true;
if (BaseClass.ForbiddenPage.Contains("客服"))
{
pnlChat.Visible = false;
pnlAiTalk.Visible = false;
//pnlUpload_Click(null, null);
}
if (BaseClass.ForbiddenPage.Contains("拍单"))
{
pnlPurchase.Visible = false;
//pnlUpload_Click(null, null);
}
if (BaseClass.ForbiddenPage.Contains("上货"))
{
pnlUploadGoods.Visible = false;
//pnlUpload_Click(null, null);
}
}
this.pnlChat.StyleMouseOver.BorderColor.Color = GlobalConfig.BorderColor;
this.pnlUploadGoods.StyleMouseOver.BorderColor.Color = GlobalConfig.BorderColor;
}
private void panel1_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.FileName = "TaobaoLoginer.exe";
p.StartInfo.Arguments = BaseClass.UserName + " " + BaseClass.PassWord;
p.StartInfo.UseShellExecute = true;
p.StartInfo.Verb = "runas";
p.Start();
Process.GetCurrentProcess().Kill();
}
private void pnlUpload_Click(object sender, EventArgs e)
{
mf.WindowState = FormWindowState.Maximized;
mf.Show();
mf.SetTitle();
mf.ShowTaobaoLoginAndInitModule();
Hide();
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
private void panel3_Click(object sender, EventArgs e)
{
try
{
if (File.Exists("29WxFindOrder.exe"))
{
Process p = new Process();
p.StartInfo.FileName = "29WxFindOrder.exe";
//p.StartInfo.Arguments = "user_name:" + BaseClass.UserName + " " + "user_name:" + BaseClass.PassWord;
p.StartInfo.Arguments = BaseClass.UserName + " " + BaseClass.PassWord;
// 新版cef不能使用管理员权限启动,否则win10下会报错
//p.StartInfo.UseShellExecute = true;
p.StartInfo.UseShellExecute = false;
// "runas" 权限继承主程序
//p.StartInfo.Verb = "runas";
p.Start();
// 强制客服窗口打开时在最上层,win10可能会导致错误
p.WaitForInputIdle();
IntPtr hWnd = p.MainWindowHandle;
if (hWnd != IntPtr.Zero)
{
// 尝试将窗口设为最顶层窗口
SetForegroundWindow(hWnd);
}
Process.GetCurrentProcess().Kill();
}
else
{
BaseMsgForm.ShowInfo("未找到拍单程序启动文件");
}
}
catch
{
}
}
private void pnlWebOrder_Click(object sender, EventArgs e)
{
string url = "http://oa.qixiaoke.com/?obj=public/jump_login&url=order&" + UserLogin.GetSignaturex();
GetHtml.OpenUrl(url);
}
private void ChangeForm_FormClosed(object sender, FormClosedEventArgs e)
{
Process.GetCurrentProcess().Kill();
}
private void pnlChat_Click(object sender, EventArgs e)
{
//ChatForm cf = new ChatForm();
//cf.Show();
//cf.SetTitle();
//Hide();
WxTalkForm cf = new WxTalkForm();
cf.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width - 120, Screen.PrimaryScreen.WorkingArea.Height - 100);
cf.Show();
//cf.SetTitle();
Hide();
}
private void pnlExtend_Click(object sender, EventArgs e)
{
//DashBoardForm df = new DashBoardForm();
//df.Show();
////df.SetTitle();
//Hide();
}
private void pnlAiTalk_Click(object sender, EventArgs e)
{
WxAiTalkForm aikf = new WxAiTalkForm();
aikf.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width - 120, Screen.PrimaryScreen.WorkingArea.Height - 100);
aikf.Show();
Hide();
}
private void label2_Click(object sender, EventArgs e)
{
WxAiTalkForm aikf = new WxAiTalkForm();
aikf.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width - 120, Screen.PrimaryScreen.WorkingArea.Height - 100);
aikf.Show();
Hide();
}
}
}