- AMD Navi Radeon™ RX 9xxx sorozat
- Milyen monitort vegyek?
- Gépösszerakó topik kezdőknek
- Azonnali notebookos kérdések órája
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Amlogic S905, S912 processzoros készülékek
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- NVIDIA GeForce RTX 5060 Ti (GB206)
- RAM topik
- DUNE médialejátszók topicja
Ú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!
- CONTAX ZEISS AUTOFÓKUSZOS OBJEKTÍVEK SoNY E vázakhoz
- PRÉMIUM switchek - billentyűzet kapcsolók - TÖBBFÉLE (linear, tactile, silent, clicky)
- Honor Pad X8a 64GB, Újszerű, 1 Év Garanciával
- MakulátlanGaranciális MSI Cyborg GAMER 15,6"144Hz!i5 13420H(12X4,6Ghz)RTX 4050 6GB VGA,16GB DDR5 RAM
- LG OLED evo C2 65 4K TV Media Markt Garancia
- Telefon felvásárlás!! Xiaomi Redmi 9, Xiaomi Redmi 9AT, Xiaomi Redmi 10, Xiaomi Redmi 10 2022
- MikroTik CCR1009-7G-1C-1S+ Cloud Router
- Update 07.18. Bomba árak 2025-ben is! Üzleti - Consumer laptopok DELL FUJITSU HP LENOVO
- HP Series 3 Pro FHD monitor Professzionális képminőség otthonra vagy irodába!
- DELL Universal Dock D6000 docking station (452-BCYH) (DisplayLink)
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest