示例#1
0
 /// <summary>
 /// Called when the next button is clicked
 /// </summary>
 /// <param name="sender">autogenerated</param>
 /// <param name="e">autogenerated</param>
 private void NextButtonClick(object sender, RoutedEventArgs e)
 {
     if (_ui.ImportData(filePathTextbox.Text, keyPathTextBox.Text))
     {
         _parent.Navigate(new OverviewPage(_parent, _ui));
     }
     else
     {
         MessageBox.Show("Filen du valgte kunne ikke importeres", "Fejl i import", MessageBoxButton.OK);
     }
 }
示例#2
0
        private void ImportDataThread(object parameter)
        {
            Tuple <string, string> p = parameter as Tuple <string, string>;
            string filePath          = p.Item1;
            string keyPath           = p.Item2;
            Thread t = new Thread(BlinkVisibility);

            t.Name = "Blinker";
            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            if (_ui.ImportData(filePath, keyPath, _local))
            {
                Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(delegate {
                    _parent.Navigate(new PrecinctChoicePage(_parent, _ui));
                }));
                t.Abort();
            }
            else
            {
                t.Abort();
                Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(
                        delegate {
                    FlexibleMessageBox.Show(_ui._stationNativeWindow, "Could not import data from specified files.", "Import Failed", MessageBoxButtons.OK);
                }));
            }
            Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate {
                LoadingLabel.Visibility = Visibility.Hidden;
                UpdateButtons();
            }));
        }