Exemplo n.º 1
0
        private void CreateProject_UEFXML_SelectTestData_Click(object sender, EventArgs e)
        {
            using (var dialog = DialogEx.OpenFile())
            {
                var result = dialog.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    _projectCreateInfoUEFXML.TestDataPath = dialog.FileName;

                    var index = dialog.FileName.IndexOf("data.xml", StringComparison.Ordinal);

                    if (index > 0)
                    {
                        var goldKeyFileName = dialog.FileName.Substring(0, index) + "gold.key.txt";

                        if (File.Exists(goldKeyFileName))
                        {
                            _projectCreateInfoUEFXML.TestGoldKeyPath = goldKeyFileName;
                        }
                    }

                    RefreshUI();
                }
            }
        }
Exemplo n.º 2
0
        private void CreateProject_UEFXML_SelectMeaningEmbeddings_Click(object sender, EventArgs e)
        {
            using (var dialog = DialogEx.OpenFile())
            {
                var result = dialog.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    _projectCreateInfoUEFXML.MeaningEmbeddingsPath = dialog.FileName;

                    RefreshUI();
                }
            }
        }
Exemplo n.º 3
0
        private void CreateProject_SelectWordEmbeddingsFileButton_Click(object sender, EventArgs e)
        {
            using (var dialog = DialogEx.OpenFile())
            {
                var result = dialog.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    _projectCreateInfoPlainText.WordEmbeddingsPath = dialog.FileName;

                    RefreshUI();
                }
            }
        }
Exemplo n.º 4
0
        private void GenerateData_LoadGenerationInfoButton_Click(object sender, EventArgs e)
        {
            using (var dialog = DialogEx.OpenFile("Generation info files (*.wsdgeninfo)|*.wsdgeninfo"))
            {
                var result = dialog.ShowDialog(this);

                if (result == DialogResult.OK)
                {
                    _generationInfo            = SystemJsonReader.Read <GenerationInfo>(dialog.FileName);
                    _selectedFeatureGroupIndex = -1;

                    RefreshUI(true);

                    MessageBox.Show("Generation info loaded successfully.", "Success");
                }
            }
        }
Exemplo n.º 5
0
        private void OpenProjectButton_Click(object sender, EventArgs e)
        {
            using (var dialog = DialogEx.OpenFile("WsdProject files (*.wsdproj)|*.wsdproj"))
            {
                var result = dialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    var projectFile = dialog.FileName;

                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            using (var progress = _progressFactory.NewInstance("Loading project..."))
                            {
                                var project = WsdProject.Load(projectFile, progress);

                                this.InvokeIfRequired(() =>
                                {
                                    RefreshUI();
                                    AddProjectTab(project);
                                });
                            }
                        }
                        catch (OperationCanceledException)
                        {
                            this.InvokeIfRequired(RefreshUI);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(), "Error");
                        }
                    }, TaskCreationOptions.LongRunning);
                }
            }
        }