Beispiel #1
0
        //==============================================================
        //Closing the app
        private void Handle_ApplicationExit(object sender, EventArgs args)
        {
            var fretboardStrings = new Note[STRINGS_COUNT];

            for (int i = 0; i < fretboardStrings.Length; i++)
            {
                fretboardStrings[i] = this.fretboard[i];
            }

            var settingsToSave = new SettingsRequestEventArgs
                                 (
                pianorollSemitone: this.pianorollSemitone,
                fretboardSemitone: this.fretboardSemitone,
                circleSemitone: this.circleSemitone,
                fretboardStrings: fretboardStrings,
                lastVisibleString: this.lastVisibleString
                                 );

            Request_SaveSettings?.Invoke(settingsToSave);
        }
        public void Handle_SaveSettingsRequest(SettingsRequestEventArgs args)
        {
            int length      = args.FretboardStrings.Length;
            var packedNotes = new int[length];

            for (int i = 0; i < length; i++)
            {
                packedNotes[i] = (int)args.FretboardStrings[i].Sound;
            }

            var container = new SettingsXmlRepack()
            {
                PianorollSemitone = (int)args.PianorollSemitone,
                FretboardSemitone = (int)args.FretboardSemitone,
                CircleSemitone    = (int)args.CircleSemitone,
                FretboardStrings  = packedNotes,
                LastVisibleString = args.LastVisibleString
            };

            base.InvokeSaveRequest(settingsFileName, container);
        }