/// <summary> /// 파일에서 PLH 정보를 읽는다. /// </summary> public void LoadPLH() { String FileName; String RLine; CPlhData LToR = new CPlhData(); LToR.m_dt.Clear(); XtraOpenFileDialog Opendlg = new XtraOpenFileDialog(); Opendlg.Filter = "PLH 파일 (*.PLH)|*.PLH|모든파일(*.*)|*.*"; Opendlg.Multiselect = true; if (Opendlg.ShowDialog() == DialogResult.OK) { foreach (string strFileName in Opendlg.FileNames) { FileName = Path.GetFileName(strFileName); using (StreamReader SR = new StreamReader(strFileName, Encoding.Default)) { while ((RLine = SR.ReadLine()) != null) { LToR.LineToRecord(FileName, RLine); } } } gridControl1.DataSource = LToR.m_dt; //MessageBox.Show(LToR.m_dt.Rows.Count.ToString()); adView1.BestFitColumns(); } }
/// <summary> /// PLD 를 불러온다. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLoadPLD_Click(object sender, EventArgs e) { String FileName; String RLine; CPldData LToR = new CPldData(); LToR.m_dt.Clear(); XtraOpenFileDialog Opendlg = new XtraOpenFileDialog(); Opendlg.Filter = "PLD 파일 (*.PLD)|*.PLD|모든파일(*.*)|*.*"; Opendlg.Multiselect = true; if (Opendlg.ShowDialog() == DialogResult.OK) { foreach (string strFileName in Opendlg.FileNames) { FileName = Path.GetFileName(strFileName); using (StreamReader SR = new StreamReader(strFileName, Encoding.Default)) { while ((RLine = SR.ReadLine()) != null) { LToR.LineToRecord(FileName, RLine); } } } gridControl8.DataSource = LToR.m_dt; adView8.BestFitColumns(); } }
private void simpleButton1_Click(object sender, EventArgs e) { XtraOpenFileDialog OFD = new XtraOpenFileDialog(); OFD.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png"; OFD.FilterIndex = 1; DialogResult resul = OFD.ShowDialog(); if (resul == DialogResult.OK) { try { AttachPath = OFD.FileName; PicLog.Image = Image.FromFile(AttachPath); } catch (Exception E) { XtraMessageBox.Show(E.Message); } } else if (resul == DialogResult.Cancel) { PicLog.Image = null; } }
private void btnOpenFile_Click(object sender, EventArgs e) { btnChonFile.Enabled = false; XtraOpenFileDialog openFileDialog = new XtraOpenFileDialog(); //openFileDialog.Filter = "Image Files(*.PNG; *.BMP; *.JPG; *.GIF)| *.PNG; *.BMP; *.JPG; *.GIF"; openFileDialog.Filter = "Excel files (*.xls or .xlsx)|.xls;*.xlsx"; // is OK openFileDialog.Multiselect = false; openFileDialog.CheckFileExists = true; openFileDialog.FilterIndex = 1; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { try { string name = openFileDialog.FileName; if (!name.Contains(".xlsx")) { XtraMessageBox.Show("File Bạn chọn không đúng định dạng excel", "Thông Báo"); } else { txtLinkFile.Text = name; } } catch (Exception ex) { XtraMessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } btnChonFile.Enabled = true; }
private void btn_restore_ItemClick(object sender, ItemClickEventArgs e) { XtraOpenFileDialog dialog = new XtraOpenFileDialog(); dialog.Title = @"Restore Database {ConfigDatabase.DATABASE}"; dialog.Filter = @"Backup File | *.bak| All files (*.*)|*.*"; if (dialog.ShowDialog() == DialogResult.OK) { string filePath = Path.GetFullPath(dialog.FileName); var dt = ExecuteQuery($@"RESTORE HEADERONLY FROM DISK = '{filePath}'"); string backupSize = FormatSize(long.Parse(dt.Rows[0]["BackupSize"].ToString())); string compressedBackupSize = FormatSize(long.Parse(dt.Rows[0]["CompressedBackupSize"].ToString())); //string databaseCreationDate = dt.Rows[0]["DatabaseCreationDate"].ToString(); string backupDescription = dt.Rows[0]["BackupDescription"].ToString(); string backupStartDate = dt.Rows[0]["BackupStartDate"].ToString(); string backupFinishDate = dt.Rows[0]["BackupFinishDate"].ToString(); string databaseName = dt.Rows[0]["DatabaseName"].ToString(); string serverName = dt.Rows[0]["ServerName"].ToString(); string recoveryModel = dt.Rows[0]["RecoveryModel"].ToString(); string collation = dt.Rows[0]["Collation"].ToString(); string message = $@"Server Name: {serverName + Environment.NewLine} <b><color=255,0,0>Database Name: {databaseName + Environment.NewLine}</color></b> BackupDescription: {backupDescription + Environment.NewLine} <b><color=blue>Backup Size: {backupSize + Environment.NewLine}</color></b> Compress Backup Size: {compressedBackupSize + Environment.NewLine} Recovery Model: {recoveryModel + Environment.NewLine} Collation: {collation + Environment.NewLine} Backup Start Date: {backupStartDate + Environment.NewLine} Backup Finish Date: {backupFinishDate}"; var xtraMess = XtraMessageBox.Show(message, "Bạn có chắc chắn muốn Restore Database không?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, DefaultBoolean.True); if (xtraMess == DialogResult.Yes) { RestoreDataBase(filePath); } } }
private void btnBrowse_Click(object sender, EventArgs e) { try { string strInputFilePath = string.Empty; XtraOpenFileDialog dlg = new XtraOpenFileDialog(); dlg.InitialDirectory = @"C:\"; dlg.Title = "Dateiauswahl für GAEB Import"; dlg.CheckFileExists = true; dlg.CheckPathExists = true; dlg.Filter = "GAEB Files(*.D81;*.D83;*.D86;*.P81;*.P83;*.P86;*.X81;*.X83;*.X86) | *.D81;*.D83;*.D86;*.P81;*.P83;*.P86;*.X81;*.X83;*.X86"; dlg.RestoreDirectory = true; if (dlg.ShowDialog() == DialogResult.OK) { txtImportFilePath.Text = dlg.FileName; } } catch (Exception ex) { Utility.ShowError(ex); } }
private void iAnhCty_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { XtraOpenFileDialog open = new XtraOpenFileDialog(); open.Title = "Open Image"; open.Filter = "Image files (*.jpg;*.jpeg,*.png)|*.JPG;*.JPEG;*.PNG"; switch (e.Button) { case MouseButtons.Left: if (iAnhCS.Image != null) { new frmXemAnh(iAnhCS.Image).ShowDialog(); } else { if (open.ShowDialog() == DialogResult.OK) { iAnhCS.Image = new Bitmap(open.FileName); } } break; case MouseButtons.Right: if (open.ShowDialog() == DialogResult.OK) { iAnhCS.Image = new Bitmap(open.FileName); } break; } }
private void btnFILE_Click(object sender, EventArgs e) { using (XtraOpenFileDialog xtraOpenFileDialog = new XtraOpenFileDialog()) { xtraOpenFileDialog.Multiselect = true; xtraOpenFileDialog.RestoreDirectory = true; if (xtraOpenFileDialog.ShowDialog() == DialogResult.OK) { txtFileDinhKem.Properties.Tokens.Clear(); var filenames = xtraOpenFileDialog.FileNames; foreach (var item in filenames) { string filename = Path.GetFileName(item); var token_item = new TokenEditToken(filename + $" [{GetFileSizeFromFileNameURL(item)}]", item); txtFileDinhKem.Properties.Tokens.Add(token_item); } try { txtFileDinhKem.EditValue = string.Join(",", filenames); txtFileDinhKem.Properties.PopupPanel = flyEmail; } catch (Exception ex) { XuLyGiaoDien.Alert(ex.Message, Form_Alert.enmType.Warning); } } } }
private void btnBrowse_Click(object sender, EventArgs e) { // Browse đến file cần import //OpenFileDialog ofd = new OpenFileDialog(); XtraOpenFileDialog ofd = new XtraOpenFileDialog(); // Lấy đường dẫn file import vừa chọn txtFilePath.Text = ofd.ShowDialog() == DialogResult.OK ? ofd.FileName : ""; //Nếu file excel không tồn tại thì ngưng ct if (!ValidInput()) { return; } // Đọc dữ liệu từ tập tin excel trả về DataTable string pro = "GetInvoiceErr"; DataTable data = new DataTable(); //Đọc dữ liệu từ file excel DataTable dt = ReadDataFromExcelFile(); //xóa bỏ dữ liệu excel cũ ClearExcelOld(); for (int i = 0; i < dt.Rows.Count; i++) { string tamp = dt.Rows[i]["makh"].ToString(); //insert data trong file excel vào bảng tạm trong sql data = GetInvoiceErr(pro, tamp); } //gridControl1.DataSource = data; }
private void Atch2ButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var _openFile = new XtraOpenFileDialog(); _openFile.FileOk += _openFile_FileOk; _openFile.ShowDialog(); }
private void BarButtonItem1_ItemClick(object sender, ItemClickEventArgs e) { var xtraOpenFileDialog = new XtraOpenFileDialog { AddExtension = true, Filter = @"图片文件| *.png;*.jpg;*.jpeg", Multiselect = true }; if (xtraOpenFileDialog.ShowDialog() == DialogResult.OK) { foreach (var fileName in xtraOpenFileDialog.FileNames) { var fileInfo = new FileInfo(fileName); var fileUploadResponse = fileInfo.UploadFile("反面样式"); SystemBackStyleApi.InsertBackStyle( fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length), fileUploadResponse.Id, result => { if (gridControl1.DataSource is List <BackStyleResponse> dataSource) { dataSource.Add(result); gridControl1.RefreshDataSource(); } }, message => { XtraMessageBox.Show("反面样式插入失败!"); }); } } }
void GetDataInExcel(bool isCT) { XtraOpenFileDialog ofd = new XtraOpenFileDialog(); ofd.Title = "Mở File"; ofd.Filter = "Excel File (*.xlsx, *.xls) | *.xlsx; *.xls"; ofd.DefaultExt = ".xlsx"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string ChuoiKetNoi = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ofd.FileName + "; Extended Properties='Excel 12.0 Xml;HDR=YES';"; using (OleDbConnection conn = new OleDbConnection(ChuoiKetNoi)) { conn.Open(); DataTable dbSchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); string CauTruyVan = "SELECT * FROM [" + dbSchema.Rows[0].Field <string>("TABLE_NAME").Replace("'", string.Empty) + ']'; OleDbDataAdapter da = new OleDbDataAdapter(CauTruyVan, conn); DataTable dt = new DataTable(); int Dong = 0; string Loi = string.Empty; da.Fill(dt); List <O_GIAODICH> lst = new List <O_GIAODICH>(); foreach (DataRow row in dt.Rows) { Dong++; if (row["MaCho"].ToString().Length > 0 && (row["TienVe"].ToString().Length + row["TienHoan"].ToString().Length) > 0 && row["TenKhach"].ToString().Length > 0) { O_GIAODICH CVJ = new O_GIAODICH(); CVJ.TenKhach = row["TenKhach"].ToString(); CVJ.MaCho = row["MaCho"].ToString().Replace(" ", string.Empty); if (long.Parse(row["TienVe"].ToString().Split('.')[0].Replace(",", string.Empty).Replace("-", string.Empty)) > 0) { CVJ.GiaNet = long.Parse(row["TienVe"].ToString().Split('.')[0].Replace(",", string.Empty).Replace("-", string.Empty)); } else { CVJ.HangHoan = long.Parse(row["TienHoan"].ToString().Split('.')[0].Replace(",", string.Empty).Replace("-", string.Empty)); } lst.Add(CVJ); } else { Loi += Dong.ToString() + ','; } } if (isCT) { GCVTCT.DataSource = lst.Where(w => w.GiaNet > 0); GCVHCT.DataSource = lst.Where(w => w.HangHoan > 0); } else { GCVTNCC.DataSource = lst.Where(w => w.GiaNet > 0); GCVHNCC.DataSource = lst.Where(w => w.HangHoan > 0); } } } }
private void Atch3ButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var _openFile = new XtraOpenFileDialog(); if (_openFile.ShowDialog() == DialogResult.OK) { atch3ButtonEdit.Text = _openFile.FileName; } Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory); }
private void CargarPlantilla() { try { using (var dialogoParaAbrir = new XtraOpenFileDialog()) { dialogoParaAbrir.Title = "Cargar ..."; dialogoParaAbrir.Filter = @"Archivos de excel (*.xlsx)|*.xlsx"; dialogoParaAbrir.FilterIndex = 2; dialogoParaAbrir.RestoreDirectory = true; if (dialogoParaAbrir.ShowDialog() != DialogResult.OK) { return; } var libroDeTrabajo = new XLWorkbook(dialogoParaAbrir.FileName); IXLWorksheet hoja; var existeHoja = false; string familiaTexto = "Familia"; var parametroUseSubFamily = Parametros.FirstOrDefault(p => p.PARAMETER_ID == Enums.GetStringValue(IdParametro.UseMaterialSubFamily) && p.GROUP_ID == Enums.GetStringValue(GrupoParametro.MaterialSubFamily)); if (parametroUseSubFamily != null && int.Parse(parametroUseSubFamily.VALUE) == (int)SiNo.Si) { familiaTexto = "Sub-familia"; } existeHoja = libroDeTrabajo.TryGetWorksheet(familiaTexto, out hoja); var listaZonaDePosicionamientos = new List <ZonaDePosicionamiento>(); if (existeHoja) { var listaDeErrores = ObtenerListaDeClasesDesdeXlsx(hoja, out listaZonaDePosicionamientos); if (listaDeErrores.Count > 0) { InteraccionConUsuarioServicio.MensajeListaDeErrorDialogo(listaDeErrores); return; } } if (listaZonaDePosicionamientos.Count == 0) { InteraccionConUsuarioServicio.Alerta("El formato del archivo es incorrecto o está vacio."); return; } UsuarioDeseaCargarPlantilla?.Invoke(null, new PosicionamientoArgumento { XmlZonaPosicionamiento = Xml.ConvertListToXml(listaZonaDePosicionamientos) }); } } catch (Exception e) { InteraccionConUsuarioServicio.Alerta($"Error al cargar la plantilla: {e.Message}"); } }
private void iLogoHang_Click(object sender, EventArgs e) { XtraOpenFileDialog open = new XtraOpenFileDialog(); open.Title = "Open Image"; open.Filter = "Image files (*.jpg;*.jpeg,*.png)|*.JPG;*.JPEG;*.PNG"; if (open.ShowDialog() == DialogResult.OK) { iLogoHang.Image = new Bitmap(open.FileName); } }
public static void initOpenFile(string strFilter, Action <string> oActionCallback, bool bMut = false) { var openFileDialog = new XtraOpenFileDialog(); openFileDialog.Filter = strFilter; openFileDialog.Multiselect = bMut; if (openFileDialog.ShowDialog() == DialogResult.OK) { var strFile = openFileDialog.FileName; oActionCallback(strFile); } }
private void ButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var dialog = new XtraOpenFileDialog(); dialog.DefaultViewMode = ViewMode.List; dialog.Filter = "Key file (*.key)|*.key"; if (dialog.ShowDialog() == DialogResult.OK) { buttonEdit1.EditValue = dialog.FileName; _fileName = dialog.FileName; } }
private void presetExecutableBrowseButton_Click(object sender, EventArgs e) { XtraOpenFileDialog dialog = new XtraOpenFileDialog(); dialog.Filter = "Executable Files (*.exe)|*.exe"; dialog.InitialDirectory = (presetExecutableText.EditValue != null && presetExecutableText.EditValue.ToString() != "" ? presetExecutableText.EditValue.ToString() : launcher.GetCurrentGame().installPath); if (dialog.ShowDialog() == DialogResult.OK) { presetExecutableText.EditValue = dialog.FileName; } }
private void btnAc_Click(object sender, EventArgs e) { XtraOpenFileDialog dialog = new XtraOpenFileDialog(); dialog.Filter = "JPG Dosyası(*.jpg)|*.jpg| BMP Dosyası(*.bmp)|*.bmp| PNG Dosyası(*.png)|*.png"; dialog.FilterIndex = 3; if (dialog.ShowDialog() == DialogResult.OK) { picFoto.Image = Image.FromFile(dialog.FileName); lblCerceve.Visible = true; } }
private void btnOpen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraOpenFileDialog dlg = new XtraOpenFileDialog(); dlg.Filter = "Excel工作簿(*.xls,*.xlsx)|*.xls;*.xlsx"; dlg.Multiselect = false; dlg.InitialDirectory = Environment.CurrentDirectory; if (dlg.ShowDialog() == DialogResult.OK) { this.txtFileName.EditValue = dlg.FileName; } }
/// <summary> /// 导入配置文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { XtraOpenFileDialog openFile = new XtraOpenFileDialog(); if (openFile.ShowDialog() == DialogResult.OK) { craftNumber.Text = openFile.FileName; XtraMessageBox.Show(craftNumber.Text); } else { } }
private void nhap(object sender, EventArgs e) { // This line of code is generated by Data Source Configuration Wizard // Fill a ExcelDataSource XtraOpenFileDialog SaveFileDialog = new XtraOpenFileDialog(); SaveFileDialog.ShowDialog(); excelDataSource1.FileName = SaveFileDialog.FileName + ".xlsx"; excelDataSource1.Fill(); gcNhanVien.DataSource = excelDataSource1; }
//Open File Image public void openFile_Image(XtraOpenFileDialog xopen, TextEdit txt, PictureEdit pic) { //string fileName = string.Empty; xopen.Filter = "Image files | *.jpg; *.jpeg; *.jpe; *.jfif; *.png"; if (xopen.ShowDialog() == DialogResult.OK) { string filename = xopen.FileName; txt.Text = filename; pic.Image = Image.FromFile(filename); pic.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.StretchVertical; } //return fileName; }
/// <summary> /// 浏览选择要安装的服务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowse_Click(object sender, EventArgs e) { XtraOpenFileDialog dialog = new XtraOpenFileDialog { FileName = this.txtPath.Text, Filter = "Windows 服务(*.exe)|*.exe|所有文件(*.*)|*.*", FilterIndex = 0 }; if (dialog.ShowDialog() == DialogResult.OK) { this.txtPath.Text = dialog.FileName; } }
private void btOpen_ItemClick(object sender, ItemClickEventArgs e) { XtraOpenFileDialog dlg = new XtraOpenFileDialog(); dlg.Filter = DataHelper.planFileFilter; dlg.Multiselect = false; dlg.ShowDialog(); if (dlg.FileName != null) { filePath = dlg.FileName; btSave.Enabled = true; plan = DataHelper.LoadPlan(filePath); } }
private void btnBrowseExe_Click(object sender, EventArgs e) { var dlg = new XtraOpenFileDialog { Title = "Select Witcher 3 Executable.", FileName = txExecutablePath.Text, Filter = "witcher3.exe|witcher3.exe" }; if (dlg.ShowDialog(this) == DialogResult.OK) { txExecutablePath.Text = dlg.FileName; } }
private void btnRestore_ItemClick(object sender, ItemClickEventArgs e) { using (XtraOpenFileDialog openFileDialog = new XtraOpenFileDialog()) { openFileDialog.InitialDirectory = Application.StartupPath + "\\data\\backup"; if (openFileDialog.ShowDialog() == DialogResult.OK) { new fRestore(openFileDialog.FileName).ShowDialog(); XtraMessageBox.Show("Chương trình sẽ tự khởi chạy lại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Restart(); Environment.Exit(0); } } }
private void btnBackup_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { XtraOpenFileDialog folderBrowser = new XtraOpenFileDialog(); folderBrowser.ValidateNames = false; folderBrowser.CheckFileExists = false; folderBrowser.CheckPathExists = true; folderBrowser.FileName = "Folder Selection."; if (folderBrowser.ShowDialog() == DialogResult.OK) { string folderPath = Path.GetDirectoryName(folderBrowser.FileName); //XtraMessageBox.Show(folderPath); XtraMessageBox.Show("Backup thành công !"); } }
private void btnChonHinh_Click(object sender, EventArgs e) { XtraOpenFileDialog open = new XtraOpenFileDialog(); PictureBox pic = this.picHocSinh as PictureBox; if (pic != null) { open.Filter = "Image Files|*.jpg;*.jpeg;*.bmp;*.png"; if (open.ShowDialog() == DialogResult.OK) { pic.Image = Image.FromFile(open.FileName); } } }
public static string LoadExcel(SpreadsheetControl spreadsheet) { //SplashScreenManager ssManger = new SplashScreenManager(); string filename = ""; try { XtraOpenFileDialog Opendlg = new XtraOpenFileDialog(); Opendlg.Filter = "EXCEL 파일 (*.xlsx)|*.xlsx|모든파일(*.*)|*.*"; if (Opendlg.ShowDialog() == DialogResult.OK) { // ssManger.ShowWaitForm(); //ProgressPanel panel = CUtil.GetProgress("Data Loading", "EXCEL 파일을 읽는 중 입니다."); //panel.Parent = this; //this.Controls.Add(panel); //panel.Show(); //panel.BringToFront(); filename = Opendlg.FileName; using (FileStream stream = new FileStream(filename, FileMode.Open)) { //progressPanel1.Parent = this; //this.Controls.Add(progressPanel1); //progressPanel1.Show(); //progressPanel1.BringToFront(); ///EXCEL DATA를 Load 한다. spreadsheet.LoadDocument(stream, DocumentFormat.Xlsx); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { // ssManger.CloseWaitForm(); } return(filename); }