Esempio n. 1
0
        private async void cleanBtn_Click(object sender, EventArgs e)
        {
            if (tabControlTMLifting.SelectedTab == tabControlTMLifting.TabPages["tabPageServerBasedTM"])
            {
                var i = 0;
                for (; i < gridServerBasedTMs.RowCount; i++)
                {
                    if (gridServerBasedTMs["Status", i].Value != null && gridServerBasedTMs["Status", i].Value.ToString() == "Queued")
                    {
                        _sbTMs = await ServerBasedTranslationMemoryGSKit.CreateAsync(
                            Properties.Settings.Default.UserName,
                            Properties.Settings.Default.Password,
                            Properties.Settings.Default.Uri);

                        if (
                            (gridServerBasedTMs["LastReIndexDate", i].Value == null ||
                             (DateTime)gridServerBasedTMs["LastReIndexDate", i].Value != _sbTMs.ServerBasedTMDetails[i].LastReIndexDate)
                            )
                        {
                            gridServerBasedTMs["LastReIndexDate", i].Value = _sbTMs.ServerBasedTMDetails[i].LastReIndexDate;
                            gridServerBasedTMs["Status", i].Value          = "Finished";
                            gridServerBasedTMs.Refresh();
                        }
                    }
                }
            }
            else
            {
                lstTms.Items.Clear();
                rtbStatus.Text = string.Empty;
            }
        }
Esempio n. 2
0
 public TMLiftingForm()
 {
     InitializeComponent();
     _tmHelper    = new TranslationMemoryHelper();
     _stopWatch   = new Stopwatch();
     _elapsedTime = new StringBuilder();
     _bw          = new BackgroundWorker {
         WorkerReportsProgress = true, WorkerSupportsCancellation = true
     };
     _sbTMs           = new ServerBasedTranslationMemoryGSKit();
     _userCredentials = new UserCredentials();
 }
Esempio n. 3
0
 private async Task <ServerBasedTranslationMemoryGSKit> GetServerBasedTMs()
 {
     try
     {
         return(await ServerBasedTranslationMemoryGSKit.CreateAsync(userNameTxtBox.Text, passwordTxtBox.Text, serverNameTxtBox.Text));
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
         throw;
     }
 }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        private async void AddDetailsCallbackFn(string userName, string password, string uri)
        {
            Properties.Settings.Default.UserName = userName;
            Properties.Settings.Default.Password = password;
            Properties.Settings.Default.Uri      = uri;
            Properties.Settings.Default.Save();
            _sbTMs = await ServerBasedTranslationMemoryGSKit.CreateAsync(userName, password, uri);

            gridServerBasedTMs.DataSource = _sbTMs.ServerBasedTMDetails;
            for (int 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;
            gridServerBasedTMs.Columns.Add("Status", "Status");
            gridServerBasedTMs.ReadOnly = true;
            gridServerBasedTMs.Visible  = true;
        }
Esempio n. 6
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;
            }
        }
Esempio n. 7
0
        //private void EncryptConfigSection(string sectionKey)
        //{
        //	var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        //	var section = config.GetSection(sectionKey);
        //	if (section != null)
        //	{
        //		if (!section.SectionInformation.IsProtected)
        //		{
        //			if (!section.ElementInformation.IsLocked)
        //			{
        //				section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
        //				section.SectionInformation.ForceSave = true;
        //				config.Save(ConfigurationSaveMode.Full);
        //			}
        //		}
        //	}
        //}

        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")
                    {
                        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 ServerBasedTranslationMemoryGSKit.CreateAsync(Properties.Settings.Default.UserName, Properties.Settings.Default.Password, Properties.Settings.Default.Uri);

                        gridServerBasedTMs.DataSource = _sbTMs.ServerBasedTMDetails;
                        for (int 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;
                        gridServerBasedTMs.Columns.Add("Status", "Status");
                        gridServerBasedTMs.ReadOnly = true;
                        gridServerBasedTMs.Visible  = true;
                    }
                    else if (_currentInstance == null && !gridServerBasedTMs.Visible)
                    {
                        _currentInstance = new LoginPage(comboBoxServerBasedTM.Text);
                        _currentInstance._addDetailsCallback = new AddServerBasedTMsDetails(this.AddDetailsCallbackFn);
                        _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        = true;
                reIndexCheckBox.Checked  = false;
                reIndexCheckBox.Enabled  = true;
            }
        }
Esempio n. 8
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";
            }
        }