private void UpgradeProgress(int value) { if (this.prgUpgrade.InvokeRequired) { Delegate d = new OperationProgressDelegate(UpgradeProgress); this.Invoke(d, new Object[] { value }); } else { this.prgUpgrade.Value = value; if (this.prgUpgrade.Value == this.prgUpgrade.Maximum) { this._upgrader = null; this.ShowDatabaseInformation(); MessageBox.Show("Upgrade Completed successfully!"); } } }
private void UpgradeError(Exception ex) { if (this.InvokeRequired) { Delegate d = new OperationErrorDelegate(UpgradeError); this.Invoke(d, new Object[] { ex }); } else { MessageBox.Show("An error occurred while trying to perform the Upgrade:\n" + ex.Message); this.ShowDatabaseInformation(); this._upgrader = null; } }
private void btnUpgradeStore_Click(object sender, EventArgs e) { if (this._upgrader == null) { if (MessageBox.Show("Are you sure you wish to Upgrade the current Store to the latest dotNetRDF Store Format? This format will has better performance but this action cannot be reversed - do you still wish to proceed?", "Confirm Store Upgrade", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.prgUpgrade.Value = 0; this._upgrader = new StoreUpgrader(this._connection); if (this._upgrader.UpgradeRequired) { this.prgUpgrade.Maximum = this._upgrader.OperationsRequired(); this._upgrader.Progress += this.UpgradeProgress; this._upgrader.Error += this.UpgradeError; if (MessageBox.Show("Ready to begin Upgrade, please click OK to begin", "Confirm Upgrade", MessageBoxButtons.OKCancel) == DialogResult.OK) { this.btnUpgradeStore.Enabled = false; this._upgrader.Upgrade(); } else { this._upgrader = null; } } else { MessageBox.Show("No Upgrade of this Store is required", "Upgrade Store Not Required", MessageBoxButtons.OK, MessageBoxIcon.Information); this.btnUpgradeStore.Enabled = false; this._upgrader = null; } } } }