private void sBOLToolStripMenuItem_Click(object sender, EventArgs e) { if (this.newBD.str_brick_name == null) { // 정보를 입력하라고 해서 정보를 입력하게 되면 SBOL을 출력시켜야 한다. MessageBox.Show("Please enter information."); Form_Save fs1 = new Form_Save(this, 1); fs1.ShowDialog(); } SaveFileDialog _sfd = new SaveFileDialog(); _sfd.Filter = "SBOL files (*.SBOL)|*.SBOL"; _sfd.FileName = this.newBD.str_brick_name; _sfd.Title = "Save"; if (_sfd.ShowDialog() == DialogResult.OK) { if (this.newBD.sl_subpart_list.Count > 0) { StreamWriter sw = new StreamWriter(Path.Combine(Directory.GetCurrentDirectory(), "SBOLSTARTFILE.txt")); sw.WriteLine("http://partsregistry.org/Part:" + this.newBD.str_brick_name); sw.WriteLine(this.newBD.str_brick_name); if (this.newBD.str_brick_name.Contains("_") == true) { sw.WriteLine((this.newBD.str_brick_name.Split('_'))[1]); } else { sw.WriteLine(this.newBD.str_brick_name); } sw.WriteLine(this.newBD.str_brick_desc); foreach (Brick_sub_data _bsd in this.newBD.sl_subpart_list.Values) { sw.Write(_bsd.part_seq); } sw.WriteLine(Environment.NewLine); int i = 0; foreach (Brick_sub_data bsd in this.newBD.sl_subpart_list.Values) { if (bsd.part_type != "Scar") { i++; } } sw.WriteLine(i); foreach (Brick_sub_data bsd in this.newBD.sl_subpart_list.Values) { if (bsd.part_type != "Scar") { sw.WriteLine("http://partsregistry.org/Part:" + bsd.part_name); sw.WriteLine(bsd.part_name); if (bsd.part_name.Contains("_") == true) { sw.WriteLine((bsd.part_name.Split('_'))[1]); } else { sw.WriteLine(bsd.part_name); } sw.WriteLine(bsd.part_desc); } } sw.Close(); str_SBOL_filename = _sfd.FileName; } _pro.Start(); } }
/// <summary> /// 세이브 버튼 눌렀을 경우 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void savetoolStripMenuItem1_Click(object sender, EventArgs e) { // 현재 정보가 없으면 "저장할 정보를 입력하세요" // 그냥 닫으면 저장창이 뜨지 않고 // OK누르면 저장창이 뜨기 if (this.newBD.str_brick_name == null && this.newBD.sl_subpart_list.Count == 0) { // 현재 브릭 정보와 서브정보가 없으니 // 저장할 정보가 없다. MessageBox.Show("There is NO data to save."); } else if (this.newBD.str_brick_name == null && this.newBD.sl_subpart_list.Count > 0) { // 서브 정보는 있는데 이름 정보가 없으니 창 띄어주고 data save 함수 호출 MessageBox.Show("Please enter information."); Form_Save fs1 = new Form_Save(this, 2); fs1.ShowDialog(); } else if (this.newBD.str_brick_name != null && this.newBD.sl_subpart_list.Count == 0) { MessageBox.Show("There is NO data to save."); } else { this.data_save(); } }
/************************************************************************/ /* */ /************************************************************************/ /// <summary> /// New 버튼 눌렀을 경우 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void newToolStripMenuItem_Click(object sender, EventArgs e) { // 현재 데이터를 편집중이었다면 저장하시겠습니까? // 예스 - 저장 // 노 - 데이터 리셋, 이름 저장 if (this.newBD.sl_subpart_list.Count > 0) { // 정보를 저장하기 원하면 if (MessageBox.Show("Do you want to save current data?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) { // 데이터가 있으면 if (this.newBD.str_brick_name == null) { MessageBox.Show("Please enter information."); Form_Save fs1 = new Form_Save(this, 2); fs1.ShowDialog(); } else { this.data_save(); } } else { this.newBD = new Brick_data(); Form_Save fs1 = new Form_Save(this, 1); fs1.ShowDialog(); paint_BrickData(); paint_Circle(); paint_linear_Seq(); listbox_from_BrickData(); } } else // 정보가 없으면 { this.newBD = new Brick_data(); Form_Save fs1 = new Form_Save(this, 1); fs1.ShowDialog(); paint_BrickData(); paint_Circle(); paint_linear_Seq(); listbox_from_BrickData(); } }
/// <summary> /// 로드 버튼 눌렀을 경우 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void loadtoolStripMenuItem1_Click(object sender, EventArgs e) { // 현재 아무것도 없을경우 if (this.newBD.str_brick_name == null && this.newBD.sl_subpart_list.Count == 0) { data_load(); this.paint_BrickData(); this.paint_linear_Seq(); this.listbox_from_BrickData(); } // 현재 정보는 없지만 데이터는 있는 경우 else if (this.newBD.str_brick_name == null && this.newBD.sl_subpart_list.Count > 0) { // 정보를 저장하시겠습니까? if (MessageBox.Show("Do you want to save current data?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) { // 저장한다면 MessageBox.Show("Please enter information."); Form_Save fs1 = new Form_Save(this, 2); fs1.ShowDialog(); } data_load(); this.paint_BrickData(); this.paint_linear_Seq(); this.listbox_from_BrickData(); } // 현재 정보도 있고 데이터도 있는 경우 else if (this.newBD.str_brick_name != null && this.newBD.sl_subpart_list.Count > 0) { if (MessageBox.Show("Do you want to save current data?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) { data_save(); } data_load(); this.paint_BrickData(); this.paint_linear_Seq(); this.listbox_from_BrickData(); } else { // 정보는 있찌만 데이터가 없는경우 data_load(); this.paint_BrickData(); this.paint_linear_Seq(); this.listbox_from_BrickData(); } }
private void genbankToolStripMenuItem_Click(object sender, EventArgs e) { if (this.newBD.sl_subpart_list.Count > 0) { if (this.newBD.str_brick_name == null) { MessageBox.Show("Please enter information."); Form_Save fs1 = new Form_Save(this, 1); fs1.ShowDialog(); } export_GenBank(); } else { MessageBox.Show("There is no Data to save."); } }
/************************************************************************/ /* */ /************************************************************************/ /// <summary> /// New 버튼 눌렀을 경우 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void newToolStripMenuItem_Click(object sender, EventArgs e) { // 현재 데이터를 편집중이었다면 저장하시겠습니까? // 예스 - 저장 // 노 - 데이터 리셋, 이름 저장 if (this.newBD.sl_subpart_list.Count > 0) { // 정보를 저장하기 원하면 if (MessageBox.Show("현재 정보를 저장하시겠습니까?", "저장", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) { // 데이터가 있으면 if (this.newBD.str_brick_name == null) { MessageBox.Show("정보를 입력하세요."); Form_Save fs1 = new Form_Save(this, 2); fs1.ShowDialog(); } else { this.data_save(); } } else { this.newBD = new Brick_data(); Form_Save fs1 = new Form_Save(this, 1); fs1.ShowDialog(); } } else // 정보가 없으면 { this.newBD = new Brick_data(); Form_Save fs1 = new Form_Save(this, 1); fs1.ShowDialog(); } }