Esempio n. 1
0
        static void Main()
        {
            // Check OS since we are using dual-mode socket
            if (!RuntimeUtil.IsWinVistaOrHigher())
            {
                MsgBox.Error("Unsupported operating system,use Windows 7 at least");
                return;
            }
            // Check .NET Framework version
            if (!RuntimeUtil.GetVersionFromRegistry())
            {
                if (DialogResult.OK == MsgBox.ErrorRes("Unsupported .NET Framework,require 4.8 version"))
                {
                    Process.Start("https://dotnet.microsoft.com/download/dotnet-framework");
                }
                return;
            }

            //Check running sysproxy
            using (Mutex mutex = new Mutex(false, "Global\\sysproxy" + Application.StartupPath.GetHashCode()))
            {
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                if (!mutex.WaitOne(0, false))
                {
                    Process[] oldProcesses = Process.GetProcessesByName("sysproxy");
                    if (oldProcesses.Length > 0)
                    {
                        MsgBox.Show(I18N.GetString("Find sysproxy icon in your notify tray,which is usually on bottom right corner"));
                        return;
                    }
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                menuView = new MenuView();
                Application.Run();
            }
        }