private async void btnChooseFile_Click(object sender, RoutedEventArgs e)
        {
            SelectExistingRamlOption();
            FileDialog fd = new OpenFileDialog();
            fd.DefaultExt = ".raml;*.rml";
            fd.Filter = "RAML files |*.raml;*.rml";

            var opened = fd.ShowDialog();

            if (opened != true)
            {
                return;
            }

            RamlTempFilePath = fd.FileName;
            RamlOriginalSource = fd.FileName;

            var title = Path.GetFileName(fd.FileName);

            
            var preview = new RamlPreview(ServiceProvider, action, RamlTempFilePath, RamlOriginalSource, title, isContractUseCase);
            
            StartProgress();
            preview.FromFile();
            StopProgress();

            var dialogResult = preview.ShowDialog();
            if(dialogResult == true)
                Close();
        }
        private async void btnChooseFile_Click(object sender, RoutedEventArgs e)
        {
            SelectExistingRamlOption();
            FileDialog fd = new OpenFileDialog();

            fd.DefaultExt = ".raml;*.rml";
            fd.Filter     = "RAML files |*.raml;*.rml";

            var opened = fd.ShowDialog();

            if (opened != true)
            {
                return;
            }

            RamlTempFilePath   = fd.FileName;
            RamlOriginalSource = fd.FileName;

            var title = Path.GetFileName(fd.FileName);


            var preview = new RamlPreview(ServiceProvider, action, RamlTempFilePath, RamlOriginalSource, title, isContractUseCase);

            StartProgress();
            preview.FromFile();
            StopProgress();

            var dialogResult = preview.ShowDialog();

            if (dialogResult == true)
            {
                Close();
            }
        }
        private async void LibraryButton_OnClick(object sender, RoutedEventArgs e)
        {
            SelectExistingRamlOption();
            var rmlLibrary       = new RAMLLibraryBrowser(exchangeUrl);
            var selectedRamlFile = rmlLibrary.ShowDialog();

            if (selectedRamlFile.HasValue && selectedRamlFile.Value)
            {
                var url = rmlLibrary.RAMLFileUrl;

                txtURL.Text = url;

                var preview = new RamlPreview(ServiceProvider, action, RamlTempFilePath, txtURL.Text, "title", isContractUseCase);

                StartProgress();
                preview.FromURL();
                StopProgress();

                var dialogResult = preview.ShowDialog();
                if (dialogResult == true)
                {
                    Close();
                }
            }
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            var preview = new RamlPreview(ServiceProvider, action, txtTitle.Text);

            preview.NewContract();
            preview.ShowDialog();
            Close();
        }
        private async void GoButton_Click(object sender, RoutedEventArgs e)
        {
            //TODO: check title !
            SelectExistingRamlOption();
            var preview = new RamlPreview(ServiceProvider, action, RamlTempFilePath, txtURL.Text, "title", isContractUseCase);

            StartProgress();
            preview.FromURL();
            StopProgress();

            var dialogResult = preview.ShowDialog();

            if (dialogResult == true)
            {
                Close();
            }
        }
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     var preview = new RamlPreview(ServiceProvider, action, txtTitle.Text);
     preview.NewContract();
     preview.ShowDialog();
     Close();
 }
        private async void GoButton_Click(object sender, RoutedEventArgs e)
        {
            //TODO: check title !
            SelectExistingRamlOption();
            var preview = new RamlPreview(ServiceProvider, action, RamlTempFilePath, txtURL.Text, "title", isContractUseCase);
            
            StartProgress();
            preview.FromURL();
            StopProgress();

            var dialogResult = preview.ShowDialog();
            if(dialogResult == true)
                Close();
        }
        private async void LibraryButton_OnClick(object sender, RoutedEventArgs e)
        {
            SelectExistingRamlOption();
            var rmlLibrary = new RAMLLibraryBrowser(exchangeUrl);
            var selectedRamlFile = rmlLibrary.ShowDialog();

            if (selectedRamlFile.HasValue && selectedRamlFile.Value)
            {
                var url = rmlLibrary.RAMLFileUrl;

                txtURL.Text = url;

                var preview = new RamlPreview(ServiceProvider, action, RamlTempFilePath, txtURL.Text, "title", isContractUseCase);
                
                StartProgress();
                preview.FromURL();
                StopProgress();

                var dialogResult = preview.ShowDialog();
                if (dialogResult == true)
                    Close();
            }
        }