/// <summary> /// 投稿するファイルとその投稿先を選択するためのコントロールを表示する。 /// D&Dをサポートする場合は引数にドロップされたファイル名を指定して呼ぶこと。 /// </summary> public void BeginSelection(string[] fileNames = null) { if (fileNames != null && fileNames.Length > 0) { var serviceName = this.ServiceName; if (string.IsNullOrEmpty(serviceName)) { return; } var service = this.pictureService[serviceName]; var count = Math.Min(fileNames.Length, service.MaxMediaCount); if (!this.Visible || count > 1) { // 非表示時または複数のファイル指定は新規選択として扱う SetImagePageCombo(); if (this.BeginSelecting != null) { this.BeginSelecting(this, EventArgs.Empty); } this.Visible = true; } this.Enabled = true; if (count == 1) { ImagefilePathText.Text = fileNames[0]; ImageFromSelectedFile(false); } else { for (int i = 0; i < count; i++) { var index = ImagePageCombo.Items.Count - 1; if (index == 0) { ImagefilePathText.Text = fileNames[i]; } ImageFromSelectedFile(index, fileNames[i], false); } } } else { if (!this.Visible) { if (this.BeginSelecting != null) { this.BeginSelecting(this, EventArgs.Empty); } this.Visible = true; this.Enabled = true; ImageFromSelectedFile(true); ImagefilePathText.Focus(); } } }
/// <summary> /// 投稿するファイルとその投稿先を選択するためのコントロールを表示する。 /// </summary> public void BeginSelection() { if (!this.Visible) { this.BeginSelecting?.Invoke(this, EventArgs.Empty); this.Visible = true; this.Enabled = true; var media = (SelectedMedia)ImagePageCombo.SelectedItem; ImageFromSelectedFile(media.Item, true); ImagefilePathText.Focus(); } }