예제 #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;
            }
        }
예제 #2
0
        public static async Task <ServerBasedTranslationMemoryGSKit> CreateAsync(string userName, string password, string uri)
        {
            var sbTMGSKit = new ServerBasedTranslationMemoryGSKit();
            var token     = await GroupShareClient.GetRequestToken(userName, password, new Uri(uri), GroupShareClient.AllScopes);

            var groupShareClient = await GroupShareClient.AuthenticateClient(token, userName, password, new Uri(uri),
                                                                             GroupShareClient.AllScopes);

            var tmClient = await groupShareClient.TranslationMemories.GetTms();

            sbTMGSKit.GroupShareClient     = groupShareClient;
            sbTMGSKit.ServerBasedTMDetails = new BindingList <TranslationMemoryDetails>(tmClient.Items);
            return(sbTMGSKit);
        }
예제 #3
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.ServerBasedTranslationMemoryGSKit();
     _userCredentials = new UserCredentials();
 }
예제 #4
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;
        }
예제 #5
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;
            }
        }
예제 #6
0
        public static Task <ServerBasedTranslationMemoryGSKit> CreateAsync(string userName, string password, string uri)
        {
            var ret = new ServerBasedTranslationMemoryGSKit();

            return(ret.InitializeAsync(userName, password, uri));
        }