ToString() public méthode

public ToString ( ) : string
Résultat string
 private string GenerateKeyName(Note note)
 {
     return note.ToString().Replace('#', 'd');
 }
        // major - объект лада, который необходимо подсветить как основной
        private void HighlightNote(Note note, Shape major = null)
        {
            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            Color newColor = (note.Octave >= StartOctave && note.Octave <= EndOctave) ? GetColor() : Colors.Black;
            // ReSharper restore ConditionIsAlwaysTrueOrFalse
            var baseColor = new SolidColorBrush(newColor);
            Color tmp = newColor;
            tmp.A = InactiveFretAlpha;
            var highlighted = new SolidColorBrush(tmp);

            List<Tuple<byte, byte>> lst = _guitar.GetFretsForNote(note);
            foreach (var objName in lst)
            {
                object o = LogicalTreeHelper.FindLogicalNode(FretsGrid,
                    GenerateFretName(objName.Item1, objName.Item2));
                if (o != null)
                {
                    ((Shape) o).Fill = highlighted;
                }
            }

            if (major != null)
            {
                major.Fill = baseColor;
            }

            string str = GenerateKeyName(note);
            TChordName.Text = note.ToString().Replace('#', '♯');

            var bNote = (TextBlock) LogicalTreeHelper.FindLogicalNode(KeysGrid, str); // имя клавиши имеет след. вид: "Тон[d]Октава"
            if (bNote != null)
            {
                bNote.Background = baseColor;
                bNote.Focus();
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            _player = new Player(this);

            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            CInstrument.ItemsSource = InstrumentNames;

            CTunes.ItemsSource = _tunes;

            CChordMods.ItemsSource = Chords.chordMods;

            CChords.ItemsSource = Chords.chordsBases;

            for (double speed = 0.25; speed <= 2.0; speed += 0.25)
            {
                CPlaySpeed.Items.Add(speed);
            }

            int devicesCount = MidiIn.NumberOfDevices;
            for (int i = 0; i < devicesCount; i++)
            {
                MidiInCapabilities device = MidiIn.DeviceInfo(i);
                CSelectedInput.Items.Add(device);
            }

            #region Генерация клавиш пианино

            int keyPosition = KeysOffset;

            for (byte octave = StartOctave; octave <= EndOctave; ++octave)
            {
                for (int i = 0; i < 12; ++i) // 12 полутонов в октаве
                {
                    var currentKey = new TextBlock();

                    var note = new Note(octave, (Tones) i);

                    currentKey.Text = note.ToString();
                    currentKey.Name = GenerateKeyName(note);

                    if (!note.isDiez()) //Если не диез
                    {
                        currentKey.Width = KeyWidth;
                        currentKey.Height = KeyHeight;

                        currentKey.Background = _genericColor;

                        currentKey.Margin = new Thickness(keyPosition, 0, 0, 0);
                        currentKey.Padding = new Thickness(0, 130, 0, 0);

                        currentKey.SetValue(Panel.ZIndexProperty, 0);

                        keyPosition += KeyWidth + KeysOffset;

                        currentKey.Foreground = Brushes.Black;

                        currentKey.FontSize = 14;
                    }
                    else
                    {
                        currentKey.Width = DiezWiddth;
                        currentKey.Height = DiezHeight;

                        currentKey.Background = _diezColor;

                        currentKey.Margin = new Thickness(keyPosition - DiezWiddth/2 + KeysOffset/2,
                            0, 0, 0);
                        currentKey.Padding = new Thickness(0, 75, 0, 0);

                        currentKey.SetValue(Panel.ZIndexProperty, 1);

                        currentKey.Foreground = Brushes.White;

                        currentKey.FontSize = 10;
                    }

                    currentKey.TextAlignment = TextAlignment.Center;

                    currentKey.FontWeight = FontWeights.Bold;
                    currentKey.Focusable = true;

                    currentKey.HorizontalAlignment = HorizontalAlignment.Left;
                    currentKey.VerticalAlignment = VerticalAlignment.Top;

                    currentKey.PreviewMouseLeftButtonDown += PianoKeyDown;
                    currentKey.PreviewMouseLeftButtonUp += PianoKeyUp;
                    currentKey.MouseLeave += PianoKeyLeave;

                    currentKey.PreviewMouseRightButtonUp += KeyToggled;

                    KeysGrid.Children.Add(currentKey);
                }
            }

            #endregion

            #region Генерация ладов для гитары

            for (byte guitarString = 0; guitarString < 6; ++guitarString)
            {
                for (byte fret = 0; fret < FretsCount; ++fret)
                {
                    Shape currentFret;
                    if (fret != 0)
                    {
                        currentFret = new Ellipse {Margin = new Thickness(FretOffset)};
                    }
                    else
                    {
                        currentFret = new Rectangle {Margin = new Thickness(0)};
                    }

                    currentFret.Name = GenerateFretName(guitarString, fret);

                    currentFret.Stroke = _fretStroke;
                    currentFret.Fill = _inactiveFret;

                    FretsGrid.Children.Add(currentFret);

                    currentFret.SetValue(Grid.ColumnProperty, (int) fret);
                    currentFret.SetValue(Grid.RowProperty, (int) guitarString);

                    currentFret.PreviewMouseLeftButtonDown += FretMouseDown;
                    currentFret.PreviewMouseLeftButtonUp += FretMouseUp;
                    currentFret.MouseLeave += FretMouseLeave;

                    currentFret.PreviewMouseRightButtonUp += FretToggled;
                }
            }

            #endregion
        }