Пример #1
0
 public TMLiftingForm()
 {
     InitializeComponent();
     _tmHelper    = new TranslationMemoryHelper();
     _stopWatch   = new Stopwatch();
     _elapsedTime = new StringBuilder();
     _bw          = new BackgroundWorker {
         WorkerReportsProgress = true, WorkerSupportsCancellation = true
     };
     _bwGS = new BackgroundWorker {
         WorkerReportsProgress = true, WorkerSupportsCancellation = true
     };
     _sbTMs           = new TranslationMemory.ServerBasedTranslationMemory();
     _userCredentials = new UserCredentials();
 }
Пример #2
0
        private async void AddDetailsCallbackFn(string userName, string password, string uri)
        {
            _sbTMs = await TranslationMemory.ServerBasedTranslationMemory.CreateAsync(userName, password, uri);

            //gridServerBasedTMs.DataSource = from tm in _sbTMs.ServerBasedTMDetails
            //								select new
            //								{
            //									tm.Name,
            //									tm.Description,
            //									tm.Location
            //								};
            //gridServerBasedTMs.DataSource = _sbTMs.ServerBasedTMDetails;
            gridServerBasedTMs.DataSource = _sbTMs.ServerBasedTMDetails.Select(tm => new
                                                                               { Name = tm.Name, Description = tm.Description, Location = tm.Location }).ToList();
            gridServerBasedTMs.Visible = true;
        }
        public void ProcessReindexServerBasedTm(BackgroundWorker bw, ServerBasedTranslationMemory tm)
        {
            //foreach (var languageDirection in tm.LanguageDirections)
            //{
            //	var unitsCount = languageDirection.GetTranslationUnitCount();
            //	var iterator = new RegularIterator(unitsCount);
            //	//var result = languageDirection.ReindexTranslationUnits(ref iterator);

            //	while (languageDirection.ReindexTranslationUnits(ref iterator))
            //	{
            //		if (!bw.CancellationPending)
            //		{
            //			//bw.ReportProgress(0, _reindexStatus.ToString());

            //		}
            //		else
            //		{
            //			//bw.ReportProgress(100, "");
            //		}
            //	}
            //}
            //tm.RecomputeFuzzyIndexStatistics();
            //tm.Save();
        }
Пример #4
0
        private async void TabControlTMLifting_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControlTMLifting.SelectedTab == tabControlTMLifting.TabPages["tabPageServerBasedTM"])
            {
                if (comboBoxServerBasedTM.SelectedItem != null)
                {
                    _userCredentials = _sbTMs.GetUserCredentials(comboBoxServerBasedTM.SelectedItem as Uri);
                    if (_userCredentials.UserName != "N/A" && _userCredentials.Password != "N/A")
                    {
                        _sbTMs = await TranslationMemory.ServerBasedTranslationMemory.CreateAsync(_userCredentials.UserName, _userCredentials.Password, comboBoxServerBasedTM.SelectedItem.ToString());

                        gridServerBasedTMs.DataSource = _sbTMs.ServerBasedTMDetails.Select(tm => new
                                                                                           { Name = tm.Name, Description = tm.Description, Location = tm.Location }).ToList();;
                        gridServerBasedTMs.Visible = true;
                    }
                    else
                    {
                        var form = new LoginPage(comboBoxServerBasedTM.Text);
                        form.AddDetailsCallback = new AddServerBasedTMsDetails(this.AddDetailsCallbackFn);
                        form.Show();
                    }
                }
            }
        }
        public static Task <ServerBasedTranslationMemory> CreateAsync(string userName, string password, string uri)
        {
            var ret = new ServerBasedTranslationMemory();

            return(ret.InitializeAsync(userName, password, uri));
        }
 public ServerBasedTranslationMemoryInfo(Uri uri, bool isServerBasedTranslationMemory)
 {
     Name = ServerBasedTranslationMemory.GetServerBasedTranslationMemoryPath(uri);
     IsServerBasedTranslationMemory = isServerBasedTranslationMemory;
 }