C# Class Te.StahpIt.Views.Settings

Interaction logic for Settings.xaml
Inheritance: BaseView
Exibir arquivo Open project: TechnikEmpire/StahpIt-WPF Class Usage Examples

Public Methods

Method Description
Settings ( SettingsViewModel viewModel, AddCategoryControl addCategoryControl ) : MahApps.Metro.Controls

Constructs a new Settings view with the given view model, and with the provided AddCategoryControl control. The AddCategoryControl instance is not actually displayed within the Settings view at all, but rather the Settings view internally finds its parent window and shows this instance of AddCategoryControl within a flyout. This is part of the reason why the control is supplied. The real reason is that presently, there is not a better solution to the problem where the AddCategoryControl needs to hold a reference to the Engine instance that it is creating categories for. Handing off this instance to this view or view model, then passing it up to an internally created instance of AddCategoryControl seems like a worse solution than this. Doing it this way, the AddCategoryControl instance is kept neatly together with associated objects at the App code behind level. However, XXX TODO, find a more elegant solution to this.

Private Methods

Method Description
OnDeleteCategoryClicked ( object sender, RoutedEventArgs e ) : void

Called when the user clicks the remove category button. The enabled state of this button is data bound to whether or not the list of categories currently has an entry selected. So, in this handler, we get the selected list item and remove it from the list.

OnDigitOnlyTextPasting ( object sender, System.Windows.DataObjectPastingEventArgs e ) : void

For enforcing digit-only input into the blocked payload byte estimation TextBox when the user pastes clipboard content into the box.

OnDigitOnlyTextPreview ( object sender, System e ) : void

For enforcing digit-only input into the blocked payload byte estimation TextBox.

OnDollarValueInputPreview ( object sender, System e ) : void

Previews text changes to an input that is meant to only accept a dollar amount as input. That is, digits and a single decimal, followed by a maximum of two digits.

OnDollarValueTextPasting ( object sender, System.Windows.DataObjectPastingEventArgs e ) : void

Controls pasted values on an input that is meant to only accept a dollar amount as input. That is, digits and a single decimal, followed by a maximum of two digits.

OnFilteringCategoryCreated ( object sender, FilteringCategoryCreatedArgs args ) : void

Handler for when the create category control has received and validated user input for a new filtering category. The purpose of this handler is to decide what to do with the data generated by the control.

OnShowAddCategoryClicked ( object sender, RoutedEventArgs e ) : void

Handler for when the add category button is clicked. In this handler, we search for a specific flyout on the main Window, then set the content of that flyout to our new category control and slide the flyout into user view.

Method Details

Settings() public method

Constructs a new Settings view with the given view model, and with the provided AddCategoryControl control. The AddCategoryControl instance is not actually displayed within the Settings view at all, but rather the Settings view internally finds its parent window and shows this instance of AddCategoryControl within a flyout. This is part of the reason why the control is supplied. The real reason is that presently, there is not a better solution to the problem where the AddCategoryControl needs to hold a reference to the Engine instance that it is creating categories for. Handing off this instance to this view or view model, then passing it up to an internally created instance of AddCategoryControl seems like a worse solution than this. Doing it this way, the AddCategoryControl instance is kept neatly together with associated objects at the App code behind level. However, XXX TODO, find a more elegant solution to this.
/// In the event that either the supplied SettingsViewModel or AddCategoryControl instances /// are null, will throw ArgumentException. ///
public Settings ( SettingsViewModel viewModel, AddCategoryControl addCategoryControl ) : MahApps.Metro.Controls
viewModel Te.StahpIt.ViewModels.SettingsViewModel /// The settings view model. ///
addCategoryControl Te.StahpIt.Controls.AddCategoryControl /// The user control that generates, by user input, new FilteringCategory instances. ///
return MahApps.Metro.Controls