CPlan.W3LF.frmMain.btnSave_Click C# (CSharp) Метод

btnSave_Click() приватный Метод

Saves the new Warcraft III start-up settings.
private btnSave_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e EventArgs An System.EventArgs that contains no event data.
Результат void
        private void btnSave_Click(object sender, EventArgs e)
        {
            // Create a new Loader.StartOptions variable with None as default flag.
            // None means really no startup flag at all.
            Loader.StartOptions opt = Loader.StartOptions.None;

            /*
             * Explained:
             * The operator | means or.
             * In an If...Else statement it would look like this:
             * <code>
             * bool A = true;
             * bool B = false;
             * if (A == true || B == true)
             * {
             * Console.WriteLine("A or B is true");
             * }
             * </code>
             *
             * To add a flag to an enum use |= (Or is)
             *
             * I'm not such an expert to tell you how it works in detail however, it has something to do with bit comparing. (Refer to Wikipedia.)
             */
            if (cbClassic.Checked) opt |= Loader.StartOptions.Classic;
            if (cbOpenGL.Checked) opt |= Loader.StartOptions.OpenGl;
            if (cbSWTNL.Checked) opt |= Loader.StartOptions.SWTNL;
            if (cbWindow.Checked) opt |= Loader.StartOptions.Window;

            // Let the settings class handle the rest.
            Settings.StartupOptions = opt;
        }