private void RemoveAudioClips(object obj)
 {
     foreach (var btn in SelectedSessionClipButtons)
     {
         if (btn.DataContext != BindingOperations.DisconnectedSource)
         {
             btn.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(btn.Background.ToString())));
             var sessionClip = SessionClips.Single(x => x.Label.Equals(btn.Content?.ToString()));
             SessionClips.Remove(sessionClip);
             AudioclipsView.Refresh();
         }
     }
 }
        public void OnAudioClipBtnClick(Button btn)
        {
            if (SelectedBtn != null)
            {
                // Clear selection colours
                SelectedBtn.Foreground = new SolidColorBrush(Colors.Black);
                SelectedBtn.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(SelectedBtn.Background.ToString()));
            }
            AudioClipLabel = btn.Content.ToString();
            if (SelectedAudioClip != null)
            {
                ResetColourButtonBorders();
            }
            SelectedAudioClip  = AudioClipsMgr.GetAudioClipCopy(AudioClipLabel);
            AudioClipText      = SelectedAudioClip.StateText;
            AudioFileName      = Path.GetFileName(SelectedAudioClip.StateAudioFile);
            AudioFileDirectory = Path.GetDirectoryName(SelectedAudioClip.StateAudioFile);
            SelectedCategory   = SelectedAudioClip.Category;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedCategory)));
            ClipVisibility = SelectedAudioClip.IsVisible ? "Visible" : "Hidden";
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ClipVisibility)));
            newAudioClip = false;
            switch (btn.Background.ToString())
            {
            case ColourHelper.StatementColour:
                LightBlueSquare.BorderThickness = new Thickness(2);
                break;

            case ColourHelper.QuestionColour:
                BeigeSquare.BorderThickness = new Thickness(2);
                break;

            case ColourHelper.ActionColour:
                OrangeSquare.BorderThickness = new Thickness(2);
                break;

            case ColourHelper.ConditionColour:
                LightGreenSquare.BorderThickness = new Thickness(2);
                break;
            }
            SelectedBtn            = btn;
            SelectedBtn.Foreground = new SolidColorBrush(Colors.White);
            SelectedBtn.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(SelectedBtn.Background.ToString()));
        }
        public void OnSessionClipBtnClick(Button btn)
        {
            var audioClipLabel = btn.Content?.ToString();

            SelectedAudioClip = AudioClips.Single(x => x.Label.Equals(audioClipLabel));
            if (!SelectedSessionClipButtons.Contains(btn))
            {
                if (SelectedSessionClipButtons.Count == 0 || Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                {
                    btn.Foreground = new SolidColorBrush(Colors.White);
                    btn.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(btn.Background.ToString()));
                    SelectedSessionClipButtons.Add(btn);
                }
                else if (SelectedSessionClipButtons.Count > 0)
                {
                    foreach (var button in SelectedSessionClipButtons)
                    {
                        button.Foreground = new SolidColorBrush(Colors.Black);
                        button.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(button.Background.ToString()));
                    }
                    SelectedSessionClipButtons.Clear();
                    btn.Foreground = new SolidColorBrush(Colors.White);
                    btn.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(btn.Background.ToString()));
                    SelectedSessionClipButtons.Add(btn);
                }
            }
            else if (!(SelectedSessionClipButtons.Contains(btn) && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))))
            {
                foreach (var button in SelectedSessionClipButtons)
                {
                    button.Foreground = new SolidColorBrush(Colors.White);
                    button.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(btn.Background.ToString()));
                }
                SelectedSessionClipButtons.Clear();
            }
        }