private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var Box = sender as ComboBox; string TempStr = Box.SelectedItem.ToString(); int Cnt = 0; foreach (var str in MethodsList) { if (str == TempStr) { CurrentMethod = StringToEnum(Cnt); SwitchBlocks(CurrentMethod); return; } Cnt++; } }
private void SwitchBlocks(EMeths method) { switch (CurrentMethod) { case EMeths.Scale: { SettingsBlock.Visibility = Visibility.Visible; SecondSignalBlock.Visibility = Visibility.Hidden; // ExpandStackPanel.Visibility = Visibility.Hidden; FactorUpDown.Minimum = 1; FactorUpDown.Value = 1; SwapSize(true); // Grid.SetColumnSpan(FactorStackPanel, 2); Grid.SetRow(OutputBlock, 3); break; } case EMeths.AddTwoSignals: { SettingsBlock.Visibility = Visibility.Hidden; SecondSignalBlock.Visibility = Visibility.Visible; SwapSize(false); Grid.SetRow(OutputBlock, 3); break; } case EMeths.ExpandInTime: { SettingsBlock.Visibility = Visibility.Visible; SecondSignalBlock.Visibility = Visibility.Hidden; // ExpandStackPanel.Visibility = Visibility.Visible; FactorUpDown.Minimum = 1; FactorUpDown.Value = 1; SwapSize(true); Grid.SetRow(OutputBlock, 3); // Grid.SetColumnSpan(FactorStackPanel, 1); break; } case EMeths.MultiplyTwoSignals: { SettingsBlock.Visibility = Visibility.Hidden; SecondSignalBlock.Visibility = Visibility.Visible; SwapSize(false); Grid.SetRow(OutputBlock, 3); break; } case EMeths.Reverse: { SecondSignalBlock.Visibility = Visibility.Hidden; SettingsBlock.Visibility = Visibility.Hidden; SwapSize(false); Grid.SetRow(OutputBlock, 2); break; } case EMeths.ShiftByTime: { SecondSignalBlock.Visibility = Visibility.Hidden; SettingsBlock.Visibility = Visibility.Visible; //ExpandStackPanel.Visibility = Visibility.Hidden; FactorUpDown.Minimum = -20; FactorUpDown.Value = 1; SwapSize(true); Grid.SetRow(OutputBlock, 3); break; } default: break; } }
private EMeths StringToEnum(int s) { EMeths f = (EMeths)s; return(f); }