async void Project_OnSelectionChanged(object sender, EventArgs e)
        {
            if (viewModel.SelectedProject == null || viewModel.SelectedProject.Name.Equals(TAG_NO_SELECTION))
            {
                rowTask.IsVisible = false;
            }
            else
            {
                viewModel.CompanyError = false;
                viewModel.ProjectError = false;
                rowTask.IsVisible      = true;
            }
            if (selTask != null || viewModel.ProjectInitialBinding || viewModel.SelectedProject == null || viewModel.SelectedProject.Name.Equals(TAG_NO_SELECTION))

            {
                viewModel.ProjectInitialBinding = false;
                return;
            }

            try
            {
                viewModel.TaskInitialBinding = true;

                viewModel.VisibleLoad    = true;
                viewModel.LoadingMessage = "";

                // viewModel.SelectedTask = null;
                viewModel.SelectedExpenseCode = null;



                if (viewModel.SelectedProject == null || viewModel.SelectedProject.Name.Equals(TAG_NO_SELECTION))
                {
                    inputSettings = await TimeEntryService.Get(selectedProjectId : null);
                }
                else
                {
                    inputSettings = await TimeEntryService.Get(selectedProjectId : viewModel.SelectedProject.Id);
                }



                setModelsByTimeEntryService(2);
                //viewModel.Tasks =  new ObservableCollection<ProjectInsight.Models.Tasks.Task>(inputSettings.TaskList);


                viewModel.SelectedTask = viewModel.Tasks.Where(x => x.Id == inputSettings.SelectedTaskId).FirstOrDefault();
                if (!inputSettings.SelectedTaskId.HasValue)
                {
                    viewModel.TaskInitialBinding = false;
                }


                viewModel.SelectedExpenseCode = viewModel.ExpenseCodes.Where(x => x.Id == inputSettings.SelectedTimeEntryExpenseCodeId).FirstOrDefault();

                viewModel.ShowTimeInHours    = inputSettings.UseHoursMinutesInput;
                viewModel.ShowTimeInDecimals = !inputSettings.UseHoursMinutesInput;

                //if (inputSettings.SelectedProjectTimeEntryInputSettings != null)
                //    viewModel.ShowBillableCheckboxInput = inputSettings.SelectedProjectTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                if (inputSettings.SelectedTaskId.HasValue)
                {
                    if (inputSettings.SelectedTaskTimeEntryInputSettings != null && inputSettings.SelectedTaskTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                    {
                        viewModel.ShowBillableCheckboxInput = inputSettings.SelectedTaskTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                    }
                }
                else
                {
                    if (inputSettings.SelectedProjectId.HasValue)
                    {
                        if (inputSettings.SelectedProjectTimeEntryInputSettings != null && inputSettings.SelectedProjectTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                        {
                            viewModel.ShowBillableCheckboxInput = inputSettings.SelectedProjectTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                        }
                    }
                    else
                    {
                        if (inputSettings.SelectedCompanyId.HasValue)
                        {
                            if (inputSettings.SelectedCompanyTimeEntryInputSettings != null && inputSettings.SelectedCompanyTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                            {
                                viewModel.ShowBillableCheckboxInput = inputSettings.SelectedCompanyTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                            }
                        }
                    }
                }

                viewModel.VisibleLoad = false;
            }
            catch (Exception ex)
            {
            }
        }
        private async Task <bool> GetSettings()
        {
            try
            {
                inputSettings = await TimeEntryService.Get(
                    selectedCompanyId : viewModel.SelectedCompany != null?viewModel.SelectedCompany.Id : null,
                    selectedProjectId : viewModel.SelectedProject != null?viewModel.SelectedProject.Id : null);



                if (inputSettings.EnableTimeEntry == false)
                {
                    viewModel.VisibleLoad = false;
                    //    Common.Instance.ShowToastMessage("Time entry is not enabled!", DoubleResources.DangerSnackBar);
                    return(false);
                }

                if (selTask == null)
                {
                    //set Default Value
                    setModelsByTimeEntryService();


                    if (inputSettings.SelectedCompanyId.HasValue)
                    {
                        viewModel.SelectedCompany = viewModel.Companies.Where(x => x.Id == inputSettings.SelectedCompanyId).FirstOrDefault();
                    }

                    if (inputSettings.SelectedProjectId.HasValue)
                    {
                        viewModel.SelectedProject = viewModel.Projects.Where(x => x.Id == inputSettings.SelectedProjectId).FirstOrDefault();
                        rowTask.IsVisible         = true;
                    }
                    else
                    {
                        rowTask.IsVisible = false;
                    }

                    if (inputSettings.SelectedTaskId.HasValue)
                    {
                        viewModel.SelectedTask = viewModel.Tasks.Where(x => x.Id == inputSettings.SelectedTaskId).FirstOrDefault();

                        if (inputSettings.SelectedTaskTimeEntryInputSettings != null && inputSettings.SelectedTaskTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                        {
                            viewModel.ShowBillableCheckboxInput = inputSettings.SelectedTaskTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                            viewModel.IsBillable = inputSettings.SelectedTaskTimeEntryInputSettings.IsBillableDefaultOn.Value;
                            //viewModel.ShowBillableCheckboxInput = false;
                        }
                    }
                    else
                    {
                        if (inputSettings.SelectedProjectId.HasValue)
                        {
                            if (inputSettings.SelectedProjectTimeEntryInputSettings != null && inputSettings.SelectedProjectTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                            {
                                viewModel.ShowBillableCheckboxInput = inputSettings.SelectedProjectTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                                viewModel.IsBillable = inputSettings.SelectedProjectTimeEntryInputSettings.IsBillableDefaultOn.Value;
                            }
                        }
                        else
                        {
                            if (inputSettings.SelectedCompanyId.HasValue)
                            {
                                if (inputSettings.SelectedCompanyTimeEntryInputSettings != null && inputSettings.SelectedCompanyTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                                {
                                    viewModel.ShowBillableCheckboxInput = inputSettings.SelectedCompanyTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                                    viewModel.IsBillable = inputSettings.SelectedCompanyTimeEntryInputSettings.IsBillableDefaultOn.Value;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (inputSettings.SelectedTaskTimeEntryInputSettings != null && inputSettings.SelectedTaskTimeEntryInputSettings.ShowBillableCheckboxInput.HasValue)
                    {
                        viewModel.ShowBillableCheckboxInput = inputSettings.SelectedTaskTimeEntryInputSettings.ShowBillableCheckboxInput.Value;
                        viewModel.IsBillable = inputSettings.SelectedTaskTimeEntryInputSettings.IsBillableDefaultOn.Value;
                    }
                }

                List <ProjectInsight.Models.ReferenceData.ExpenseCode> expenseCodes = await ExpenseCodeService.GetActive();

                viewModel.ExpenseCodes = new ObservableCollection <ProjectInsight.Models.ReferenceData.ExpenseCode>(expenseCodes);
                //viewModel.ExpenseCodes = new ObservableCollection<ProjectInsight.Models.ReferenceData.ExpenseCode>();
                //foreach (var item in expenseCodes)
                //    viewModel.ExpenseCodes.Add(item);

                viewModel.SelectedExpenseCode = viewModel.ExpenseCodes.Where(x => x.Id == inputSettings.SelectedTimeEntryExpenseCodeId).FirstOrDefault();

                viewModel.ShowTimeInHours    = inputSettings.UseHoursMinutesInput;
                viewModel.ShowTimeInDecimals = !inputSettings.UseHoursMinutesInput;
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }