public override async Task Signout()
        {
            try
            {
                var result = await settings.DisplayAlert("Warning!!", "Are You Sure You Want To Sign Out", "Yes", "No");

                if (result)
                {
                    accounts = await App.PCA.GetAccountsAsync();

                    while (accounts.Any())
                    {
                        await App.PCA.RemoveAsync(accounts.FirstOrDefault());

                        accounts = await App.PCA.GetAccountsAsync();
                    }
                    SignedIn = false;
                    ToastManager.Show("Successfully Signed Out");
                }
            }
            catch (Exception ex)
            {
                DisplayMessage("Already Signed Out", ex.Message, "Ok");
            }
        }
        public override async Task Sync()
        {
            if (App.graphClient != null)
            {
                if (System.IO.File.Exists(FileManager.ordersFilePath))
                {
                    var odItemDateOrders = await App.graphClient.Me.Drive.Root.ItemWithPath(odOrdersFilePath).Versions.Request().GetAsync();

                    Date     odDateOrders = new Date(odItemDateOrders.First().LastModifiedDateTime.ToString().Split(' ')[0]);
                    Time     odTimeOrders = new Time(odItemDateOrders.First().LastModifiedDateTime.ToString().Split(' ')[1]);
                    DateTime dateOrders   = System.IO.File.GetLastWriteTime(FileManager.ordersFilePath);

                    if (odDateOrders.Year == dateOrders.Year)
                    {
                        if (odDateOrders.Month == dateOrders.Month)
                        {
                            if (odDateOrders.Day == dateOrders.Day)
                            {
                                if (odTimeOrders.Hours == dateOrders.Hour)
                                {
                                    if (odTimeOrders.Minutes == dateOrders.Minute)
                                    {
                                        if (odTimeOrders.Seconds < dateOrders.Second)
                                        {
                                            await SaveOrders();
                                        }
                                        else
                                        {
                                            await TryGetOrders();
                                        }
                                    }
                                    else if (odTimeOrders.Minutes < dateOrders.Minute)
                                    {
                                        await SaveOrders();
                                    }
                                    else
                                    {
                                        await TryGetOrders();
                                    }
                                }
                                else if (odTimeOrders.Hours < dateOrders.Hour)
                                {
                                    await SaveOrders();
                                }
                                else
                                {
                                    await TryGetOrders();
                                }
                            }
                            else if (odDateOrders.Day < dateOrders.Day)
                            {
                                await SaveOrders();
                            }
                            else
                            {
                                await TryGetOrders();
                            }
                        }
                        else if (odDateOrders.Month < dateOrders.Month)
                        {
                            await SaveOrders();
                        }
                        else
                        {
                            await TryGetOrders();
                        }
                    }
                    else if (odDateOrders.Year < dateOrders.Year)
                    {
                        await SaveOrders();
                    }
                    else
                    {
                        await TryGetOrders();
                    }
                }
                else
                {
                    await TryGetOrders();
                }



                if (System.IO.File.Exists(FileManager.stocksFilePath))
                {
                    var odItemDateStocks = await App.graphClient.Me.Drive.Root.ItemWithPath(odStocksFilePath).Versions.Request().GetAsync();

                    Date     odDateStocks = new Date(odItemDateStocks.First().LastModifiedDateTime.ToString().Split(' ')[0]);
                    Time     odTimeStocks = new Time(odItemDateStocks.First().LastModifiedDateTime.ToString().Split(' ')[1]);
                    DateTime dateStocks   = System.IO.File.GetLastWriteTime(FileManager.stocksFilePath);

                    if (odDateStocks.Year == dateStocks.Year)
                    {
                        if (odDateStocks.Month == dateStocks.Month)
                        {
                            if (odDateStocks.Day == dateStocks.Day)
                            {
                                if (odTimeStocks.Hours == dateStocks.Hour)
                                {
                                    if (odTimeStocks.Minutes == dateStocks.Minute)
                                    {
                                        if (odTimeStocks.Seconds < dateStocks.Second)
                                        {
                                            await SaveStock();
                                        }
                                        else
                                        {
                                            await TryGetStock();
                                        }
                                    }
                                    else if (odTimeStocks.Minutes < dateStocks.Minute)
                                    {
                                        await SaveStock();
                                    }
                                    else
                                    {
                                        await TryGetStock();
                                    }
                                }
                                else if (odTimeStocks.Hours < dateStocks.Hour)
                                {
                                    await SaveStock();
                                }
                                else
                                {
                                    await TryGetStock();
                                }
                            }
                            else if (odDateStocks.Day < dateStocks.Day)
                            {
                                await SaveStock();
                            }
                            else
                            {
                                await TryGetStock();
                            }
                        }
                        else if (odDateStocks.Month < dateStocks.Month)
                        {
                            await SaveStock();
                        }
                        else
                        {
                            await TryGetStock();
                        }
                    }
                    else if (odDateStocks.Year < dateStocks.Year)
                    {
                        await SaveStock();
                    }
                    else
                    {
                        await TryGetStock();
                    }
                }
                else
                {
                    await TryGetStock();
                }

                ToastManager.Show("Successfully Synced");

                try
                {
                    if (menu != null)
                    {
                        menu.FillTodayOrders();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        public override async Task Sync()
        {
            if (firebase != null)
            {
                if (!System.IO.File.Exists(FileManager.ordersFilePath))
                {
                    try
                    {
                        // FirebaseMetaData metaDataOrders = await firebase
                        //.Child("Documents")
                        //.Child("SamsonTech")
                        //.Child("Orders.txt")
                        //.GetMetaDataAsync();
                        // DateTime firebaseDateOrders = metaDataOrders.Updated;

                        List <FirebaseDataTime> firebaseDatas = await GetDateTimeOrders();

                        FirebaseDataTime firebaseDateOrders = firebaseDatas[0];

                        DateTime dateOrders = System.IO.File.GetLastWriteTime(FileManager.ordersFilePath);

                        if (firebaseDateOrders.Year == dateOrders.Year)
                        {
                            if (firebaseDateOrders.Month == dateOrders.Month)
                            {
                                if (firebaseDateOrders.Day == dateOrders.Day)
                                {
                                    if (firebaseDateOrders.Hour == dateOrders.Hour)
                                    {
                                        if (firebaseDateOrders.Minute == dateOrders.Minute)
                                        {
                                            if (firebaseDateOrders.Second < dateOrders.Second)
                                            {
                                                await SaveOrders();
                                            }
                                            else
                                            {
                                                await TryGetOrders();
                                            }
                                        }
                                        else if (firebaseDateOrders.Minute < dateOrders.Minute)
                                        {
                                            await SaveOrders();
                                        }
                                        else
                                        {
                                            await TryGetOrders();
                                        }
                                    }
                                    else if (firebaseDateOrders.Hour < dateOrders.Hour)
                                    {
                                        await SaveOrders();
                                    }
                                    else
                                    {
                                        await TryGetOrders();
                                    }
                                }
                                else if (firebaseDateOrders.Day < dateOrders.Day)
                                {
                                    await SaveOrders();
                                }
                                else
                                {
                                    await TryGetOrders();
                                }
                            }
                            else if (firebaseDateOrders.Month < dateOrders.Month)
                            {
                                await SaveOrders();
                            }
                            else
                            {
                                await TryGetOrders();
                            }
                        }
                        else if (firebaseDateOrders.Year < dateOrders.Year)
                        {
                            await SaveOrders();
                        }
                        else
                        {
                            await TryGetOrders();
                        }
                    }
                    catch (Exception ex)
                    {
                        await SaveOrders();
                    }
                }
                else
                {
                    await TryGetOrders();
                }



                if (!System.IO.File.Exists(FileManager.stocksFilePath))
                {
                    try
                    {
                        //FirebaseMetaData metaDataStocks = await new FirebaseStorage("samsontech-ebf50.appspot.com")
                        //    .Child("Documents")
                        //    .Child("SamsonTech")
                        //    .Child("Items.txt")
                        //    .GetMetaDataAsync();

                        //DateTime firebaseDateStock = metaDataStocks.Updated;
                        List <FirebaseDataTime> firebaseDatas = await GetDateTimeStocks();

                        FirebaseDataTime firebaseDateStock = firebaseDatas[0];

                        DateTime dateStocks = System.IO.File.GetLastWriteTime(FileManager.stocksFilePath);

                        if (firebaseDateStock.Year == dateStocks.Year)
                        {
                            if (firebaseDateStock.Month == dateStocks.Month)
                            {
                                if (firebaseDateStock.Day == dateStocks.Day)
                                {
                                    if (firebaseDateStock.Hour == dateStocks.Hour)
                                    {
                                        if (firebaseDateStock.Minute == dateStocks.Minute)
                                        {
                                            if (firebaseDateStock.Second < dateStocks.Second)
                                            {
                                                await SaveStock();
                                            }
                                            else
                                            {
                                                await TryGetStock();
                                            }
                                        }
                                        else if (firebaseDateStock.Minute < dateStocks.Minute)
                                        {
                                            await SaveStock();
                                        }
                                        else
                                        {
                                            await TryGetStock();
                                        }
                                    }
                                    else if (firebaseDateStock.Hour < dateStocks.Hour)
                                    {
                                        await SaveStock();
                                    }
                                    else
                                    {
                                        await TryGetStock();
                                    }
                                }
                                else if (firebaseDateStock.Day < dateStocks.Day)
                                {
                                    await SaveStock();
                                }
                                else
                                {
                                    await TryGetStock();
                                }
                            }
                            else if (firebaseDateStock.Month < dateStocks.Month)
                            {
                                await SaveStock();
                            }
                            else
                            {
                                await TryGetStock();
                            }
                        }
                        else if (firebaseDateStock.Year < dateStocks.Year)
                        {
                            await SaveStock();
                        }
                        else
                        {
                            await TryGetStock();
                        }
                    }
                    catch (Exception ex)
                    {
                        await SaveStock();
                    }
                }
                else
                {
                    await TryGetStock();
                }

                ToastManager.Show("Successfully Synced");

                try
                {
                    if (menu != null)
                    {
                        menu.FillTodayOrders();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }