コード例 #1
0
        //private void NotifyIcon1_DoubleClick(object Sender, EventArgs e)
        //{
        //    // Show the form when the user double clicks on the notify icon.

        //    // Set the WindowState to normal if the form is minimized.
        //    if (WindowState == FormWindowState.Minimized)
        //        WindowState = FormWindowState.Normal;

        //    // Activate the form.
        //    Activate();
        //}

        //private void MenuItemExit_Click(object Sender, EventArgs e)
        //{
        //    // Cleanup and close the app.
        //    shutdown();

        //}
        //private void MenuItemSetIP_Click(object Sender, EventArgs e)
        //{
        //    // Set a Static IP
        //    SetStaticIP();

        //}



        private void BtnQuit_Click(object sender, EventArgs e)
        {
            bool   dhcpstatus;
            string NicName = (string)CboNic.SelectedItem;

            WMIHelper.GetDHCP(NicName, out dhcpstatus);
            if (dhcpstatus == true)
            {
                //if DHCP is true... just exit
                shutdown();
            }
            if (dhcpstatus == !true)
            {
                string       ExitMessage  = "You have a Static IP set.\n\nThis could disable internet access when plugged back\ninto the network. \n\nTo Re-enable Internet access re-run this software and \nchoose Return to DHCP \n\nAre you sure you want to exit this program\nwith a Static IP still Set? ";
                DialogResult dialogResult = MessageBox.Show(ExitMessage, "Are You sure you want to exit.", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.Yes)
                {
                    shutdown();
                }
                else if (dialogResult == DialogResult.No)
                {
                }
            }

            // shutdown();
        }