コード例 #1
0
 void toolStripButtonSave_Click(object sender, EventArgs e)
 {
     if (AllForms.ShowStaticSaveDialogForText(this) == DialogResult.OK)
     {
         using (StreamWriter sw = new StreamWriter(AllForms.m_dlgSave.FileName))
         {
             sw.Write(richTextBox1.Text);
         }
     }
 }
コード例 #2
0
ファイル: frmLog.cs プロジェクト: pickerel/watintestrecord
 private void tsBtnSaveLog_Click(object sender, EventArgs e)
 {
     if (AllForms.ShowStaticSaveDialogForText(this) == DialogResult.OK)
     {
         using (StreamWriter sw = new StreamWriter(AllForms.m_dlgSave.FileName))
         {
             sw.Write(txtLog.Text);
         }
     }
 }
コード例 #3
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         //Save as text
         if (AllForms.ShowStaticSaveDialogForText(this) == DialogResult.OK)
         {
             using (StreamWriter sw = new StreamWriter(AllForms.m_dlgSave.FileName))
             {
                 sw.Write(txtDocInfo.Text);
             }
         }
     }
     catch (Exception ee)
     {
         AllForms.m_frmLog.AppendToLog("frmDocInfo::saveToolStripMenuItem_Click\r\n" + ee.ToString());
     }
 }
コード例 #4
0
 private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     //Clear completed - Save download list
     if (e.ClickedItem.Name == tsCloseDownload.Name)
     {
         this.Hide();
     }
     else if (e.ClickedItem.Name == this.tsSave.Name)
     {
         if (AllForms.ShowStaticSaveDialogForText(this) == DialogResult.OK)
         {
             string tmp = "====================\r\nDownload Date: ";
             tmp += DateTime.Today.ToLongDateString();
             tmp += "\r\nDownload From: {0}\r\nDownload To: {0}\r\nFile Size: {0} Bytes\r\n====================\r\n";
             using (StreamWriter sw = new StreamWriter(AllForms.m_dlgSave.FileName, true))
             {
                 try
                 {
                     DLIDS id = new DLIDS();
                     FileDownloadStatusCtl ctl = null;
                     foreach (Control item in flowLayoutPanel1.Controls)
                     {
                         if (item.Tag == null) //first one
                         {
                             continue;
                         }
                         id = (DLIDS)item.Tag;
                         if (id.DlDone)
                         {
                             ctl = (FileDownloadStatusCtl)item;
                             if (ctl == null)
                             {
                                 return;
                             }
                             //Date - From - To - filesize
                             sw.Write(
                                 string.Format(tmp,
                                               ctl.lblFrom.Text,
                                               ctl.lblTo.Text,
                                               id.FileSize.ToString())
                                 );
                         }
                     }
                 }
                 catch (Exception)
                 {
                     throw;
                 }
             }
         }
     }
     else if (e.ClickedItem.Name == this.tsClearFinished.Name)
     {
         try
         {
             DLIDS id = new DLIDS();
             Control.ControlCollection col = flowLayoutPanel1.Controls;
             foreach (Control item in col)
             {
                 if (item.Tag == null) //first one
                 {
                     continue;
                 }
                 id = (DLIDS)item.Tag;
                 if (id.DlDone)
                 {
                     flowLayoutPanel1.Controls.Remove(item);
                     break;
                 }
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
 }