public BackupMain(ICommunication comm)
        {
            communication = comm;


            Dialoges  = new BackupDialoges();
            Templates = new TemplateHandler(comm);
            Backup    = new ExecuteBackup(comm);
            Restore   = new RestoreBackup(comm);
        }
Esempio n. 2
0
        public void RestoreNode(TreeNode n)
        {
            if (n == null || n.Tag as Schedule == null)
            {
                return;
            }

            Schedule s = n.Tag as Schedule;

            RestoreBackup dlg = new RestoreBackup();

            dlg.Setup(s);
            dlg.ShowDialog(this);
        }
Esempio n. 3
0
        private void TsmiBackupRestore_Click(object sender, EventArgs e)
        {
            if (UnsavedChanges && !EnsureSaved())
            {
                return;
            }

            using (OpenFileDialog dialog = new OpenFileDialog
            {
                Title = Words.OpenBackup,
                Filter = Words.VocupBackupFile + " (*.vdp)|*.vdp",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
            })
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    using (RestoreBackup restore = new RestoreBackup(dialog.FileName))
                        restore.ShowDialog();
                }
            }
        }
Esempio n. 4
0
        private static void Main(string[] args)
        {
            // Prevents the installer from executing while the program is running
            mutex = new Mutex(initiallyOwned: true, AppInfo.ProductName, out bool createdNew);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!createdNew)
            {
                // Another instance of Vocup is already running so we change the focus
                SwitchFocus();
                return;
            }

            SplashScreen splash = new SplashScreen();

            splash.Show();
            Application.DoEvents();

            if (Settings.Default.StartupCounter == 0)
            {
                Settings.Default.Upgrade(); // Keep old settings with new version
            }
            // Warning: Unsaved changes are overridden

            SetCulture();
            if (!CreateVhfFolder() || !CreateVhrFolder())
            {
                Application.Exit();
                return;
            }

            Settings.Default.StartupCounter++;
            Settings.Default.Save();
            Application.DoEvents();

            Form form;

            if (args.Length > 0 && !string.IsNullOrWhiteSpace(args[0]))
            {
                FileInfo info = new FileInfo(args[0]);
                if (info.Extension == ".vhf")
                {
                    var mainForm = new MainForm();
                    mainForm.ReadFile(info.FullName);
                    form = mainForm;
                }
                else if (info.Extension == ".vdp")
                {
                    form = new RestoreBackup(info.FullName);
                }
                else
                {
                    form = new MainForm();
                    MessageBox.Show(string.Format(Messages.OpenUnknownFile, info.FullName),
                                    Messages.OpenUnknownFileT, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (Settings.Default.StartScreen == (int)StartScreen.LastFile && File.Exists(Settings.Default.LastFile))
            {
                var mainForm = new MainForm();
                mainForm.ReadFile(Settings.Default.LastFile);
                form = mainForm;
            }
            else
            {
                form = new MainForm();
            }

            Application.DoEvents();

            splash.Close();
            Application.Run(form);
        }
Esempio n. 5
0
        public void RestoreNode(TreeNode n)
        {
            if (n == null || n.Tag as Schedule == null)
                return;

            Schedule s = n.Tag as Schedule;

            RestoreBackup dlg = new RestoreBackup();
            dlg.Setup(s);
            dlg.ShowDialog(this);
        }