/// Copyright (c) 2021 Iiro Iivanainen, Harri Linna, Jere Pakkanen, Riikka Vilavaara /// /// Permission is hereby granted, free of charge, to any person obtaining /// a copy of this software and associated documentation files (the /// "Software"), to deal in the Software without restriction, including /// without limitation the rights to use, copy, modify, merge, publish, /// distribute, sublicense, and/or sell copies of the Software, and to /// permit persons to whom the Software is furnished to do so, subject to /// the following conditions: /// /// The above copyright notice and this permission notice shall be included /// in all copies or substantial portions of the Software. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, /// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF /// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. /// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY /// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, /// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE /// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /// using System.Windows; using System.Windows.Media; namespace GroundhogApp.Dialogs { /// /// Interaction logic for ConfigurationDialog.xaml /// public partial class ConfigurationDialog : Window { public string UserName { get; set; } public Color ZColor { get; set; } public Color XColor { get; set; } public Color YColor { get; set; } public Color DataOnMapColor { get; set; } public Color DataHighlightColor { get; set; } public ConfigurationDialog() { InitializeComponent(); ResetUserName(); ResetAxisColor(); } public ConfigurationDialog(string userName, Color ZColor, Color XColor, Color YColor, Color DataOnMap, Color DataHighlight) { InitializeComponent(); UserNameTextBox.Text = userName; ZColorPicker.SelectedColor = ZColor; XColorPicker.SelectedColor = XColor; YColorPicker.SelectedColor = YColor; DataOnMapColorPicker.SelectedColor = DataOnMap; DataHighlightColorPicker.SelectedColor = DataHighlight; } /// /// Click hander for resetting the username. /// /// /// private void ResetUserName_Click(object sender, RoutedEventArgs e) { ResetUserName(); } /// /// Resets username to default. /// private void ResetUserName() { UserNameTextBox.Text = Utilities.GetEnvironmentUser(); } /// /// Click handler for resetting axis colors. /// /// /// private void ResetAxisColor_Click(object sender, RoutedEventArgs e) { ResetAxisColor(); } /// /// Reset axis colors to default values. /// private void ResetAxisColor() { ZColorPicker.SelectedColor = Colors.Green; XColorPicker.SelectedColor = Colors.Red; YColorPicker.SelectedColor = Colors.Blue; } /// /// Close the dialog. /// /// /// private void CancelButton_Click(object sender, RoutedEventArgs e) { DialogResult = false; } /// /// Close the dialog and set the return values. /// /// /// private void SaveButton_Click(object sender, RoutedEventArgs e) { UserName = UserNameTextBox.Text; ZColor = (Color)ZColorPicker.SelectedColor; XColor = (Color)XColorPicker.SelectedColor; YColor = (Color)YColorPicker.SelectedColor; DataOnMapColor = (Color)DataOnMapColorPicker.SelectedColor; DataHighlightColor = (Color)DataHighlightColorPicker.SelectedColor; DialogResult = true; } /// /// Click handler for resetting data colors.. /// /// /// private void ResetDataColor_Click(object sender, RoutedEventArgs e) { ResetDataColor(); } /// /// Resets data colors displayed on the map to default values. /// private void ResetDataColor() { DataOnMapColorPicker.SelectedColor = Colors.Red; DataHighlightColorPicker.SelectedColor = Colors.Orange; } } }