// save all settings, recreate hotkeys
        //private void SaveButton_Click(object sender, RoutedEventArgs e)
        //{
        //    if (Int32.TryParse(RefreshRate.Text, out int refresh))
        //    {
        //        if(refresh < 15)
        //        {
        //            System.Windows.MessageBox.Show("Refreshrate has to be greater than 15!");
        //        }
        //        else
        //        {
        //            Properties.Settings.Default.RefreshRate = refresh;
        //        }
        //    }
        //    else
        //    {
        //        System.Windows.MessageBox.Show("Refreshrate has to be a number!");
        //    }
        //    if (Int32.TryParse(Sets.Text, out int sets))
        //    {
        //        if (sets < 0)
        //        {
        //            System.Windows.MessageBox.Show("Refreshrate has to be greater than 0!");
        //        }
        //        else
        //        {
        //            Properties.Settings.Default.Sets = sets;
        //        }
        //    }
        //    else
        //    {
        //        System.Windows.MessageBox.Show("Number of Sets has to be a number!");
        //    }



        //    Trace.WriteLine(Properties.Settings.Default.YStashTabOverlay, "y");
        //    Trace.WriteLine(Properties.Settings.Default.XStashTabOverlay, "x");
        //    Trace.WriteLine(Properties.Settings.Default.LeftStashTabOverlay, "left");
        //    Trace.WriteLine(Properties.Settings.Default.TopStashTabOverlay, "top");

        //    Properties.Settings.Default.accName = accountName.Text.ToString();
        //    //Properties.Settings.Default.StashTabsString = SettingsSerializer.SerializeStashTab(stashTabsModel);
        //    //Properties.Settings.Default.StashTabs = stashTabsModel;
        //    Properties.Settings.Default.Save();
        //    System.Windows.MessageBox.Show("Settings saved!");
        //}

        public void RunOverlay()
        {
            Trace.WriteLine(ForegroundWindows.GetForegroundProcessName(), "focused");

            if (overlay.IsOpen)
            {
                overlay.Hide();
                if (stashTabOverlay.IsOpen)
                {
                    stashTabOverlay.Hide();
                }
                RunButton.Content = "Run Overlay";
            }
            else
            {
                if (CheckAllSettings())
                {
                    overlay.Show();
                    RunButton.Content = "Stop Overlay";
                    overlay.CreateFileWatcher(System.IO.Path.GetDirectoryName(Properties.Settings.Default.ClientTxtLocation));
                }
            }
            //bool ready = CheckAllSettings();
            //if (ready)
            //{

            //    if (RunButton.Content.ToString() == "Run Overlay")
            //    {
            //        RunButton.Content = "Stop Overlay";
            //        overlay.Show();
            //    }
            //    else
            //    {
            //        RunButton.Content = "Run Overlay";
            //        overlay.Hide();
            //        if (stashTabOverlay.IsOpen)
            //        {
            //            stashTabOverlay.Hide();
            //        }
            //    }
            //}
        }
        // save all settings, recreate hotkeys
        //private void SaveButton_Click(object sender, RoutedEventArgs e)
        //{
        //    if (Int32.TryParse(RefreshRate.Text, out int refresh))
        //    {
        //        if(refresh < 15)
        //        {
        //            System.Windows.MessageBox.Show("Refreshrate has to be greater than 15!");
        //        }
        //        else
        //        {
        //            Properties.Settings.Default.RefreshRate = refresh;
        //        }
        //    }
        //    else
        //    {
        //        System.Windows.MessageBox.Show("Refreshrate has to be a number!");
        //    }
        //    if (Int32.TryParse(Sets.Text, out int sets))
        //    {
        //        if (sets < 0)
        //        {
        //            System.Windows.MessageBox.Show("Refreshrate has to be greater than 0!");
        //        }
        //        else
        //        {
        //            Properties.Settings.Default.Sets = sets;
        //        }
        //    }
        //    else
        //    {
        //        System.Windows.MessageBox.Show("Number of Sets has to be a number!");
        //    }



        //    Trace.WriteLine(Properties.Settings.Default.YStashTabOverlay, "y");
        //    Trace.WriteLine(Properties.Settings.Default.XStashTabOverlay, "x");
        //    Trace.WriteLine(Properties.Settings.Default.LeftStashTabOverlay, "left");
        //    Trace.WriteLine(Properties.Settings.Default.TopStashTabOverlay, "top");

        //    Properties.Settings.Default.accName = accountName.Text.ToString();
        //    //Properties.Settings.Default.StashTabsString = SettingsSerializer.SerializeStashTab(stashTabsModel);
        //    //Properties.Settings.Default.StashTabs = stashTabsModel;
        //    Properties.Settings.Default.Save();
        //    System.Windows.MessageBox.Show("Settings saved!");
        //}

        public void RunOverlay()
        {
            Trace.WriteLine(ForegroundWindows.GetForegroundProcessName(), "focused");

            if (overlay.IsOpen)
            {
                overlay.Hide();
                if (stashTabOverlay.IsOpen)
                {
                    stashTabOverlay.Hide();
                }
                RunButton.Content = "Run Overlay";
            }
            else
            {
                if (CheckAllSettings())
                {
                    overlay.Show();
                    RunButton.Content = "Stop Overlay";
                }
            }
            //bool ready = CheckAllSettings();
            //if (ready)
            //{

            //    if (RunButton.Content.ToString() == "Run Overlay")
            //    {
            //        RunButton.Content = "Stop Overlay";
            //        overlay.Show();
            //    }
            //    else
            //    {
            //        RunButton.Content = "Run Overlay";
            //        overlay.Hide();
            //        if (stashTabOverlay.IsOpen)
            //        {
            //            stashTabOverlay.Hide();
            //        }
            //    }
            //}
        }