public Favorites()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);


            try{
                listfav.ItemSelected += (sender, e) =>
                {
                    Policies di = new Policies();
                    di = (Policies)e.SelectedItem;

                    string docName    = di.DocName;         //di.DocumentItemTitle;
                    bool   isFavorite = di.IsFavourite;     // di.IsFavorite;
                    di = null;

                    ViewDocument dd       = new ViewDocument(docName, isFavorite);
                    Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                    lblTitle.Text = "Policies And Procedures";

                    Navigation.PushAsync(dd);
                    dd = null;
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            searchref.Clicked += (object sender, EventArgs e) =>
            {
                Navigation.PushAsync(new DocumentTypes("favorite"));
            };
        }
        public SearchtemListByCatPage(List <Policies> docsofflinedata, string _item)
        {
            InitializeComponent();
            docs       = docsofflinedata;
            searchitem = _item;
            var item = new ToolbarItem
            {
                Icon = "topsearch.png"
            };

            ToolbarItems.Add(item);
            lstDDT.ItemsSource   = docs;
            this.Title           = "search item for " + _item;
            lstDDT.ItemSelected += (sender, e) =>
            {
                Policies di = new Policies();
                di = (Policies)e.SelectedItem;

                string docName    = di.DocName;     //di.DocumentItemTitle;
                bool   isFavorite = di.IsFavourite; // di.IsFavorite;
                di = null;

                ViewDocument dd       = new ViewDocument(docName, isFavorite);
                Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                lblTitle.Text = "Policies And Procedures";

                Navigation.PushAsync(dd);
                dd = null;
            };
            item.Clicked += (object sender, EventArgs e) =>
            {
                //StacksearchRef.IsVisible = true;
                Navigation.PushAsync(new SearchByCategoryPage());
            };
        }
Exemple #3
0
        private void lstDDT_ItemTapped_1(object sender, ItemTappedEventArgs e)
        {
            //DocumentItem di = new DocumentItem();
            try{
                Policies di = new Policies();
                di = (Policies)e.Item;

                string docName = di.DocName;                //di.DocumentItemTitle;
                if (_favstate)
                {
                    isFavorite = true;
                }
                else
                {
                    isFavorite = di.IsFavourite;                    // di.IsFavorite;
                }

                di = null;

                ViewDocument dd       = new ViewDocument(docName, isFavorite);
                Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                lblTitle.Text = "Policies And Procedures";

                Navigation.PushAsync(dd);
                dd = null;
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
Exemple #4
0
        private void LstDD_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            DocumentItem di = new DocumentItem();

            di = (DocumentItem)e.Item;

            string docName    = di.DocumentItemTitle;
            bool   isFavorite = di.IsFavorite;

            di = null;

            ViewDocument dd       = new ViewDocument(docName, isFavorite);
            Label        lblTitle = dd.FindByName <Label>("lblVDTitle");

            lblTitle.Text = "Policies And Procedures";

            Navigation.PushAsync(dd);
            dd = null;
        }
Exemple #5
0
        private void LstDDT_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                DocumentItem di = new DocumentItem();
                di = (DocumentItem)e.Item;

                string docName = di.DocumentItemTitle;
                isFavorite = di.IsFavorite;
                di         = null;

                ViewDocument dd       = new ViewDocument(docName, isFavorite);
                Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                lblTitle.Text = "Policies And Procedures";

                Navigation.PushAsync(dd);
                dd = null;
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
Exemple #6
0
        public SearchItemsListPage(List <Policies> docsofflinedata, string _item)
        {
            InitializeComponent();
            var navigationPage = Application.Current.MainPage as NavigationPage;

            navigationPage.BarBackgroundColor = Color.FromHex("#43AEE7");
            //docIdRef.Clicked += (sender, e) =>
            //{
            //	lstDDT.ItemsSource = docsofflinedata.OrderByDescending(x => x.DocId).ToList();
            //	sortOrderRef.IsVisible = false;
            //};
            //docTypeRef.Clicked += (sender, e) =>
            //{
            //	lstDDT.ItemsSource = docsofflinedata.OrderByDescending(x => x.DocType).ToList();
            //	sortOrderRef.IsVisible = false;
            //};

            //docSubTypeRef.Clicked += (sender, e) =>
            //{
            //	lstDDT.ItemsSource = docsofflinedata.OrderByDescending(x => x.DocSubType).ToList();
            //	sortOrderRef.IsVisible = false;
            //};

            docNameAscenRef.Clicked += (sender, e) =>
            {
                lstDDT.ItemsSource         = docsofflinedata.OrderBy(x => x.DocName).ToList();
                sortOrderRef.IsVisible     = false;
                headref.IsVisible          = true;
                headref.Text               = " Doc Name Ascending Order";
                docNameAscenRef.Image      = "DocNameAscendingActive.png";
                modifiedDateAscenRef.Image = "LastModifiedAscendingInactive.png";
                modifiedByAscenRef.Image   = "SMEAscendingInactive.png";
                docNameDscenRef.Image      = "DocNameDescendingInactive.png";
                modifiedDateDscenRef.Image = "LastModifiedDescendingInactive.png";
                modifiedByDscenRef.Image   = "SMEDescendingInactive.png";
            };
            docNameDscenRef.Clicked += (sender, e) =>
            {
                lstDDT.ItemsSource         = docsofflinedata.OrderByDescending(x => x.DocName).ToList();
                sortOrderRef.IsVisible     = false;
                headref.IsVisible          = true;
                headref.Text               = " DocName Descending Order";
                docNameAscenRef.Image      = "DocNameAscendingInactive.png";
                modifiedDateAscenRef.Image = "LastModifiedAscendingInactive.png";
                modifiedByAscenRef.Image   = "SMEAscendingInactive.png";
                docNameDscenRef.Image      = "DocNameDescendingActive.png";
                modifiedDateDscenRef.Image = "LastModifiedDescendingInactive.png";
                modifiedByDscenRef.Image   = "SMEDescendingInactive.png";
            };

            modifiedDateAscenRef.Clicked += (sender, e) =>
            {
                lstDDT.ItemsSource         = docsofflinedata.OrderBy(x => x.ModifiedDate).ToList();
                sortOrderRef.IsVisible     = false;
                headref.IsVisible          = true;
                headref.Text               = " Modified Date in Ascending Order";
                docNameAscenRef.Image      = "DocNameAscendingInactive.png";
                modifiedDateAscenRef.Image = "LastModifiedAscendingActive.png";
                modifiedByAscenRef.Image   = "SMEAscendingInactive.png";
                docNameDscenRef.Image      = "DocNameDescendingInactive.png";
                modifiedDateDscenRef.Image = "LastModifiedDescendingInactive.png";
                modifiedByDscenRef.Image   = "SMEDescendingInactive.png";
            };

            modifiedDateDscenRef.Clicked += (sender, e) =>
            {
                lstDDT.ItemsSource     = docsofflinedata.OrderByDescending(x => x.ModifiedDate).ToList();
                sortOrderRef.IsVisible = false;
                headref.IsVisible      = true;
                headref.Text           = "Modified By Name in Descending Order";

                docNameAscenRef.Image      = "DocNameAscendingInactive.png";
                modifiedDateAscenRef.Image = "LastModifiedAscendingInactive.png";
                modifiedByAscenRef.Image   = "SMEAscendingInactive.png";
                docNameDscenRef.Image      = "DocNameDescendingInactive.png";
                modifiedDateDscenRef.Image = "LastModifiedDescendingActive.png";
                modifiedByDscenRef.Image   = "SMEDescendingInactive.png";
            };

            modifiedByAscenRef.Clicked += (sender, e) =>
            {
                lstDDT.ItemsSource     = docsofflinedata.OrderBy(x => x.ModifiedBy).ToList();
                sortOrderRef.IsVisible = false;
                headref.IsVisible      = true;
                headref.Text           = "SME Name in Ascending Order";

                docNameAscenRef.Image      = "DocNameAscendingInactive.png";
                modifiedDateAscenRef.Image = "LastModifiedAscendingInactive.png";
                modifiedByAscenRef.Image   = "SMEAscendingActive.png";
                docNameDscenRef.Image      = "DocNameDescendingInactive.png";
                modifiedDateDscenRef.Image = "LastModifiedDescendingInactive.png";
                modifiedByDscenRef.Image   = "SMEDescendingInactive.png";
            };


            modifiedByDscenRef.Clicked += (sender, e) =>
            {
                lstDDT.ItemsSource     = docsofflinedata.OrderByDescending(x => x.ModifiedBy).ToList();
                sortOrderRef.IsVisible = false;
                headref.IsVisible      = true;
                headref.Text           = "SME Name in Descending Order";

                docNameAscenRef.Image      = "DocNameAscendingInactive.png";
                modifiedDateAscenRef.Image = "LastModifiedAscendingInactive.png";
                modifiedByAscenRef.Image   = "SMEAscendingInactive.png";
                docNameDscenRef.Image      = "DocNameDescendingInactive.png";
                modifiedDateDscenRef.Image = "LastModifiedDescendingInactive.png";
                modifiedByDscenRef.Image   = "SMEDescendingActive.png";
            };
            //isFavouriteRef.Clicked += (sender, e) =>
            //{
            //	lstDDT.ItemsSource = docsofflinedata.OrderByDescending(x => x.IsFavourite).ToList();
            //	sortOrderRef.IsVisible = false;
            //};

            //docSubTypeIdRef.Clicked += (sender, e) =>
            //{
            //	lstDDT.ItemsSource = docsofflinedata.OrderByDescending(x => x.DocSubTypeID).ToList();
            //	sortOrderRef.IsVisible = false;
            //};

            docs               = docsofflinedata;
            searchitem         = _item;
            lstDDT.ItemsSource = docs;
            this.Title         = "search item for " + _item;
            var _sortitem = new ToolbarItem
            {
                //Icon = "search_gray.png"
                Text = "Sort"
            };

            //.ToolbarItems.Add(item);

            ToolbarItems.Add(_sortitem);
            lstDDT.ItemSelected += (sender, e) =>
            {
                try{
                    Policies di = new Policies();
                    di = (Policies)e.SelectedItem;

                    string docName    = di.DocName;                 //di.DocumentItemTitle;
                    bool   isFavorite = di.IsFavourite;             // di.IsFavorite;
                    di = null;

                    ViewDocument dd       = new ViewDocument(docName, isFavorite);
                    Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                    lblTitle.Text = "Policies And Procedures";

                    Navigation.PushAsync(dd);
                    dd = null;
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            };
            _sortitem.Clicked += (object sender, EventArgs e) =>
            {
                try{
                    //if (value1 == false)
                    //{
                    // lstDDT.ItemsSource = docsofflinedata.OrderByDescending(x => x.DocName).ToList();
                    // value1 = true;
                    //}
                    //else
                    //{
                    // lstDDT.ItemsSource = docsofflinedata.OrderBy(x => x.DocName).ToList();
                    // value1 = false;
                    //}
                    if (sortOrderRef.IsVisible)
                    {
                        sortOrderRef.IsVisible = false;
                    }
                    else
                    {
                        sortOrderRef.IsVisible = true;
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            };
            searchRef.Clicked += (object sender, EventArgs e) =>
            {
                //Navigation.PushAsync(new DocumentsSearchReturnPage());
                Navigation.PushAsync(new DocumentTypes("favorite"));
            };
            homebtnRef.Clicked += (object sender, EventArgs e) =>
            {
                Navigation.PushAsync(new DocumentTypes(""));
            };
            favoriteBtnRef.Clicked += (object sender, EventArgs e) =>
            {
                try{
                    Favorites fs = new Favorites();
                    Navigation.PushAsync(fs);
                    fs = null;
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            };

            //       var _norefgesture = new TapGestureRecognizer();

            //       _norefgesture.Tapped+=async (sender, e) =>
            //         {
            // imgFavouriteT.Source = "fav-unselected.png";
            //     //if exists delete file and update in sqlite
            //     App.PoliciesRepo.UpdateFavorites(selectedDocName, "0");

            //     var check = await FileSystem.Current.LocalStorage.CheckExistsAsync(selectedDocName);
            //     if (ExistenceCheckResult.FileExists == check)
            //     {
            //         IFile file = await FileSystem.Current.LocalStorage.GetFileAsync(selectedDocName);
            //         await file.DeleteAsync();
            //     }
            //};
            //nobtnRef.GestureRecognizers.Add(_norefgesture);
        }
        //public bool CallWebService()
        //{
        //	// Do you webservice call here //
        //	Device.BeginInvokeOnMainThread(() =>
        //	{
        //		StackLoadingRef.IsVisible = false;
        //	});
        //	return false;
        //}
        public DocumentTypes(string isComingFrom)
        {
            InitializeComponent();
            //Device.BeginInvokeOnMainThread(() =>
            //{
            //	StackLoadingRef.IsVisible = true;
            //});
            //Device.StartTimer(new TimeSpan(0, 0, 10), CallWebService); //20 seconds



            string returnOS = DependencyService.Get <DependencyServices.INetworkDependency>().IsNetworkAvailable();

            NavigationPage.SetHasNavigationBar(this, false);

            if (isComingFrom == "favorite")
            {
                homeimage.Source   = "Home_gray.png";
                imgFavorite.Source = "fav_gray.png";
                searchRef.Image    = "search_activate.png";

                docsofflinedata             = App.PoliciesRepo.GetAllPolicies();
                listViewDocsRef.ItemsSource = docsofflinedata;
                StacksearchRef.IsVisible    = true;
            }
            else
            {
                StacksearchRef.IsVisible = false;
            }

            searchBarRef.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                try{
                    if (searchBarRef.Text.Length > 0)
                    {
                        listViewDocsRef.ItemsSource = docsofflinedata.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                        listViewDocsRef.IsVisible   = true;
                        cancelbtnRef.IsVisible      = true;
                        searchitem = searchBarRef.Text;
                    }
                    if (searchBarRef.Text.Length == 0)
                    {
                        listViewDocsRef.ItemsSource = null;
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };

            searchBarRef.SearchButtonPressed += (sender, e) =>
            {
                try
                {
                    docsBySearchItem = docsofflinedata.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                    Navigation.PushAsync(new SearchItemsListPage(docsBySearchItem, searchitem));
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };

            cancelbtnRef.Clicked += (object sender, EventArgs e) =>
            {
                try
                {
                    StacksearchRef.IsVisible  = false;
                    listViewDocsRef.IsVisible = false;
                    cancelbtnRef.IsVisible    = false;
                    if (searchBarRef.Text.Length > 0)
                    {
                        searchBarRef.Text = "";
                    }
                }

                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            // searchBarRef.Placeholder = "";
            searchRef.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("CEHSP");
                try{
                    homeimage.Source   = "Home_gray.png";
                    imgFavorite.Source = "fav_gray.png";
                    searchRef.Image    = "search_activate.png";

                    docsofflinedata             = App.PoliciesRepo.GetAllPolicies();
                    listViewDocsRef.ItemsSource = docsofflinedata;
                    StacksearchRef.IsVisible    = true;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };

            btnCEHSP.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("CEHSP");
                try{
                    NavigateByTabDocType("CEHSP");
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine(ex.Message);
                    logger.Error(ex.Message);
                }
            };

            btnCEHSI.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("GEHSI");
                try{
                    NavigateByTabDocType("GEHSI");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnManual.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("Manual");
                try{
                    NavigateByTabDocType("Manual");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnGuidance.Clicked += (object sender, EventArgs e) =>
            {
                try{
                    NavigateByTabDocType("EH&S Guidance");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnEnvSpec.Clicked += (object sender, EventArgs e) =>
            {
                try{
                    NavigateByTabDocType("ES");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnRuleBook.Clicked += (object sender, EventArgs e) =>
            {
                try{
                    NavigateByTabDocType("Rule Book");
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine(ex.Message);
                    logger.Error(ex.Message);
                }
            };

            btnCEHSPLand.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("CEHSP");
                try
                {
                    NavigateByTabDocType("CEHSP");
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine(ex.Message);
                    logger.Error(ex.Message);
                }
            };

            btnCEHSILand.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("GEHSI");
                try
                {
                    NavigateByTabDocType("GEHSI");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnManualLand.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("Manual");
                try
                {
                    NavigateByTabDocType("Manual");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnGuidanceLand.Clicked += (object sender, EventArgs e) =>
            {
                try
                {
                    NavigateByTabDocType("EH&S Guidance");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnEnvSpecLand.Clicked += (object sender, EventArgs e) =>
            {
                try
                {
                    NavigateByTabDocType("ES");
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            };
            btnRuleBookLand.Clicked += (object sender, EventArgs e) =>
            {
                try
                {
                    NavigateByTabDocType("Rule Book");
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine(ex.Message);
                    logger.Error(ex.Message);
                }
            };

            listViewDocsRef.ItemSelected += (sender, e) =>
            {
                // activityIndicatorLayout.IsVisible = true;
                try{
                    Policies di = new Policies();
                    di = (Policies)e.SelectedItem;

                    string docName    = di.DocName;                 //di.DocumentItemTitle;
                    bool   isFavorite = di.IsFavourite;             // di.IsFavorite;
                    di = null;

                    ViewDocument dd       = new ViewDocument(docName, isFavorite);
                    Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                    lblTitle.Text = "Policies And Procedures";

                    Navigation.PushAsync(dd);
                    dd = null;
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine(ex.Message);
                    logger.Error(ex.Message);
                }

                //activityIndicatorLayout.IsVisible = false;
            };

            var tabclosegesture = new TapGestureRecognizer();

            tabclosegesture.Tapped += (object sender, EventArgs e) =>
            {
                try{
                    StacksearchRef.IsVisible = false;
                    searchRef.Image          = "search_gray.png";
                    homeimage.Source         = "Home_activate.png";
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine(ex.Message);
                    logger.Error(ex.Message);
                }
            };
            StacksearchRef.GestureRecognizers.Add(tabclosegesture);
            tabclosegesture.NumberOfTapsRequired = 1;
        }
        public DocumentsSearchReturnPage()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            searchBarRef.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                if (searchBarRef.Text.Length > 0)
                {
                    listViewDocsRef.ItemsSource = docsofflinedata.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                    listViewDocsRef.IsVisible   = true;
                    cancelbtnRef.IsVisible      = true;
                    searchitem = searchBarRef.Text;
                }
                if (searchBarRef.Text.Length == 0)
                {
                    listViewDocsRef.IsVisible = false;
                }
            };

            searchBarRef.SearchButtonPressed += (sender, e) =>
            {
                docsBySearchItem = docsofflinedata.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                Navigation.PushAsync(new SearchItemsListPage(docsBySearchItem, searchitem));
            };


            //         entrySearchRef.TextChanged += (object sender, TextChangedEventArgs e) =>
            //         {
            //                  if (entrySearchRef.Text.Length > 0)
            //                 {
            //                     listViewDocsRef.ItemsSource = docsofflinedata.Where(x => x.DocName.Contains(entrySearchRef.Text)).ToList();
            //                     listViewDocsRef.IsVisible = true;
            //                     // cancelbtnRef.IsVisible = true;
            //                      searchitem = entrySearchRef.Text;
            //                 }
            //  if (entrySearchRef.Text.Length == 0)
            //  {
            //      listViewDocsRef.IsVisible = false;
            //  }
            //};


            //searchbtn.Clicked += (object sender, EventArgs e) =>
            //{
            //    docsBySearchItem=docsofflinedata.Where(x => x.DocName.Contains(entrySearchRef.Text)).ToList();
            //    Navigation.PushAsync(new SearchItemsListPage(docsBySearchItem,searchitem));
            //};


            cancelbtnRef.Clicked += (object sender, EventArgs e) =>
            {
                StacksearchRef.IsVisible  = false;
                listViewDocsRef.IsVisible = false;
                cancelbtnRef.IsVisible    = false;
                if (searchBarRef.Text.Length > 0)
                {
                    searchBarRef.Text = "";
                }
            };

            searchRef.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("CEHSP");
                docsofflinedata             = App.PoliciesRepo.GetAllPolicies();
                listViewDocsRef.ItemsSource = docsofflinedata;
                StacksearchRef.IsVisible    = true;
            };

            btnCEHSP.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("CEHSP");
                NavigateByTabDocType("CEHSP");
            };

            btnCEHSI.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("GEHSI");
                NavigateByTabDocType("GEHSI");
            };
            btnManual.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("Manual");
                NavigateByTabDocType("Manual");
            };
            btnGuidance.Clicked += (object sender, EventArgs e) =>
            {
                NavigateByTabDocType("EH&S Guidance");
            };
            btnEnvSpec.Clicked += (object sender, EventArgs e) =>
            {
                NavigateByTabDocType("ES");
                //GenericLanding dd = SetGenericPage("EnvSpec");
                //Navigation.PushAsync(dd);
            };
            btnRuleBook.Clicked += (object sender, EventArgs e) =>
            {
                //NavigateByDocType("Rule Book");
                //CommonViewModel cvm = new CommonViewModel();
                //cvm.SetOnlineDocumentsToLocal();
                //Navigation.PushAsync(new DDE());
                NavigateByTabDocType("Rule Book");
            };

            listViewDocsRef.ItemSelected += (sender, e) =>
            {
                activityIndicatorLayout.IsVisible = true;
                Policies di = new Policies();
                di = (Policies)e.SelectedItem;

                string docName    = di.DocName;             //di.DocumentItemTitle;
                bool   isFavorite = di.IsFavourite;         // di.IsFavorite;
                di = null;

                ViewDocument dd       = new ViewDocument(docName, isFavorite);
                Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                lblTitle.Text = "Policies And Procedures";

                Navigation.PushAsync(dd);
                dd = null;
                activityIndicatorLayout.IsVisible = false;
            };

            var tabclosegesture = new TapGestureRecognizer();

            tabclosegesture.Tapped += (object sender, EventArgs e) =>
            {
                StacksearchRef.IsVisible = false;
                searchRef.Image          = "search_gray.png";
                homeimage.Source         = "Home_activate.png";
            };
            StacksearchRef.GestureRecognizers.Add(tabclosegesture);
            tabclosegesture.NumberOfTapsRequired = 1;
        }
Exemple #9
0
        public SearchByCategoryPage()
        {
            InitializeComponent();
            BackgroundColor = Color.White;
            if (App.Current.Properties.ContainsKey("cName"))
            {
                this.Title = App.Current.Properties["cName"].ToString();
                string categoryname = App.Current.Properties["cName"].ToString();
                docsofflinedataByCategory   = App.PoliciesRepo.GetAllPeopleAsync(categoryname);
                listViewDocsRef.ItemsSource = docsofflinedataByCategory;
                StacksearchRef.IsVisible    = true;
            }
            listViewDocsRef.ItemSelected += (sender, e) =>
            {
                activityIndicatorLayout.IsVisible = true;
                Policies di = new Policies();
                di = (Policies)e.SelectedItem;

                string docName    = di.DocName;             //di.DocumentItemTitle;
                bool   isFavorite = di.IsFavourite;         // di.IsFavorite;
                di = null;

                ViewDocument dd       = new ViewDocument(docName, isFavorite);
                Label        lblTitle = dd.FindByName <Label>("lblVDTitle");
                lblTitle.Text = "Policies And Procedures";

                Navigation.PushAsync(dd);
                dd = null;
                activityIndicatorLayout.IsVisible = false;
            };
            searchBarRef.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                //if (searchBarRef.Text.Length > 0)
                //{
                //	listViewDocsRef.ItemsSource = docsofflinedataByCategory.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                //	listViewDocsRef.IsVisible = true;
                //                _searchitem = searchBarRef.Text;
                //                searchBarRef.IsVisible = true;
                //	cancelbtnRef.IsVisible = true;
                //	if (searchBarRef.Text.Length == 0)
                //	{
                //		listViewDocsRef.ItemsSource = null;

                //	}
                //}
                if (searchBarRef.Text.Length > 0)
                {
                    List <Policies> docsoffline = docsofflinedataByCategory.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                    if (docsoffline.Count < 15)
                    {
                        listViewDocsRef.HeightRequest = docsoffline.Count * 45;
                    }
                    else
                    {
                        listViewDocsRef.HeightRequest = 400;
                    }
                    listViewDocsRef.ItemsSource = docsoffline;
                    listViewDocsRef.IsVisible   = true;
                    _searchitem = searchBarRef.Text;
                    //searchbtnRef.IsVisible = true;
                    cancelbtnRef.IsVisible = true;
                    if (searchBarRef.Text.Length == 0)
                    {
                        listViewDocsRef.ItemsSource = null;
                    }
                }
            };

            searchBarRef.SearchButtonPressed += (sender, e) =>
            {
                docsnavdata = docsofflinedataByCategory.Where(x => x.DocName.Contains(searchBarRef.Text)).ToList();
                Navigation.PushAsync(new SearchtemListByCatPage(docsnavdata, _searchitem));
            };

            cancelbtnRef.Clicked += (object sender, EventArgs e) =>
            {
                listViewDocsRef.IsVisible = false;
                cancelbtnRef.IsVisible    = false;
                if (searchBarRef.Text.Length > 0)
                {
                    searchBarRef.Text = "";
                }
            };
        }