using DevExpress.XtraEditors; using IStation.Model; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace IStation.WinFrmUI { internal partial class ShowFileResultFrm : Form { private string _strFile; public string StrFile { get { return _strFile; } set { _strFile = value; } } /* Model.eLocalizationType _locationType = eLocalizationType.zhCN; public eLocalizationType LocationType { get { return _locationType; } set { _locationType = value; } } */ public ShowFileResultFrm() { InitializeComponent(); } public string InfoLabel { set { this.label1.Text = value + ",请问是否打开文件?"; } } private void ShowFileResultFrm_Load(object sender, EventArgs e) { /* if (_locationType == eLocalizationType.enUS) { label1.Text = "Do you open the file?"; button1.Text = "Open Folder"; button2.Text = "Open File"; button3.Text = "Cancel"; } else if (_locationType == eLocalizationType.ru) { label1.Text = "ли открыть ?"; button1.Text = "открыть папку"; button2.Text = "открыть файл"; button3.Text = "отменить"; button1.Width = 100; button2.Width = 100; button3.Width = 100; }*/ } private void button1_Click(object sender, EventArgs e) { try { string strFolder = System.IO.Path.GetDirectoryName(_strFile); System.Diagnostics.Process.Start(strFolder); } catch (Exception) { XtraMessageBox.Show("此文件夹无法打开", "打开文件错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.Close(); } private void button2_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start(_strFile); } catch (Exception) { XtraMessageBox.Show("此文件无法打开" , "打开文件错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.Close(); } private void button3_Click(object sender, EventArgs e) { this.Close(); } } public class FileMessageBox { public FileMessageBox() { } public static void Show(string strFile) { ShowFileResultFrm frm = new ShowFileResultFrm(); //frm.LocationType = eLocalizationType.zhCN; frm.StrFile = strFile; frm.ShowDialog(); } //public static void Show(string strFile,eLocalizationType locationType) //{ // ShowFileResultFrm frm = new ShowFileResultFrm(); // //frm.LocationType = locationType; // frm.StrFile = strFile; // frm.ShowDialog(); //} } }