Beispiel #1
0
        private async void AddDetailsCallback(string userName, string password, string uri)
        {
            try
            {
                Properties.Settings.Default.UserName = userName;
                Properties.Settings.Default.Password = password;
                Properties.Settings.Default.Uri      = uri;
                Properties.Settings.Default.Save();
                _sbTMs = await ServerBasedTranslationMemoryInfo.CreateAsync(userName, password, uri);

                var sortedBindingList = new SortableBindingList <TranslationMemoryDetails>(_sbTMs.ServerBasedTMDetails);
                gridServerBasedTMs.DataSource = sortedBindingList;
                for (var i = 0; i < gridServerBasedTMs.Columns.Count; i++)
                {
                    gridServerBasedTMs.Columns[i].Visible = false;
                }
                gridServerBasedTMs.Columns["Name"].Visible        = true;
                gridServerBasedTMs.Columns["Description"].Visible = true;
                gridServerBasedTMs.Columns["CreatedOn"].Visible   = true;
                gridServerBasedTMs.Columns["Location"].Visible    = true;
                gridServerBasedTMs.Columns["ShouldRecomputeStatistics"].Visible = true;
                gridServerBasedTMs.Columns["LastReIndexDate"].Visible           = true;
                gridServerBasedTMs.Columns["LastReIndexSize"].Visible           = true;
                if (!gridServerBasedTMs.Columns.Contains("Status"))
                {
                    gridServerBasedTMs.Columns.Add("Status", "Status");
                }
                gridServerBasedTMs.Columns["Status"].Visible = true;
                gridServerBasedTMs.ReadOnly = true;
                gridServerBasedTMs.Visible  = true;
                connectToServerBtn.Text     = "Logout";
            }
            catch (Exception ex)
            {
                throw new SystemException(Constants.AuthentificationErrorMsg);
            }
        }
Beispiel #2
0
        private async void cleanBtn_Click(object sender, EventArgs e)
        {
            if (tabControlTMLifting.SelectedTab == tabControlTMLifting.TabPages["tabPageServerBasedTM"])
            {
                var i = 0;
                for (; i < gridServerBasedTMs.RowCount - 1; i++)
                {
                    _sbTMs = await ServerBasedTranslationMemoryInfo.CreateAsync(
                        Properties.Settings.Default.UserName,
                        Properties.Settings.Default.Password,
                        Properties.Settings.Default.Uri);

                    gridServerBasedTMs["LastReIndexDate", i].Value = _sbTMs.ServerBasedTMDetails[i].LastReIndexDate;
                    gridServerBasedTMs["Status", i].Value          = "";
                    gridServerBasedTMs.Refresh();
                }
            }
            else
            {
                lstTms.Items.Clear();
                rtbStatus.Text     = string.Empty;
                btnReindex.Enabled = false;
            }
        }
Beispiel #3
0
        private async void TabControlTMLifting_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControlTMLifting.SelectedTab == tabControlTMLifting.TabPages["tabPageServerBasedTM"])
            {
                cleanBtn.Text = "Refresh";
                if (comboBoxServerBasedTM.SelectedItem != null)
                {
                    _userCredentials = _sbTMs.GetUserCredentials(comboBoxServerBasedTM.SelectedItem as Uri);
                    if (_userCredentials.UserName != "N/A" && _userCredentials.Password != "N/A")
                    {
                        try
                        {
                            Properties.Settings.Default.UserName = _userCredentials.UserName;
                            Properties.Settings.Default.Password = _userCredentials.Password;
                            Properties.Settings.Default.Uri      = comboBoxServerBasedTM.SelectedItem.ToString();
                            Properties.Settings.Default.Save();
                            _sbTMs = await ServerBasedTranslationMemoryInfo.CreateAsync(Properties.Settings.Default.UserName, Properties.Settings.Default.Password, Properties.Settings.Default.Uri);

                            var sortedBindingList = new SortableBindingList <TranslationMemoryDetails>(_sbTMs.ServerBasedTMDetails);
                            gridServerBasedTMs.DataSource = sortedBindingList;
                            for (var i = 0; i < gridServerBasedTMs.Columns.Count; i++)
                            {
                                gridServerBasedTMs.Columns[i].Visible = false;
                            }
                            gridServerBasedTMs.Columns["Name"].Visible        = true;
                            gridServerBasedTMs.Columns["Description"].Visible = true;
                            gridServerBasedTMs.Columns["CreatedOn"].Visible   = true;
                            gridServerBasedTMs.Columns["Location"].Visible    = true;
                            gridServerBasedTMs.Columns["ShouldRecomputeStatistics"].Visible = true;
                            gridServerBasedTMs.Columns["LastReIndexDate"].Visible           = true;
                            gridServerBasedTMs.Columns["LastReIndexSize"].Visible           = true;
                            if (!gridServerBasedTMs.Columns.Contains("Status"))
                            {
                                gridServerBasedTMs.Columns.Add("Status", "Status");
                            }
                            gridServerBasedTMs.Columns["Status"].Visible = true;
                            gridServerBasedTMs.ReadOnly = true;
                            gridServerBasedTMs.Visible  = true;
                            groupBoxTM.Controls.Add(gridServerBasedTMs);
                            connectToServerBtn.Text = "Logout";
                        }
                        catch (Exception ex)
                        {
                            throw new SystemException(Constants.AuthentificationErrorMsg);
                        }
                    }
                    else if (_currentInstance == null && !gridServerBasedTMs.Visible)
                    {
                        _currentInstance = new LoginPage(comboBoxServerBasedTM.Text);
                        _currentInstance._addDetailsCallback = new AddServerBasedTMsDetails(AddDetailsCallback);
                        _currentInstance.FormClosed         += InstanceHasBeenClosed;
                        _currentInstance.Show();
                    }
                    else
                    {
                        if (_currentInstance != null && !gridServerBasedTMs.Visible)
                        {
                            _currentInstance             = new LoginPage(comboBoxServerBasedTM.Text);
                            _currentInstance.FormClosed += InstanceHasBeenClosed;
                            _currentInstance.BringToFront();
                        }
                    }
                }
                btnBrowse.Enabled        = false;
                chkLoadStudioTMs.Enabled = false;
                upLiftCheckBox.Enabled   = false;
                cancelBtn.Enabled        = false;
                reIndexCheckBox.Checked  = true;
                reIndexCheckBox.Enabled  = false;
            }
            else
            {
                btnBrowse.Enabled        = true;
                chkLoadStudioTMs.Enabled = true;
                upLiftCheckBox.Enabled   = true;
                cancelBtn.Enabled        = false;
                reIndexCheckBox.Checked  = true;
                reIndexCheckBox.Enabled  = true;
                cleanBtn.Text            = "Clean";
            }
        }