private void importxml() { for (int i = 0; i < filenames.Length; i++) { textBlock.Dispatcher.Invoke(new Action(() => textBlock.Text = (string)Application.Current.Resources["m_continue"] + filenames[i])); while (!okstate) { } okstate = false; this.Dispatcher.Invoke((Action) delegate() { progressBar.Value = i + 1; contractwindow newcontract = new contractwindow(); newcontract.Owner = this; newcontract.importfrxml(filenames[i]); newcontract.numcontrtextBox.Text = (i + 1).ToString(); newcontract.ShowDialog(); }); } this.Dispatcher.BeginInvoke((Action)(() => this.Close())); }
private void autoimportxml() { for (int i = 0; i < filenames.Length; i++) { if (cancelstate) { buttonCancel.Dispatcher.Invoke(new Action(() => buttonCancel.Content = (string)Application.Current.Resources["m_cancel"])); importxmlthread.Abort(); } textBlock.Dispatcher.Invoke(new Action(() => textBlock.Text = (string)Application.Current.Resources["m_continue"] + filenames[i])); progressBar.Dispatcher.Invoke(new Action(() => progressBar.Value = i + 1)); //init ck63 = new List <coordsformat>(); wgs84 = new List <coordsformat>(); numcontrtextBoxText = (i + 1).ToString(); statuscomboBoxSelectedIndex = 0; regdatePickerSelectedDate = DateTime.Now; termleasedatePickerSelectedDate = DateTime.Now; fizoryurcomboBoxSelectedIndex = 0; lessortextBoxText = ""; inntextBoxText = ""; passporttextBoxText = ""; vidandatePickerSelectedDate = DateTime.Now; kemvidantextBoxText = ""; adresstextBoxText = ""; kodpredtextBoxText = ""; leaserfizoryurcomboBoxSelectedIndex = 0; leasertextBoxText = ""; leaserinntextBoxText = ""; leaserpassporttextBoxText = ""; leaservidandatePickerSelectedDate = DateTime.Now; leaserkemvidantextBoxText = ""; leaseradresstextBoxText = ""; leaserkodpredtextBoxText = ""; cadnumtextBoxText = ""; sqtextBoxText = ""; koatuutextBoxText = ""; formownercomboBoxSelectedIndex = 0; formusecomboBoxSelectedIndex = 0; formunitcomboBoxSelectedIndex = 0; //import bool res = false; res = importfrxml(filenames[i]); //insert if (res) { insertindb(); } else { this.Dispatcher.Invoke((Action) delegate() { contractwindow newcontract = new contractwindow(); newcontract.Owner = this; newcontract.importfrxml(filenames[i]); newcontract.numcontrtextBox.Text = (i + 1).ToString(); newcontract.ShowDialog(); }); } } this.Dispatcher.BeginInvoke((Action)(() => this.Close())); }