- Honor Magic6 Pro - kör közepén számok
- Januárban csak az Apple tudott érdemben növekedni Kínában
- Milyen okostelefont vegyek?
- Okosóra és okoskiegészítő topik
- iPhone topik
- Apple iPhone 17 Pro Max – fennsík
- Fotók, videók mobillal
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Szívós, szép és kitartó az új OnePlus óra
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
Új hozzászólás Aktív témák
-
ubid
senior tag
válasz
sztanozs
#3713
üzenetére
nem.
A kód a következő :
BTN eseménye :
private void ImportBtnClick(object sender, RoutedEventArgs e)
{
if (AutomationFactory.IsAvailable)
{
if (InitializeExcel())
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Excel workbook (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm|All files|*.*";
openFileDialog.ShowDialog();
FileInfo fileInfo = openFileDialog.File;
if (fileInfo != null)
{
tbMessages.Text = "The processing may take several minutes. Please wait...\n";
btnImporter.IsEnabled = false;
DoBackGroundWork(fileInfo);
}
}
else
{
MessageBox.Show("Excel is not available.");
}
}
else
{
MessageBox.Show("Automation is not available.");
}
}Ez hívja ugye a DoBackGroundWork -öt :
public FileInfo fileNameProperty { get; set; }
private void DoBackGroundWork(FileInfo f)
{
BackgroundWorker worker = new BackgroundWorker();
fileNameProperty = f;
worker.WorkerReportsProgress = true;
worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
worker.RunWorkerAsync(fileNameProperty);
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
btnImporter.IsEnabled = true;
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
int totalSteps = 30;
FileInfo file = e.Argument as FileInfo;
ProcessExcelSheet(file);
for (int i = 1; i <= totalSteps; i++)
{
///.......
}
}
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar.Value = e.ProgressPercentage;
}És ugye a ProcessExcelSheet dolgozik sokáig...
Az pedig így néz ki :private void ProcessExcelSheet(FileInfo File)
{
Object missingValue = System.Reflection.Missing.Value;
bool errorHappened = false;
dynamic workbook = excel.Workbooks.Open(File.FullName);
try
{
...............
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Gigabyte B560M DS3H V2 alaplap, i5-10400 CPU, 256 GB M.2 SSD, Windows 11
- Újszerű MSI RAIDER GE66 12UH 15.6QHD IPS 240Hz i7-12700H 32GB DDR5 RAM 1TB NVME SSD RTX 3080 175w
- Apple Ipad Pro 11 M2 2022 Space Gray 128gb Wifi+Cellular 1 év garancia
- ASUS ROG STRIX G15 Gaming Laptop - Ryzen 7, 16 GB RAM, RTX 3050 Ti, 512 GB SSD
- Kenwood KR A4010
- Garmin Forerunner 405 GPS óra
- Keresünk Galaxy S22/S22+/S22 Ultra
- Új HP 17 FHD IPS AMD Ryzen5 7520U 4.3Ghz 8GB DDR5 256GB SSD AMD Radeon 610M Graphics Win11 Garancia
- Bomba ár! Lenovo ThinkPad X390: i7-G8 I 16GB I 512SSD I 13,3" FHD Touch I HDMI I Cam I W11 I Gar
- iPhone 17 Pro 256 GB Silver - Bontatlan !! www.stylebolt.hu - Apple eszközök - Számlás
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs


