private void VagrantWrapper_OnOutputMessageReceived(object _, VagrantMessageEventHandler e) { this.SafeInvoke(() => { if (string.IsNullOrEmpty(e.Message)) { return; } //非同期なのでWaitForExitが終わってからここが書かれるケースもある consoleTextBox.HideSelection = false; consoleTextBox.AppendText(e.Message + Environment.NewLine); var vagrantData = new VagrantData(); if (vagrantData.GetVagrantDataParseCommandLine(e.Message)) { UpdaetVagrantData(vagrantData); } var vagrantBoxData = new VagrantBoxData(); if (vagrantBoxData.GetVagrantBoxDataParseCommandLine(e.Message)) { UpdaetVagrantBoxData(vagrantBoxData); } removeButton.Enabled = (_vagrantBoxDatas.Count > 0); initButton.Enabled = (_vagrantBoxDatas.Count > 0); }); }
public void VagrantDBoxataの追加処理() { var data = new VagrantBoxData(); data.Name = "default"; _vagrantBoxDatas.Add(data); Assert.IsTrue(_vagrantBoxDatas[0].Name == data.Name); }
private void UpdaetVagrantBoxData(VagrantBoxData vagrantBoxData) { //既に名前があれば更新、なければ追加 var hit = _vagrantBoxDatas.SingleOrDefault(v => v.Name == vagrantBoxData.Name); if (hit != null) { hit.Provider = vagrantBoxData.Provider; } else { _vagrantBoxDatas.Add(vagrantBoxData); } vagrantBoxDataGridView.Invalidate(); vagrantBoxDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); }
private void BoxListForm_Load(object sender, EventArgs e) { var rawText = ""; Task.Run(() => { using (var wc = new WebClient()) { try { using (var st = wc.OpenRead(Resources.BentoReadmeRawURL)) { if (st == null) { return; } using (var sr = new StreamReader(st)) { rawText = sr.ReadToEnd(); } } } //OpenRead失敗時のエラーメッセージ catch (Exception ex) { MessageBox.Show(ex.Message); } } }).ContinueWith(t => { if (rawText != "") { var lines = rawText.Replace(Environment.NewLine, "\n").Split('\n'); foreach (var line in lines.Where(x => x.Contains("* "))) { var data = new VagrantBoxData(); if (data.GetVagrantBoxDataParseBentoFile(line)) { _vagrantBoxDatasDatas.Add(data); } } vagrantBoxDataGridView.Invalidate(); vagrantBoxDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
private void BoxListForm_Load(object sender, EventArgs e) { var rawText = ""; Task.Run(() => { using (var wc = new WebClient()) { try { using (var st = wc.OpenRead(Resources.BentoReadmeRawURL)) { if (st == null) return; using (var sr = new StreamReader(st)) { rawText = sr.ReadToEnd(); } } } //OpenRead失敗時のエラーメッセージ catch (Exception ex) { MessageBox.Show(ex.Message); } } }).ContinueWith(t => { if (rawText != "") { var lines = rawText.Replace(Environment.NewLine, "\n").Split('\n'); foreach (var line in lines.Where(x => x.Contains("* "))) { var data = new VagrantBoxData(); if (data.GetVagrantBoxDataParseBentoFile(line)) { _vagrantBoxDatasDatas.Add(data); } } vagrantBoxDataGridView.Invalidate(); vagrantBoxDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } }, TaskScheduler.FromCurrentSynchronizationContext()); }