コード例 #1
0
 private void checkedFiles(object sender, RoutedEventArgs e)
 {
     try
     {
         ItemProvider.GetCheckedFileInfoList((List <Item>)DataContext);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #2
0
        internal void showBackupTreeView(BackupRecord backupRecord)
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                //show loading
                window.BackupViewProgressBar.Visibility = Visibility.Visible;

                window.DataContext = ItemProvider.GetItems(backupRecord, @"\");

                //hide loading
                window.BackupViewProgressBar.Visibility = Visibility.Hidden;
            }));
        }
コード例 #3
0
        /*
         *  retreive only selected files
         */
        private async void getSelectedBackupFiles(object sender, RoutedEventArgs e)
        {
            try
            {
                advancedGetBackupButton.IsEnabled = false;

                //done as first operation to avoid immediate change of DataContext selecting another backup
                List <myFileInfo> selectedFiles = ItemProvider.GetCheckedFileInfoList((List <Item>)DataContext);

                if (selectedFiles.Count <= 0)
                {
                    advancedGetBackupButton.IsEnabled = true;
                    return;
                }

                //some process is running in background...
                if (Interlocked.Read(ref backgroundRunning) == TRUE)
                {
                    showAlertDialog(ALERT_DIALOG_TITLE, ALERT_DIALOG_MESSAGE);
                    return;
                }

                bool result = await showConfirmDialog("Ripristino file...", "Sei sicuro di voler ripristinare " + selectedFiles.LongCount <myFileInfo>() + " file?");

                if (result)
                {
                    await Task.Run(() => retreiveBackupFilesTask(selectedFiles));

                    Task.Run(() => updateBackupList());
                }
            }
            catch (Exception ex)
            {
                //update UI
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    UpdateProgressText.Text = "Errore nella selezione dei file";
                }));
            }

            advancedGetBackupButton.IsEnabled = true;
        }