示例#1
0
        private void UpdateControlsFromSettings()
        {
            try
            {
                isUpdatingControlsFromSettings = true;

                Text = "Mediator " + settings.DeviceAddressNotNull;

                powerStatus.IsPoweredOn = settings.IsPoweredOn;
                portLabel.Text          = settings.ComPortName ?? ComPortSelectionForm.AutoText;

                portGroupBox.Enabled          = !settings.IsPoweredOn;
                statusVersionGroupBox.Enabled = !settings.IsPoweredOn;
                logButton.Enabled             = settings.IsPoweredOn;

                statusCodeLinkLabel.Text = MediatorStatusSelectionForm.GetTextFor(settings.MediatorStatus);

                Version version = settings.ProtocolVersionOrDefault;
                versionLinkLabel.Text = $"v{version.Major}.{version.Minor}.{version.Build}";

                // When the links are disabled, their text gets cut off. But tracked at: https://github.com/dotnet/winforms/issues/3780
            }
            finally
            {
                isUpdatingControlsFromSettings = false;
            }
        }
示例#2
0
        private void StatusCodeLinkLabel_LinkClicked(object?sender, LinkLabelLinkClickedEventArgs e)
        {
            using var form = new MediatorStatusSelectionForm
                  {
                      StatusCode = settings.MediatorStatus
                  };

            if (ShowDialogForm(form) == DialogResult.OK)
            {
                settings.MediatorStatus = form.StatusCode;
                UpdateControlsFromSettings();
                UpdateSessionManagerFromSettings();
            }
        }
        private void StatusCodeLinkLabel_LinkClicked([CanBeNull] object sender,
            [NotNull] LinkLabelLinkClickedEventArgs e)
        {
            using (var form = new MediatorStatusSelectionForm())
            {
                form.StatusCode = settings.MediatorStatus;

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    settings.MediatorStatus = form.StatusCode;
                    UpdateControlsFromSettings();
                    UpdateSessionManagerFromSettings();
                }
            }
        }