| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- namespace Core.LgMes.Client.LgIntegrationQuery
- {
- public partial class frmBrowseOperateRule_Doc : Core.Mes.Client.Common.frmStyleBase
- {
- public string strUrl = "";
- //public string strFileType = "";
- //public byte[] fileBytes = new byte[1024];
- //public string strSafeFileName;
- public frmBrowseOperateRule_Doc()
- {
- InitializeComponent();
- }
- private void frmBrowseOperateRule_Doc_Load(object sender, EventArgs e)
- {
- //strSafeFileName = strUrl.Substring(strUrl.LastIndexOf(@"\") + 1);
- ////System.IO.Stream st =null ;
- ////st.(fileBytes, 0, 1024);
- //System.IO.FileStream fileStream = new FileStream(strSafeFileName, FileMode.Create);
- //fileStream.Seek(0, SeekOrigin.Begin);
- //fileStream.Write(fileBytes, 0, fileBytes.Length);
- //System.IO.MemoryStream userInput = new MemoryStream();
- //userInput.Position = 0;
- //userInput.WriteTo(fileStream);
- //fileStream.Close();
- //System.IO.Stream stream = new MemoryStream(fileBytes);
- //try
- //{
- // if (strFileType == "doc" || strFileType == "rtf")
- // {
- // richTextBox1.LoadFile(strUrl.Replace("doc", "rtf"), RichTextBoxStreamType.RichText);
- // //fileStream.Position = 0;
- // //richTextBox1.LoadFile(fileStream, RichTextBoxStreamType.PlainText);
- // }
- // else if (strFileType == "txt")
- // richTextBox1.LoadFile(strUrl, RichTextBoxStreamType.PlainText);
- //}
- //catch { }
- try
- {
- if (this.strUrl.Trim().Length == 0) return;
- if (File.Exists(strUrl))
- this.webBrowser1.Url = new Uri(strUrl);
- else
- this.webBrowser1.Navigate("about:blank");
- }
- catch (Exception ex)
- {
- this.webBrowser1.Navigate("about:blank");
- MessageBox.Show(ex.Message);
- }
- }
- private void frmBrowseOperateRule_Doc_FormClosed(object sender, FormClosedEventArgs e)
- {
- try
- {
- //if (strFileType == "doc" || strFileType == "rtf")
- //{
- // System.IO.File.Delete(@strUrl.Replace("doc", "rtf"));
- //}
- //else if (strFileType == "txt")
- // System.IO.File.Delete(@strUrl);
- this.webBrowser1.Navigate("about:blank");
- if (File.Exists(strUrl))
- File.Delete(strUrl);
- }
- catch { }
- finally
- {
- this.webBrowser1.Navigate("about:blank");
- if (File.Exists(strUrl))
- File.Delete(strUrl);
- }
- }
- }
- }
|