Пример #1
0
        private void _okButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;

            string name     = _nameTextBox.Text;
            var    keywords = new KeywordCollection();

            if (!string.IsNullOrWhiteSpace(_keywordsComboBox1.Text))
            {
                keywords.Add(_keywordsComboBox1.Text);
            }
            if (!string.IsNullOrWhiteSpace(_keywordsComboBox2.Text))
            {
                keywords.Add(_keywordsComboBox2.Text);
            }
            if (!string.IsNullOrWhiteSpace(_keywordsComboBox3.Text))
            {
                keywords.Add(_keywordsComboBox3.Text);
            }
            keywords = new KeywordCollection(new HashSet <string>(keywords));
            var digitalSignature = _signatureComboBox.SelectedItem as DigitalSignature;

            Task.Run(() =>
            {
                Thread.CurrentThread.IsBackground = true;

                try
                {
                    if (!_isShare)
                    {
                        _amoebaManager.Upload(_filePath,
                                              name,
                                              keywords,
                                              digitalSignature,
                                              3);
                    }
                    else
                    {
                        _amoebaManager.Share(_filePath,
                                             name,
                                             keywords,
                                             digitalSignature,
                                             3);
                    }
                }
                catch (Exception)
                {
                }
            });

            Settings.Instance.Global_UploadKeywords.Clear();
            Settings.Instance.Global_UploadKeywords.AddRange(keywords);
        }
Пример #2
0
        private void _okButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;

            string name     = _nameTextBox.Text;
            var    keywords = new KeywordCollection();

            if (!string.IsNullOrWhiteSpace(_keywordsComboBox1.Text))
            {
                keywords.Add(_keywordsComboBox1.Text);
            }
            if (!string.IsNullOrWhiteSpace(_keywordsComboBox2.Text))
            {
                keywords.Add(_keywordsComboBox2.Text);
            }
            if (!string.IsNullOrWhiteSpace(_keywordsComboBox3.Text))
            {
                keywords.Add(_keywordsComboBox3.Text);
            }
            keywords = new KeywordCollection(new HashSet <string>(keywords));
            string           comment = string.IsNullOrWhiteSpace(_commentTextBox.Text) ? null : _commentTextBox.Text;
            var              digitalSignatureComboBoxItem = _signatureComboBox.SelectedItem as DigitalSignatureComboBoxItem;
            DigitalSignature digitalSignature             = digitalSignatureComboBoxItem == null ? null : digitalSignatureComboBoxItem.Value;

            if (!_isShare)
            {
                _amoebaManager.Upload(_filePath,
                                      name,
                                      keywords,
                                      comment,
                                      digitalSignature,
                                      3);
            }
            else
            {
                _amoebaManager.Share(_filePath,
                                     name,
                                     keywords,
                                     comment,
                                     digitalSignature,
                                     3);
            }

            Settings.Instance.Global_UploadKeywords.Clear();
            Settings.Instance.Global_UploadKeywords.AddRange(keywords);
        }