private void TogglePreviewElements(bool isVisible) { btnLoadMap.Visible = isVisible && _destinationProfile != null; btnSaveMap.Visible = isVisible && _destinationProfile != null; btnDestinationProfile.Visible = isVisible; btnPreviewEdit.Visible = _destinationProfile != null; cbKeepUnmapped.Visible = _destinationProfile != null && _sourceProfile.GetChannelCount() <= _destinationProfile.GetChannelCount() && isVisible; btnCancel.Visible = isVisible; btnTransform.Visible = isVisible && _destinationProfile != null; for (var i = 0; i < _totalChannelsDisplayed; i++) { _textBoxes[i].Visible = isVisible; } }
private void BtnTransformClick(object sender, EventArgs e) { SaveCurrentValues(); SaveToFileIfDirty(); var destCount = new int[_destinationProfile.GetChannelCount()]; var badChannels = FindBadChannels(destCount); var dupeChannels = FindDupeChannels(destCount); if (string.IsNullOrEmpty(badChannels) && string.IsNullOrEmpty(dupeChannels)) { IsMapValid = true; if (ActiveForm == null) { return; } ActiveForm.DialogResult = DialogResult.OK; if (ActiveForm != null) { ActiveForm.Close(); } } else { IsMapValid = false; ShowErrors(dupeChannels, badChannels); } }
private void ShowComponents(int start, bool save = true) { if (save) { SaveCurrentValues(); } for (var row = 0; row < _totalChannelsDisplayed; row++) { _labels[row].Text = _sourceProfile.GetChannelName(start + row); _labels[row].BackColor = _sourceProfile.GetChannelColor(start + row); _labels[row].ForeColor = _labels[row].BackColor.GetForeColor(); _textBoxes[row].Text = _destinationTextBoxText[_sourceProfile.GetChannelLocation(start + row)]; if (!_isPreview) { continue; } var s = _textBoxes[row].Text.Split(_splitChar, StringSplitOptions.RemoveEmptyEntries); var col = 0; foreach (var channel in s) { var channelNum = int.Parse(channel); var c = Controls.Find("r" + row + "c" + col, true)[0]; if (channelNum < _destinationNatural.GetChannelCount()) { c.Text = _destinationNatural.GetChannelName(channelNum); c.BackColor = _destinationNatural.GetChannelColor(channelNum); c.ForeColor = c.BackColor.GetForeColor(); c.Visible = true; } col++; } for (; col < _maxDestinationCount; col++) { Controls.Find("r" + row + "c" + col, true)[0].Visible = false; } } _currentTopChannelIndex = start; vsb.Value = start; }
public ChannelMapper(EventSequence sequence) { _sourceSequence = sequence; _useCheckmark = Preference2.GetInstance().GetBoolean("UseCheckmark"); InitializeComponent(); _sourceProfile = new ChannelMapperProfile(_sourceSequence.Profile.FileName); //_sourceNatural = new ChannelMapperProfile(sourceSequence.Profile.FileName); _sourceChannelCount = _sourceProfile.GetChannelCount(); InitializeDropDownList(); InitializeScrollbar(); GetDestinationProfile(); BuildDynamicComponents(); InitializeDynamicComponents(); IsMapValid = false; MouseWheel += MapperMouseWheel; _previewButtonToolTip = toolTips.GetToolTip(btnPreviewEdit); _previewButtonText = btnPreviewEdit.Text; TogglePreviewElements(true); }