[GH-ISSUE #412] Save Changes Dialog Displays without Valid Change #204

Open
opened 2026-02-27 15:49:19 +03:00 by kerem · 5 comments
Owner

Originally created by @yankejustin on GitHub (Nov 7, 2015).
Original GitHub issue: https://github.com/quasar/Quasar/issues/412

Currently, the (Client) Builder Form detects a change to settings and will ask to save changes to apply the current settings from the form to the XML file.
The issue in the title is visible if a user clicks to change an option (such as a checkbox) then reverts the change made (so it was the original option again).
Perhaps we should actually compare the values on the Form to the settings XML file.

Originally created by @yankejustin on GitHub (Nov 7, 2015). Original GitHub issue: https://github.com/quasar/Quasar/issues/412 Currently, the (Client) Builder Form detects a change to settings and will ask to save changes to apply the current settings from the form to the XML file. The issue in the title is visible if a user clicks to change an option (such as a checkbox) then reverts the change made (so it was the original option again). Perhaps we should actually compare the values on the Form to the settings XML file.
Author
Owner

@yankejustin commented on GitHub (Nov 7, 2015):

I'm going to take care of this.

<!-- gh-comment-id:154741360 --> @yankejustin commented on GitHub (Nov 7, 2015): I'm going to take care of this.
Author
Owner

@bitterypaul commented on GitHub (May 14, 2016):

Can i take care of this?

<!-- gh-comment-id:219227728 --> @bitterypaul commented on GitHub (May 14, 2016): Can i take care of this?
Author
Owner

@bitterypaul commented on GitHub (May 14, 2016):

`

    private void FrmBuilder_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (_changed)
        {

            var profile = new BuilderProfile("Default");


            if(!(profile.Tag == txtTag.Text  &&  profile.Hosts == HostHelper.GetRawHosts(_hosts)  &&  profile.Password == txtPassword.Text  &&  profile.Delay == (int)numericUpDownDelay.Value  &&  profile.Mutex == txtMutex.Text  &&  profile.InstallClient == chkInstall.Checked  &&  profile.InstallName == txtInstallname.Text  &&  profile.InstallPath == GetInstallPath()  &&  profile.InstallSub == txtInstallsub.Text  &&  profile.HideFile == chkHide.Checked  &&  profile.AddStartup == chkStartup.Checked  &&  profile.RegistryName == txtRegistryKeyName.Text  &&  profile.ChangeIcon == chkChangeIcon.Checked  &&  profile.IconPath == txtIconPath.Text  &&  profile.ChangeAsmInfo == chkChangeAsmInfo.Checked  &&  profile.Keylogger == chkKeylogger.Checked  &&  profile.LogDirectoryName == txtLogDirectoryName.Text  &&  profile.HideLogDirectory == chkHideLogDirectory.Checked  &&  profile.ProductName == txtProductName.Text  &&  profile.Description == txtDescription.Text  &&  profile.CompanyName == txtCompanyName.Text  &&  profile.Copyright == txtCopyright.Text  &&  profile.Trademarks == txtTrademarks.Text  &&  profile.OriginalFilename == txtOriginalFilename.Text  &&  profile.ProductVersion == txtProductVersion.Text  &&  profile.FileVersion == txtFileVersion.Text))
            {
                if (MessageBox.Show("Do you want to save your current settings?", "Changes detected", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SaveProfile("Default");
                }
            }

        }
    }

`

I ain't proficient in c#, this code might me not optimized or not be according to a proper coding style, but does the trick. Checked in release build. ready to merge.Just wanted to check your acceptance before sending pull request(I don't want to clutter the pull request system with code not compliant to your coding style)

<!-- gh-comment-id:219231528 --> @bitterypaul commented on GitHub (May 14, 2016): ` ``` private void FrmBuilder_FormClosing(object sender, FormClosingEventArgs e) { if (_changed) { var profile = new BuilderProfile("Default"); if(!(profile.Tag == txtTag.Text && profile.Hosts == HostHelper.GetRawHosts(_hosts) && profile.Password == txtPassword.Text && profile.Delay == (int)numericUpDownDelay.Value && profile.Mutex == txtMutex.Text && profile.InstallClient == chkInstall.Checked && profile.InstallName == txtInstallname.Text && profile.InstallPath == GetInstallPath() && profile.InstallSub == txtInstallsub.Text && profile.HideFile == chkHide.Checked && profile.AddStartup == chkStartup.Checked && profile.RegistryName == txtRegistryKeyName.Text && profile.ChangeIcon == chkChangeIcon.Checked && profile.IconPath == txtIconPath.Text && profile.ChangeAsmInfo == chkChangeAsmInfo.Checked && profile.Keylogger == chkKeylogger.Checked && profile.LogDirectoryName == txtLogDirectoryName.Text && profile.HideLogDirectory == chkHideLogDirectory.Checked && profile.ProductName == txtProductName.Text && profile.Description == txtDescription.Text && profile.CompanyName == txtCompanyName.Text && profile.Copyright == txtCopyright.Text && profile.Trademarks == txtTrademarks.Text && profile.OriginalFilename == txtOriginalFilename.Text && profile.ProductVersion == txtProductVersion.Text && profile.FileVersion == txtFileVersion.Text)) { if (MessageBox.Show("Do you want to save your current settings?", "Changes detected", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SaveProfile("Default"); } } } } ``` ` I ain't proficient in c#, this code might me not optimized or not be according to a proper coding style, but does the trick. Checked in release build. ready to merge.Just wanted to check your acceptance before sending pull request(I don't want to clutter the pull request system with code not compliant to your coding style)
Author
Owner

@yankejustin commented on GitHub (May 18, 2016):

Sorry, I no longer have the time for contributions to Quasar these days. You certainly can add this. 😃

<!-- gh-comment-id:219907802 --> @yankejustin commented on GitHub (May 18, 2016): Sorry, I no longer have the time for contributions to Quasar these days. You certainly can add this. :smiley:
Author
Owner

@yankejustin commented on GitHub (May 18, 2016):

The thing about your change is that, yes there is a better way to do it. But the code you showed follows a pretty good code standard and it works 100% of the time. So in my opinion that is perfectly acceptable code and should be added now. 👍
If anyone wants to make a better system for it, then by all means they can optimize it later!

<!-- gh-comment-id:219908113 --> @yankejustin commented on GitHub (May 18, 2016): The thing about your change is that, yes there is a better way to do it. But the code you showed follows a pretty good code standard and it works 100% of the time. So in my opinion that is perfectly acceptable code and should be added now. :+1: If anyone wants to make a better system for it, then by all means they can optimize it later!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Quasar#204
No description provided.