lu
7 天以前 2f7b627c9bddb533c929e6750aad73f8da6a60ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using CefSharp;
using CefSharp.WinForms;
using Gs.DevApp.DevFrm;
using Gs.DevApp.DevFrm.Work;
using Gs.DevApp.Properties;
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
 
namespace Gs.DevApp
{
    internal static class Program
    {
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main()
        {
            var processName =
                Path.GetFileNameWithoutExtension(Process.GetCurrentProcess()
                    .MainModule.FileName);
            var processes = Process.GetProcessesByName(processName);
            if (processes.Length > 1)
            {
                MessageBox.Show("程序已经在运行!");
                Environment.Exit(0);
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                _startLogin();
            }
        }
 
        /// <summary>
        ///     登录页启动
        /// </summary>
        private static void _startLogin()
        {
            //Application.Run(new Gs.DevApp.XtraForm1());
            //return;
 
            CefSettings settings = new CefSettings();
            settings.Locale = "zh-CN";
            Cef.Initialize(settings);
            var fmLogin = new FrmLogin();
            if (fmLogin.IsDisposed == false)
            {
                fmLogin.ShowDialog();
                if (fmLogin.DialogResult == DialogResult.OK)
                {
                    //Application.Run(new DevFrm.User.SysMenu());
                    //return;
                    bool IsWeight = false;
                    try
                    {
                        IsWeight = Settings.Default.isWeight;
                    }
                    catch (Exception)
                    {
                    }
                    if (IsWeight == true)
                        Application.Run(new Frm_Work09());
                    else
                        Application.Run(new FrmMain());
                }
            }
            else
            {
                Application.Exit();
            }
        }
    }
}