Ejemplo n.º 1
0
        void GetAndShowProperties(int configFileUIIndex)
        {
            var configFileUse     = GetConfigFileUseFromUIIndex(configFileUIIndex);
            var defaultProperties = new MainSettings();

            defaultProperties.SetDefault();

            var readProperties = ConfigurationHelper.GetMainProperties(configFileUse, defaultProperties, writeToLog: null);

            ShowSettings(readProperties);
        }
Ejemplo n.º 2
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            MainSettings.SetDefault();

            logNumericUpDown.Value      = MainSettings.LogFontSize;
            treeViewNumericUpDown.Value = MainSettings.TreeViewFontSize;

            retryCountNumericUpDown.Value   = MainSettings.RetryCount;
            retryTimeoutNumericUpDown.Value = MainSettings.RetryTimeout;

            receiveTimeoutNumericUpDown.Value = MainSettings.ReceiveTimeout;
            serverTimeoutNumericUpDown.Value  = MainSettings.ServerTimeout;

            prefetchCountNumericUpDown.Value = MainSettings.PrefetchCount;
            topNumericUpDown.Value           = MainSettings.TopCount;

            senderThinkTimeNumericUpDown.Value   = MainSettings.SenderThinkTime;
            receiverThinkTimeNumericUpDown.Value = MainSettings.ReceiverThinkTime;

            monitorRefreshIntervalNumericUpDown.Value = MainSettings.MonitorRefreshInterval;
            cboConnectivityMode.SelectedItem          = MainSettings.ConnectivityMode;
            useAmqpWebSocketsCheckBox.Checked         = MainSettings.UseAmqpWebSockets;
            cboEncodingType.SelectedItem = EncodingType.ASCII;

            saveMessageToFileCheckBox.Checked     = MainSettings.SaveMessageToFile;
            showMessageCountCheckBox.Checked      = MainSettings.ShowMessageCount;
            savePropertiesToFileCheckBox.Checked  = MainSettings.SavePropertiesToFile;
            saveCheckpointsToFileCheckBox.Checked = MainSettings.SaveCheckpointsToFile;
            useAsciiCheckBox.Checked = MainSettings.UseAscii;

            foreach (var item in ConfigurationHelper.Entities)
            {
                cboSelectedEntities.CheckBoxItems[item].Checked = true;
            }

            foreach (var item in ConfigurationHelper.MessageCounts)
            {
                cboSelectedEntities.CheckBoxItems[item].Checked = true;
            }

            MainSettings.MessageBodyType = MainSettings.MessageBodyType; // .Stream.ToString();

            disableAccidentalDeletionPrevention.Checked = MainSettings.DisableAccidentalDeletionPrevention;

            overrideDefaultProxyCheckBox.Checked = MainSettings.ProxyOverrideDefault;
            txtProxyAddress.Text    = MainSettings.ProxyAddress;
            txtProxyBypassList.Text = MainSettings.ProxyBypassList;
            bypassProxyOnLocalAddressesCheckBox.Checked = MainSettings.ProxyBypassOnLocal;
            useDefaultProxyCredentialsCheckBox.Checked  = MainSettings.ProxyUseDefaultCredentials;
            txtProxyUserName.Text = MainSettings.ProxyUserName;
            txtProxyPassword.Text = MainSettings.ProxyPassword;

            SetNodesColorsIntoBindingList(MainSettings.NodesColors);
        }
Ejemplo n.º 3
0
        void cboConfigFile_SelectionChangeCommitted(object sender, EventArgs e)
        {
            // Check if there is a difference compared to the configuration we are switching to
            var defaultProperties = new MainSettings();

            defaultProperties.SetDefault();
            var resultingProperties = ConfigurationHelper.GetMainProperties(
                GetConfigFileUseFromUIIndex(cboConfigFile.SelectedIndex), defaultProperties, null);

            if (MainSettings.Equals(resultingProperties))
            {
                lastConfigFileIndex = cboConfigFile.SelectedIndex;
                ConfigFileUse       = GetConfigFileUseFromUIIndex(lastConfigFileIndex);
                return;
            }

            var answer = MessageBox.Show("One or more settings are different in the configuration file selected. " +
                                         "Do you want to use the settings from "
                                         + $"{ConfigUseForUI[cboConfigFile.SelectedIndex]}?",
                                         "Use new config file settings", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            switch (answer)
            {
            case DialogResult.Yes:
                GetAndShowProperties(cboConfigFile.SelectedIndex);
                break;

            case DialogResult.No:
                break;

            case DialogResult.Cancel:
                cboConfigFile.SelectedIndex = lastConfigFileIndex;
                return;      // Don't do anything else

            default:
                throw new InvalidDataException("Unexpected value returned from MessageBox.");
            }

            // We get if either Yes or No was selected
            lastConfigFileIndex = cboConfigFile.SelectedIndex;
            ConfigFileUse       = GetConfigFileUseFromUIIndex(lastConfigFileIndex);
        }
Ejemplo n.º 4
0
        private void btnDefault_Click(object sender, EventArgs e)
        {
            MainSettings.SetDefault();

            logNumericUpDown.Value      = MainSettings.LogFontSize;
            treeViewNumericUpDown.Value = MainSettings.TreeViewFontSize;

            retryCountNumericUpDown.Value   = MainSettings.RetryCount;
            retryTimeoutNumericUpDown.Value = MainSettings.RetryTimeout;

            receiveTimeoutNumericUpDown.Value = MainSettings.ReceiveTimeout;
            serverTimeoutNumericUpDown.Value  = MainSettings.ServerTimeout;

            prefetchCountNumericUpDown.Value = MainSettings.PrefetchCount;
            topNumericUpDown.Value           = MainSettings.TopCount;

            senderThinkTimeNumericUpDown.Value   = MainSettings.SenderThinkTime;
            receiverThinkTimeNumericUpDown.Value = MainSettings.ReceiverThinkTime;

            monitorRefreshIntervalNumericUpDown.Value = MainSettings.MonitorRefreshInterval;
            cboConnectivityMode.SelectedItem          = ConnectivityMode.AutoDetect;
            cboEncodingType.SelectedItem = EncodingType.ASCII;

            saveMessageToFileCheckBox.Checked     = MainSettings.SaveMessageToFile;
            showMessageCountCheckBox.Checked      = MainSettings.ShowMessageCount;
            savePropertiesToFileCheckBox.Checked  = MainSettings.SavePropertiesToFile;
            saveCheckpointsToFileCheckBox.Checked = MainSettings.SaveCheckpointsToFile;
            useAsciiCheckBox.Checked = MainSettings.UseAscii;

            foreach (var item in ConfigurationHelper.Entities)
            {
                cboSelectedEntities.CheckBoxItems[item].Checked = true;
            }

            MainSettings.MessageBodyType = MainSettings.MessageBodyType; // .Stream.ToString();
        }