Example #1
0
        private async void runButton_Click(object sender, EventArgs ev)
        {
            var source_locres = sourceLocRes.Text;
            var target_locres = targetLocRes.Text;
            var xliff_path    = xliffPath.Text;
            var slang         = sourceLang.Text;
            var tlang         = targetLang.Text;

            LocResFormat format = LocResFormat.Auto;

            switch (locResFormat.SelectedIndex)
            {
            case 0: format = LocResFormat.Auto; break;

            case 1: format = LocResFormat.Old; break;

            case 2: format = LocResFormat.New; break;

            default:
                ImpossibleCondition();
                break;
            }

            UseWaitCursor  = true;
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                await Task.Run(() =>
                {
                    switch (Mode)
                    {
                    case OperationMode.Import:
                        Converter.Import(source_locres, xliff_path, slang, tlang);
                        break;

                    case OperationMode.Align:
                        Converter.Align(source_locres, target_locres, xliff_path, slang, tlang);
                        break;

                    case OperationMode.Export:
                        Converter.Export(xliff_path, target_locres, format);
                        break;

                    default:
                        ImpossibleCondition();
                        break;
                    }
                });

                MessageBox.Show(this, "Done.", "lrxw");
            }
            catch (Exception e)
            {
                MessageBox.Show(this, string.Format("Error: {0}", e.Message), "Exception - lrxw");
            }

            UseWaitCursor  = false;
            Cursor.Current = Cursors.Default;
        }