コード例 #1
0
        // Called when AdvancedButton has been clicked.
        private void AdvancedButton_Click(object sender, EventArgs args)
        {
            // Create list items for each adapter.
            AvailableNetworkAdapters.Items.Clear();
            foreach (Adapter adapter in AllAdapters)
            {
                NetworkAdapterItem item = new NetworkAdapterItem();
                item.IP           = adapter.IP;
                item.MAC          = adapter.MAC;
                item.Description  = adapter.Description;
                item.AdapterIndex = adapter.Index;

                AvailableNetworkAdapters.Items.Add(item);
            }

            // Display the advanced layout.
            AdvancedLayout.Visibility = Visibility.Visible;
            MainLayout.Visibility     = Visibility.Collapsed;
            Height += 200;
        }
コード例 #2
0
        // Called when SelectButton has been clicked.
        private void SelectButton_Click(object sender, EventArgs args)
        {
            // Check if an adapter has been selected.
            if (AvailableNetworkAdapters.SelectedIndex == -1)
            {
                MessageBox.Show("No adapter selected!");
                return;
            }

            // Start the program using the selected adapter.
            NetworkAdapterItem adapter = (NetworkAdapterItem)AvailableNetworkAdapters.SelectedItem;

            // Check if we want to save this as a default adapter.
            if (AlwaysUseAdvanced.IsChecked.Value)
            {
                // Save the selected adapter.
                SettingsHandler handler = SettingsHandler.GetInstance();
                handler.DefaultAdapterMAC = adapter.MAC;
                handler.UseDefaultAdapter = true;
                handler.SaveSettings();
            }

            LaunchProgram(adapter.AdapterIndex);
        }
コード例 #3
0
        // Called when AdvancedButton has been clicked.
        private void AdvancedButton_Click(object sender, EventArgs args)
        {
            // Create list items for each adapter.
            AvailableNetworkAdapters.Items.Clear();
            foreach (Adapter adapter in AllAdapters)
            {
                NetworkAdapterItem item = new NetworkAdapterItem();
                item.IP = adapter.IP;
                item.Description = adapter.Description;
                item.AdapterIndex = adapter.Index;

                AvailableNetworkAdapters.Items.Add(item);
            }

            // Display the advanced layout.
            AdvancedLayout.Visibility = Visibility.Visible;
            MainLayout.Visibility = Visibility.Collapsed;
            Height += 200;
        }