Esempio n. 1
0
        internal async void DoDeactivateAdapter()
        {
            SetStatus(SwitcherStatus.DeactivatingAdapter);
            await SelectedAdapter.Deactivate();

            SetStatus(SwitcherStatus.Idle);
        }
Esempio n. 2
0
        private async void DoManualSettings()
        {
            Effect = true;
            dynamic parameters = new ExpandoObject();

            parameters.IsManualSettings = true;
            parameters.Location         = SelectedAdapter.ExtractConfig(string.Empty);
            await Show.Dialog <LocationDetailView>(parameters, new Func <LocationDetailView, Task>(async(view) =>
            {
                if (view.DialogResult ?? false)
                {
                    Effect = false;
                    SetStatus(SwitcherStatus.ApplyingLocation);

                    var location = (Location.Location)view.DataContext;

                    await SelectedAdapter.ApplyLocation(location);
                    Current.Update(SelectedAdapter, null, null);

                    SetStatus(SwitcherStatus.Idle);
                }
            }));

            Effect = false;
        }
Esempio n. 3
0
        private async void DoRefreshDhcpLease()
        {
            SetStatus(SwitcherStatus.RefreshingDhcp);

            await SelectedAdapter.RenewDhcp();

            SetStatus(SwitcherStatus.Idle);
        }
Esempio n. 4
0
        private async void DoApplyLocation()
        {
            SetStatus(SwitcherStatus.ApplyingLocation);

            var location = SelectedLocation;
            await SelectedAdapter.ApplyLocation(location);

            SetStatus(SwitcherStatus.Idle);
        }
Esempio n. 5
0
        private void DoExtractConfigToNewLocation()
        {
            Effect = true;
            var inputBox = new InputBox.InputBoxView {
                Owner = Window.GetWindow(owner), WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            inputBox.ShowDialog();

            // If user saved, replace original
            if (inputBox.DialogResult ?? false)
            {
                Settings.Default.Locations.Add(SelectedAdapter.ExtractConfig(inputBox.Result));
                Settings.Save();
                Locations        = Settings.Default.Locations.ToList();
                SelectedLocation = Locations.Last();
            }

            Effect = false;
        }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (StaticRadioButton.Checked)
            {
                int grade  = (int)GradeComboBox.SelectedItem;
                int number = (int)NumberComboBox.SelectedItem;

                SelectedAdapter.ToStaticIP(IPAddress, "255.255.255.0", GateWay, new string[] { "210.111.226.7", "210.111.226.8" });
                MessageBox.Show("Configured.");
            }
            else if (DynamicRadioButton.Checked)
            {
                SelectedAdapter.ToDynamicIP();
                MessageBox.Show("Configured.");
            }
            else
            {
                MessageBox.Show("Please Check Any Button!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }