private void GetCurrVariable(LatkaType latkaType, out BindableCollection<Vysetrovane_latky> bindableCollection)
 {
     switch (latkaType)
     {
         case LatkaType.Metabolites:
             bindableCollection = Metabolity ;
             break;
         case LatkaType.Enzimy:
             bindableCollection =Enzimy ;
             break;
         case LatkaType.Lipidy:
             bindableCollection = Lipidy;
             break;
         case LatkaType.Mineraly:
             bindableCollection = Mineraly;
             break;
         case LatkaType.Bielkoviny:
             bindableCollection = Bielkoviny;
             break;
         case LatkaType.Imunologia:
             bindableCollection = Imunologia;
             break;
         case LatkaType.Markery:
             bindableCollection = Markery;
             break;
         case LatkaType.KrvnyObraz:
             bindableCollection = KrvnyObraz;
             break;
         case LatkaType.Parametre:
             bindableCollection =Parametre;
             break;
         case LatkaType.Hormony:
             bindableCollection = Hormony;
             break;
         case LatkaType.Ostatne:
             bindableCollection = Ostatne;
             break;
         default:
             bindableCollection = new BindableCollection<Vysetrovane_latky>();
             break;
     }
 }
        private void AddVysetrovaneLatky(LatkaType latkaType)
        {
            BindableCollection<Vysetrovane_latky> bindableCollection;
            GetCurrVariable(latkaType,out bindableCollection);
            foreach (var item in bindableCollection)
            {
                VysetrLatky.Add(item);
            }

            RaisePropertyChangedEventImmediately("VysetrLatky");
        }
        private void InitializeVariable(EntitySet<Vysetrovane_latky> entitySet, LatkaType latkaType)
        {
            BindableCollection<Vysetrovane_latky> bindableCollection;
            GetCurrVariable(latkaType, out bindableCollection);

            bindableCollection.Clear();
            foreach (var item in entitySet)
            {
                bindableCollection.Add(item);
            }
        }
        private void CheckedChangedHandler(ref bool wasAdded, LatkaType latkaType, EntityQuery<Vysetrovane_latky> query)
        {
            BindableCollection<Vysetrovane_latky> bindableCollection;
            GetCurrVariable(latkaType, out bindableCollection);
            Coroutine.BeginExecuteFor(Show.NotBusy(), this);
            if (wasAdded == true)
            {
                RemoveVysetrovaneLatky(latkaType);
                wasAdded = false;
                Coroutine.BeginExecuteFor(Show.NotBusy(), this);
            }
            else
            {
                if (bindableCollection.Count == 0)
                {
                    LatkaType latkaType2 = latkaType;
                    _laboratoryDomainContext.Vysetrovane_latkies.Clear();
                    _laboratoryDomainContext.Load(query).Completed += (sender, e) =>
                    {
                        InitializeVariable(_laboratoryDomainContext.Vysetrovane_latkies, latkaType2) ;
                        AddVysetrovaneLatky(latkaType2);
                        Coroutine.BeginExecuteFor(Show.NotBusy(), this);
                    };
                }
                else
                {
                    AddVysetrovaneLatky(latkaType);
                    Coroutine.BeginExecuteFor(Show.NotBusy(), this);
                }
                wasAdded = true;

            }
        }