Пример #1
0
        static void Main()
        {
            CurrentPlatform Platform = CurrentPlatform.Create();

            if (Platform.OS == CurrentPlatform.OSType.Windows)
            {
                if (ProcessManager.IsCurrentUserAdmin())
                {
                    using (Mutex Mtx = new Mutex(false, Properties.Resources.AppName))
                    {
                        if (Mtx.WaitOne(0, false))
                        {
                            Application.EnableVisualStyles();
                            Application.SetCompatibleTextRenderingDefault(false);
                            Application.Run(new FrmKBHelper());
                        }
                        else
                        {
                            MessageBox.Show(AppStrings.KB_AlrLaunched, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            Environment.Exit(ReturnCodes.AppAlreadyRunning);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(AppStrings.KB_NoAdminRights, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(AppStrings.KB_OSNotSupported, Properties.Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }