diff --git a/UserInterface/Views/AddCommandDialog.axaml.cs b/UserInterface/Views/AddCommandDialog.axaml.cs index e6a615a..a1ed877 100644 --- a/UserInterface/Views/AddCommandDialog.axaml.cs +++ b/UserInterface/Views/AddCommandDialog.axaml.cs @@ -25,7 +25,7 @@ namespace UserInterface.Views this.InitializeComponent(); DataContext = new AddCommandViewModel(); this.comboBox = this.FindControl("ComboBox"); - this.comboBox.Items = Enum.GetValues(typeof(AvailableCommands)).Cast(); + this.comboBox.Items = Enum.GetValues(typeof(AvailableCommands)).Cast().OrderBy(v => v.ToString()); this.comboBox.SelectedIndex = 0; // register IPC clients @@ -53,7 +53,7 @@ namespace UserInterface.Views public void ComboBoxClosed(object sender, SelectionChangedEventArgs args) { var item = ((AddCommandViewModel)this.DataContext); - switch (item.SelectedType) + switch (this.comboBox.SelectedItem) { case AvailableCommands.CustomCommand: item.Description = "This command lets you execute any command you want. It will run in a Windows Command Prompt silently. "; diff --git a/UserInterface/Views/AddSensorDialog.axaml.cs b/UserInterface/Views/AddSensorDialog.axaml.cs index 245d62b..8c12a81 100644 --- a/UserInterface/Views/AddSensorDialog.axaml.cs +++ b/UserInterface/Views/AddSensorDialog.axaml.cs @@ -25,7 +25,7 @@ namespace UserInterface.Views this.InitializeComponent(); DataContext = new AddSensorViewModel(); this.comboBox = this.FindControl("ComboBox"); - this.comboBox.Items = Enum.GetValues(typeof(AvailableSensors)).Cast(); + this.comboBox.Items = Enum.GetValues(typeof(AvailableSensors)).Cast().OrderBy(v => v.ToString()); this.comboBox.SelectedIndex = 0; // register IPC clients @@ -53,7 +53,7 @@ namespace UserInterface.Views public void ComboBoxClosed(object sender, SelectionChangedEventArgs args) { var item = ((AddSensorViewModel)this.DataContext); - switch (item.SelectedType) + switch (this.comboBox.SelectedItem) { case AvailableSensors.UserNotificationStateSensor: item.Description = "This sensor watches the UserNotificationState. This is normally used in applications to determine if it is appropriate to send a notification but we can use it to expose this state. \n ";