using System.Diagnostics;
using System.Windows;
using System.Windows.Input;

namespace VSConverter.WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                DragMove();
            }
        }

        private void CloseWindow(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void OpenSourceCode(object sender, RoutedEventArgs e)
        {
            Process.Start(Properties.Resources.SourceCode);
        }

        private void OpenAboutAuthor(object sender, RoutedEventArgs e)
        {
            Process.Start(Properties.Resources.AboutAuthor);
        }

        private void ChooseDialogNext(object sender, RoutedEventArgs e)
        {
            this.chooseDialog.Visibility = System.Windows.Visibility.Collapsed;
            this.convertDialog.Visibility = System.Windows.Visibility.Visible;
        }

        private void ShowChooseDialog(object sender, RoutedEventArgs e)
        {
            this.chooseDialog.Visibility = System.Windows.Visibility.Visible;
        }

        private void CloseChooseDialog(object sender, RoutedEventArgs e)
        {
            this.chooseDialog.Visibility = System.Windows.Visibility.Collapsed;
        }

        private void OpenSolutionPath(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
            openDialog.Filter = "解决方案(*.sln)|*.sln|CS项目文件(*.csproj)|*.csproj|VB项目文件(*.vbproj)|*.vbproj";
            if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.solutionPath.Text = openDialog.FileName;
            }
        }

        private void ConvertDialogPrev(object sender, RoutedEventArgs e)
        {
            this.chooseDialog.Visibility = System.Windows.Visibility.Visible;
            this.convertDialog.Visibility = System.Windows.Visibility.Collapsed;
        }

        private void CloseConvertDialog(object sender, RoutedEventArgs e)
        {
            this.convertDialog.Visibility = System.Windows.Visibility.Collapsed;
        }
    }
}
