Beispiel #1
0
 private void forceStop()
 {
     bStop.IsEnabled    = false;
     bSyncNow.IsEnabled = false;
     ControlloModifiche.StopTimer();
     bStart.IsEnabled     = true;
     tDirectory.IsEnabled = true;
     tTimeout.IsEnabled   = true;
     bBrowse.IsEnabled    = true;
     tAddress.IsEnabled   = true;
     tPort.IsEnabled      = true;
 }
Beispiel #2
0
        private void lDeletedFileVersions_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DependencyObject obj = (DependencyObject)e.OriginalSource;

            while (obj != null && obj != lDeletedFiles)
            {
                if (obj.GetType() == typeof(System.Windows.Controls.ListViewItem))
                {
                    DateTime deletedVersion = ((FileVersionListViewItem)lDeletedFileVersions.SelectedItem).sTimestamp;

                    foreach (DateTime fv in deletedFileUtente.Items)
                    {
                        if (deletedVersion == fv)
                        {
                            deletedFileVersion = fv;
                        }
                    }

                    MessageBoxResult res = System.Windows.MessageBox.Show("Do you want to restore file \"" + deletedFileUtente.Nome + "\" with version " + deletedVersion + " ?", "Restore system", System.Windows.MessageBoxButton.YesNo);

                    if (res == MessageBoxResult.Yes)
                    {
                        try
                        {
                            if (Command.Logged == true)
                            {
                                ControlloModifiche.StopTimer();
                                Command getVersComm = new ComandoScaricaFile(deletedFileUtente.Nome, deletedFileUtente.Path, deletedFileVersion);
                                getVersComm.esegui();
                                this.GetDelFiles();
                                ControlloModifiche.Inizializza();
                            }
                            else
                            {
                                Command loginComm = new ComandoLogin(connectionSettings.readSetting("account", "username"), connectionSettings.readSetting("account", "password"));
                                loginComm.esegui();
                            }
                        }
                        catch (ServerException ex)
                        {
                            System.Windows.MessageBox.Show("Restore failed\n" + ex.Message, "Restoring system", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    break;
                }
                obj = VisualTreeHelper.GetParent(obj);
            }
        }