
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Windows.Media.Imaging;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Extensions;
using BeWo.View.Detail;
using BeWo.View.Navigation.Sorter;
using BS.Shared.DataContracts.Compact;
using BeWo.ServiceProxy;
using BeWo.ViewModel;

namespace BeWo.View.Search
{
    public class SupportConceptGroupSearchView : GenericSearchView<CompactGroupOfPeopleDC>
    {
        
        private Button mButton;

        public event EventHandler EditGroupButtonClicked;

        public SupportConceptGroupSearchView()
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
                ThemeColor = FindResource("SupportConceptContentBrush") as Brush;
            CreateButton();
        }

        protected void CreateButton()
        {
            if (BeWoApp.LoggedOnUser != null && this.mButton == null)
            {
                mButton = new Button();
                mButton.Margin = new Thickness(3, 3, 3, 3);
                mButton.HorizontalAlignment = HorizontalAlignment.Left;

                StackPanel sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;
                
                Image img = new Image();
                img.Source = new BitmapImage(new Uri("pack://application:,,,/BeWoPlaner;component/Ressources/Icons/UserGroupHome24bw.png"));

                sp.Children.Add(img);
                TextBlock tb = new TextBlock();
                tb.Margin = new Thickness(3,4,3,0);
                tb.Text = "Gruppen bearbeiten";
                sp.Children.Add(tb);

                mButton.Content = sp;
                mButton.ToolTip = "Gruppen bearbeiten";
                mButton.Click += mButton_Click;

                this.AddCustomContentHeaderElement(mButton);
            }
        }

        void mButton_Click(object sender, RoutedEventArgs e)
        {
            if (EditGroupButtonClicked != null)
                EditGroupButtonClicked(sender, e);
        }

        public List<CompactGroupOfPeopleDC> GroupOfPeoples
        {
            get
            {
                return _ObjectList;
            }
            set
            {
                base.UpdateObjectList(value);
            }

        }

        protected override void GetAll(Action<List<CompactGroupOfPeopleDC>> pCallBack)
        {

            
        }

    }
}

