Exemplo n.º 1
0
            public void Execute(object parameter)
            {
                CBItem Param  = (CBItem)parameter;
                string AcType = Param.Content;
                bool   Open   = Param.IsChecked;

                if (Open)
                {
                    bool IsIn = false;
                    foreach (TypeTabViewModel tvm in _tabs)
                    {
                        if (tvm.Header == AcType)
                        {
                            IsIn = true;
                        }
                    }
                    if (!IsIn)
                    {
                        TypeTabViewModel tvm = new TypeTabViewModel();
                        tvm.Header = AcType;
                        _tabs.Add(tvm);
                    }
                }
                else //(close)
                {
                    foreach (TypeTabViewModel tvm in _tabs)
                    {
                        if (tvm.Header == AcType)
                        {
                            _tabs.Remove(tvm);
                            break;
                        }
                    }
                }
            }
Exemplo n.º 2
0
        private void LoadInitialData()
        {
            using (OvergaveContext _db = new OvergaveContext())
            {
                _aircraftList = (from a in _db.Aircraft
                                 select a).ToList();

                var alist = from at in _db.Ata
                            select at;
                _ataList = new List <MVAta>();
                foreach (var item in alist)
                {
                    MVAta mva = new MVAta();
                    mva.ATA            = item.Ata;
                    mva.AtaDescription = mva.ATA.ToString() + " -" + item.AtaText;
                    _ataList.Add(mva);
                }

                _subAtaList = (from sa in _db.SubAta
                               select sa).ToList();

                List <string> tabs = (from b in _db.DefaultUserTypes
                                      where b.Klmid == App.Current.Properties["CurrentUserName"]
                                      select b.Actype.Trim()).ToList();

                List <string> types = (from t in _db.Actypes
                                       select t.Actypes.Trim()).ToList();

                foreach (var t in types)
                {
                    CBItem cb = new CBItem();

                    cb.Content = t;
                    if (tabs.Contains(t))
                    {
                        cb.IsChecked = true;
                        TypeTabViewModel tvm = new TypeTabViewModel();
                        tvm.Header = t;
                        _tabs.Add(tvm);
                        tvm.IsSelected = true;
                    }
                    else
                    {
                        cb.IsChecked = false;
                    }
                    _cbItems.Add(cb);
                }
            }
        }