Skip to content

Conversation

@davejupp
Copy link

Updates to menu items
Adds Shortcut and hotkeys to almost all the menu items
Updates "open file" to show the open file in the title menu
Monitors configuration for changes (not the assist levels yet)
Adds a prompt to save changes (or not, or cancel) if you try to exit with a modified config
Config modification is shown in the title bar
Fixes a small issue closing files (That would have likely been impossible to trigger without a hotkey)

Adds Shortcut and hotkeys to almost all the menu items
Updates "open file" to show the open file in the title menu
Monitors configuration for changes (not the assist levels yet)
Adds a prompt to save changes (or not, or cancel) if you try to exit with a modified config
Config modification is shown in the title bar
Fixes a small issue closing files (That would have likely been impossible to trigger without a hotkey)
@davejupp
Copy link
Author

Accidentally deleted this PR while I was doing some tidying up. Reopened now with config modifications detected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why I needed to add this (or in fact where this file came from, it seems to have autogenerated it?) but the App will not start without it for me.

{
var serializer = new XmlSerializer(typeof(Configuration));
var settings = new XmlWriterSettings { Encoding = Encoding.UTF8, Indent = true };
using (var xmlWriter = XmlWriter.Create(new StreamWriter(filepath), settings))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment. This definitely looks like it should work, but with the hotkeys you can cause an exception by just saving the config repeatedly very quickly. I suspect some part of the close() is asynchronous but I'm not too familiar with C# streaming.

/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Window_Closing(object sender, CancelEventArgs e)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to intercept closing if we want to save the name of the currently open file. I could have just saved this upon load (and this is a bit more complicated a solution than doing that) so if that would be preferred I could change it, but I think this is a pretty reasonable solution. Note also that we can't cancel Application.shutDown() as it's just not supported. But window.close() is.

CalibrationVm = new CalibrationViewModel(ConnectionVm);
EventLogVm = new EventLogViewModel();


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Load the file that was loaded last time we closed the app. This is just for convenience. I could make this a preference or something but if you didn't want to open this file you'd just need to open another one anyhow so there's no real downside IMO.


/// <summary>
/// Start monitoring the ConfigurationViewModel for changes so we can mark it as modified when the user changes something in the UI.
/// </summary>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monitoring the configuration for changes: we subscribe to the propertyChanged event, compare the old config to the new, and if they don't match we mark the config dirty/modified. Modified value names are stored in a map so we can re-validate the config if they change back.

{
try
{
StopConfigMonitoring();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to trigger property change events constantly while loading/resetting/etc

}
}
}
private void OnOpenConfigDirect()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opens the config without a dialog for when we are loading the previously loaded file on start up

get { return new DelegateCommand(OnShowAbout); }
}

public ICommand UseMetricUnitsCommand
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both these methods needed to be added purely for hotkeys (you can't seem to bind to a get/set for hotkeys the same way you can for the menu items)

@NineHorseTop
Copy link

Dave do you have an updated config tool app with your updates??

@davejupp
Copy link
Author

davejupp commented Jun 3, 2025

Dave do you have an updated config tool app with your updates??

I've built a release version here: https://github.com/davejupp/bbs-fw/releases

edit: that build appears to have a bug where it doesn't notice you opened a file. I'll update it today sometime.

further edit: v1.5 and v1.5.99 versions are available at the link above, just unzip the zip file and run as usual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants