/// <summary>
        /// Handles click on the button by displaying a message box.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event args.</param>
        private void Timer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                spinner.Visibility = Visibility.Visible;
                spinner.Refresh();
                if (textBox_apiKey.Text.Length == 0)
                {
                    MessageBox.Show("Please fill the Clockify API Key");
                }
                else if (comboBoxDesc.Text.Length == 0)
                {
                    MessageBox.Show("Please add description");
                }
                else if (comboBoxProject.SelectedValue.ToString().Length == 0)
                {
                    MessageBox.Show("Please select a project");
                }
                else if (!_timerStart)
                {
                    //progressbar.Value = 30;

                    var _res = ClockifyUtility.StartClockify(workspaceId, new TimeEntryRequest()
                    {
                        start       = DateTime.UtcNow,
                        description = comboBoxDesc.Text,
                        projectId   = comboBoxProject.SelectedValue.ToString()
                    });
                    //progressbar.Value = 90;
                    if (!string.IsNullOrEmpty(_res?.id))
                    {
                        _timerStart         = !_timerStart;
                        buttonTimer.Content = "Stop Timer";
                    }
                }
                else
                {
                    var _res = ClockifyUtility.StopClockify(workspaceId, _user.id, new StopTimeEntryRequest()
                    {
                        end = DateTime.UtcNow
                    });
                    if (!string.IsNullOrEmpty(_res?.id))
                    {
                        _timerStart         = !_timerStart;
                        buttonTimer.Content = "Start Timer";
                    }
                }

                //progressbar.Visibility = Visibility.Hidden;
            }
            catch (Exception ex)
            {
                //buttonApply.Content = !_timerStart ? "Start Timer" : "Stop Timer";
                //progressbar.Visibility = Visibility.Hidden;
                MethodLogger.SaveLogToFile("Timer_Click exception:" + ex.Message);
                MethodLogger.SaveLogToFile("Timer_Click exception:" + ex.StackTrace);
            }

            spinner.Visibility = Visibility.Hidden;
        }
        private void buttonApply_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                spinner.Visibility = Visibility.Visible;
                spinner.Refresh();

                if (textBox_apiKey.Text.Length == 0)
                {
                    MessageBox.Show("Please fill the Clockify API Key");
                }
                else
                {
                    //progressbar.Value = 15;
                    //UCLoadingControl.Visibility = Visibility.Visible;
                    ServiceUtility.ClockifyApiKey         = textBox_apiKey.Text;
                    ServiceUtility.AzurePAT               = textBox_azurePAT.Text;
                    ServiceUtility.AzureSearchAPIEndPoint = textBox_azureUrl.Text;
                    ServiceUtility.AzureAPIEndPoint       = textBox_azureApiUrl.Text;

                    var res = loadClockifyData().Result;
                    //UCLoadingControl.Visibility = Visibility.Hidden;
                    if (string.IsNullOrEmpty(_user?.id))
                    {
                        MessageBox.Show("Invalild Clockify API Key");
                    }
                }
                //buttonApply.Content = "Apply";
                //progressbar.Visibility = Visibility.Hidden;

                //SpinnerVisibility = false;
            }
            catch (Exception ex)
            {
                //buttonApply.Content = "Apply";
                //progressbar.Visibility = Visibility.Hidden;
                MethodLogger.SaveLogToFile("buttonApply_Click exception:" + ex.Message);
                MethodLogger.SaveLogToFile("buttonApply_Click exception:" + ex.StackTrace);
            }

            spinner.Visibility = Visibility.Hidden;
            spinner.Refresh();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClockifyWindowControl"/> class.
        /// </summary>
        public ClockifyWindowControl()
        {
            try
            {
                //MethodLogger.SaveLogToFile("ClockifyWindowControl ClockifyApiKey:" + ServiceUtility.ClockifyApiKey);
                //MethodLogger.SaveLogToFile("ClockifyWindowControl ClockifyApiUrl:" + ServiceUtility.ClockifyApiUrl);
                this.InitializeComponent();

                // DataContext explains WPF in which object WPF has to check the binding path. Here Vis is in "this" then:
                DataContext = this;

                // this._clockifyService = new ClockyifyService();
                //this._azureService = new AzureAPIService();
                textBox_apiKey.Text      = ServiceUtility.ClockifyApiKey;
                textBox_azurePAT.Text    = ServiceUtility.AzurePAT;
                textBox_azureUrl.Text    = ServiceUtility.AzureSearchAPIEndPoint;
                textBox_azureApiUrl.Text = ServiceUtility.AzureAPIEndPoint;
                spinner.Icon             = FontAwesomeIcon.Spinner;
                Statuses = new List <string>()
                {
                    "Proposed", "Active", "Resolved", "Closed"
                };


                if (textBox_apiKey.Text.Length > 0)
                {
                    var res = loadClockifyData().Result;
                }
                else
                {
                    //  ExpanderTimePanel.Visibility = Visibility.Hidden;
                    TimerPanel.Visibility = Visibility.Hidden;
                }
            }
            catch (Exception ex)
            {
                MethodLogger.SaveLogToFile("ClockifyWindowControl exception:" + ex.Message);
                MethodLogger.SaveLogToFile("ClockifyWindowControl exception:" + ex.StackTrace);
            }
        }