Пример #1
0
        public bool Configure(IntPtr panelHandle)
        {
            if (panelHandle == IntPtr.Zero)
            {
                return(false);
            }
            var configPanel = (Panel)Control.FromHandle(panelHandle);
            var btnSettings = new Button
            {
                Location = new Point(0, 0),
                Size     = new Size(150, 30),
                Text     = @"Settings"
            };

            btnSettings.Click += (sender, args) =>
            {
                var settingsForm = new FrmSettings(_settings);
                settingsForm.ShowDialog();
                SaveSettings(_settings);
                _frmLyrics?.UpdateFromSettings(_settings);
                LyricParser.PreserveSlash = _settings.PreserveSlash;
            };
            configPanel.Controls.Add(btnSettings);

            return(false);
        }
Пример #2
0
        public bool Configure(IntPtr panelHandle)
        {
            if (panelHandle == IntPtr.Zero)
            {
                return(false);
            }
            var configPanel = (Panel)Control.FromHandle(panelHandle);
            var btnSettings = new Button
            {
                Location = new Point(0, 0),
                Size     = new Size(150, 30),
                Text     = @"Settings"
            };

            btnSettings.Click += (sender, args) =>
            {
                var settingsForm = new FrmSettings(SettingsPath);
                settingsForm.ShowDialog();
                _settings = settingsForm.Settings;
                File.WriteAllText(SettingsPath, JsonConvert.SerializeObject(_settings));
                _frmLyrics?.UpdateFromSettings(_settings);
            };
            configPanel.Controls.Add(btnSettings);

            return(false);
        }