private void SetAsDefaultToggleButton_Loaded(object sender, RoutedEventArgs e)
        {
            ToggleButton  checkbox = (ToggleButton)sender;
            GroupListItem group    = (GroupListItem)checkbox.DataContext;

            if (group != null)
            {
                checkbox.IsChecked = group.SetAsDefault;
            }
        }
 private void InteractiveSceneUserGroupsDialogControl_Loaded(object sender, RoutedEventArgs e)
 {
     this.InteractiveGroupsListView.ItemsSource = this.UserGroups;
     foreach (InteractiveUserGroupViewModel userGroup in ChannelSession.Settings.InteractiveUserGroups[this.game.id])
     {
         GroupListItem group = new GroupListItem(userGroup);
         group.MatchesCurrentScene = userGroup.DefaultScene.Equals(this.scene.sceneID);
         this.UserGroups.Add(group);
     }
 }
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            Button        button = (Button)sender;
            GroupListItem group  = (GroupListItem)button.DataContext;

            if (group != null)
            {
                this.UserGroups.Remove(group);
                ChannelSession.Settings.InteractiveUserGroups[this.game.id].Remove(group.Group);
            }
        }
        private void AddGroupButton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(this.GroupNameTextBox.Text))
            {
                if (this.UserGroups.Count(ug => this.GroupNameTextBox.Text.Equals(ug.GroupName)) > 0)
                {
                    return;
                }

                GroupListItem group = new GroupListItem(new InteractiveUserGroupViewModel(this.GroupNameTextBox.Text), this.scene);

                this.UserGroups.Add(group);
                ChannelSession.Settings.InteractiveUserGroups[this.game.id].Add(group.Group);

                this.GroupNameTextBox.Clear();
            }
        }
        private void SetAsDefaultToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            ToggleButton  checkbox = (ToggleButton)sender;
            GroupListItem group    = (GroupListItem)checkbox.DataContext;

            if (group != null)
            {
                if (checkbox.IsChecked.GetValueOrDefault())
                {
                    group.DefaultScene = this.scene.sceneID;
                    group.SetAsDefault = true;
                }
                else
                {
                    group.DefaultScene = InteractiveUserGroupViewModel.DefaultName;
                    group.SetAsDefault = false;
                }
                group.NotifyProperties();
            }
        }
        private void SetDefaultForGroupCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox      checkbox = (CheckBox)sender;
            GroupListItem group    = (GroupListItem)checkbox.DataContext;

            if (group != null)
            {
                if (checkbox.IsChecked.GetValueOrDefault())
                {
                    group.DefaultScene        = this.scene.sceneID;
                    group.MatchesCurrentScene = true;
                    if (this.scene.sceneID.Equals(InteractiveUserGroupViewModel.DefaultName))
                    {
                        checkbox.IsEnabled = false;
                    }
                }
                else
                {
                    group.DefaultScene        = InteractiveUserGroupViewModel.DefaultName;
                    group.MatchesCurrentScene = false;
                }
            }
        }