Exemplo n.º 1
0
        private void StartSync_Click(object sender, EventArgs e)
        {
            // start the sync manager
            try
            {
                // Save settings
                connectionSettings.writeSetting("connection", "address", tAddress.Text);
                connectionSettings.writeSetting("connection", "port", tPort.Text);
                connectionSettings.writeSetting("account", "directory", tDirectory.Text);
                connectionSettings.writeSetting("connection", "syncTime", tTimeout.Text);

                bStart.IsEnabled = false;
                lDetails.Items.Clear();
                lFileVersions.Items.Clear();
                lDeletedFiles.Items.Clear();
                lDeletedFileVersions.Items.Clear();
                ControlloModifiche.Inizializza();
                this.GetFiles();
                this.GetDelFiles();
                bStop.IsEnabled      = true;
                bSyncNow.IsEnabled   = true;
                tDirectory.IsEnabled = false;
                tTimeout.IsEnabled   = false;
                bBrowse.IsEnabled    = false;
                tAddress.IsEnabled   = false;
                tPort.IsEnabled      = false;
                updateStatus("Started");
            }
            catch (Exception ex) when(ex is ServerException || ex is ClientException)
            {
                bStart.IsEnabled = true;
                updateStatus(ex.Message);
            }
        }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
 private void bSyncNow_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ControlloModifiche.Check();
     }
     catch (ServerException exc)
     {
         System.Windows.MessageBox.Show("Syncronization failed\n" + exc.Message, "Syncronization system", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     this.GetFiles();
     this.GetDelFiles();
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
 private void bBackup_Click(object sender, RoutedEventArgs e)
 {
     //Thread t = new Thread(ControlloModifiche.RestoreAsLastStatusOnServer);
     //t.Start();
     ControlloModifiche.RestoreAsLastStatusOnServer();
 }