//********************************methods for handling the view******************************** //handle exception private void mainWindow_Exception() { if (FileRestorePanel.InvokeRequired) { setSnapTimer = new SetSnapTimer(mainWindow_Exception); this.Invoke(setSnapTimer); } else { MessageBox.Show("The connection with the server has been lost, for consistency reason, logOut needs to be executed.", "Error: Connection Lost"); Dispose(); Close(); login.Show(); } }
/*Show the list of previous file*/ internal void showVersionList() { if (FileVersionpanel.InvokeRequired) { setSnapTimer = new SetSnapTimer(showVersionList); this.Invoke(setSnapTimer); } else { RestoreFileVersion.ForeColor = System.Drawing.SystemColors.ButtonShadow; List <string> oldVersion = null; oldVersion = hc.getList(Program.VERSION_LIST); FileRestorePanel.Visible = false; FileVersionpanel.Visible = true; if (oldVersion.Count != 0) { VersionlistView.Items.Clear(); FileToBeRestoredLabel.Text = fileToBeRestored; ListViewItem vItem = null; foreach (string version in oldVersion) { vItem = new ListViewItem(version, 0); vItem.Name = version; VersionlistView.Items.Add(vItem); } VersionlistView.Refresh(); } else { VersionlistView.Refresh(); if (MessageBox.Show("The specified file has no other versions available", "No further versions") == DialogResult.OK) { VersionlistView.Items.Clear(); FileToBeRestoredLabel.Text = string.Empty; backFromVersionPanel(); } } if (!FileVersionpanel.Visible) { FileVersionpanel.Visible = true; } } }
/*This method come back from the snapshot panel and update the view*/ private void backFromLastSnapshot() { if (SnapshotPanel.InvokeRequired) { setSnapTimer = new SetSnapTimer(backFromLastSnapshot); this.Invoke(setSnapTimer); } else { backupNotFound = false; path = m.getBackupPath(); populatelist(path); SnapshotPanel.Visible = false; FileRestorePanel.Visible = true; defaultPanel.Visible = false; deletedPanel.Visible = false; FileVersionpanel.Visible = false; } }