2025-03-28 09:49:56 +08:00

91 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows;
namespace HiiShe.Manager
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
//[DllImport("user32", CharSet = CharSet.Unicode)]
//static extern IntPtr FindWindow(string cls, string win);
//[DllImport("user32")]
//static extern IntPtr SetForegroundWindow(IntPtr hWnd);
//[DllImport("user32")]
//static extern bool IsIconic(IntPtr hWnd);
//[DllImport("user32")]
//static extern bool OpenIcon(IntPtr hWnd);
//protected override void OnStartup(StartupEventArgs e)
//{
// bool isNew;
// var mutex = new Mutex(true, "收银基础信息管理系统", out isNew);
// if (!isNew)
// {
// ActivateOtherWindow();
// Shutdown();
// }
//}
//private static void ActivateOtherWindow()
//{
// var other = FindWindow(null, "MainWindow");
// if (other != IntPtr.Zero)
// {
// SetForegroundWindow(other);
// if (IsIconic(other))
// OpenIcon(other);
// }
//}
private void Application_Startup(object sender, StartupEventArgs e)
{
if (e.Args.Length>0&&e.Args[0].ToString()=="login")
{
MainWindow window = new MainWindow();
window.WindowState = WindowState.Maximized;
window.Show();
}
else
{
Login window = new Login();
window.Show();
}
}
}
class Program
{
public static string InputArgs = "";
[STAThread]
static void Main(string[] args)
{
if (args.Length > 0 && args[0] == "login")
{
App app = new App();
app.InitializeComponent();
MainWindow window = new MainWindow();
window.WindowState = WindowState.Maximized;
app.MainWindow = window;
app.Run();
//App.Main();
}
else
{
App app = new App();
app.InitializeComponent();
Login window = new Login();
app.MainWindow = window;
app.Run();
//App.Main();
}
}
}
}