public void DragDrop_CopyDatabase(AppObject draggingObject) { var conn = this.FindServerConnection(); if (draggingObject is DatabaseAppObject) { try { IDatabaseSource dsource = ((DatabaseAppObject)draggingObject).FindDatabaseConnection(); var dbprops = new DatabaseProperties(); dbprops.Name = dsource.DatabaseName; DatabasePropertiesForm.Run(dbprops, new GenericDatabaseSource(conn, conn.Connection, null), false); //string newname = InputBox.Run(Texts.Get("s_name_of_new_database"), dsource.DatabaseName); //if (newname == null) return; if (ArrayTool.Contains(conn.Databases, dbprops.Name)) { StdDialog.ShowError(Texts.Get("s_database_allready_exists")); return; } IDatabaseSource newdb = conn.CreateDatabase(dbprops.Name, dbprops.SpecificData); CopyDbWizard.Run(dsource.CloneSource(), newdb.CloneSource()); //CopyDbProcess.StartProcess(dsource.CloneSource(), newdb.CloneSource(), null); } catch (Exception e) { Errors.Report(e); } } }
private void rbtOverride_CheckedChanged(object sender, EventArgs e) { tbxPriority.Enabled = addonSelectFrame1.Enabled = rbtOverride.Checked; if (!rbtOverride.Enabled) { return; } if (m_machineChangingOverride) { return; } if (rbtOverride.Checked && m_dashboard.IsInLibDirectory()) { m_dashboard.RedirectToCfgDirectory(); } if (rbtUseDefault.Checked && m_dashboard.IsInCfgDirectory()) { if (StdDialog.YesNoDialog("s_this_action_will_delete_your_own_settings_continue")) { if (m_dashboard.IsInCfgDirectory()) { File.Delete(m_dashboard.AddonFileName); } m_dashboard.RedirectToLibDirectory(); ((IAddonInstance)m_dashboard).LoadFromFile(m_dashboard.AddonFileName); ReloadProps(); } else { m_machineChangingOverride = true; rbtOverride.Checked = true; m_machineChangingOverride = false; } } }
private void wpTarget_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e) { if (addonSelectFrame1.SelectedObject is IDatabaseWriter) { m_target = (IDatabaseWriter)addonSelectFrame1.SelectedObject; } else if (addonSelectFrame1.SelectedObject is DatabaseWriterChooser) { m_target = m_writerChooser.GetDatabaseWriter(); } if (m_target != null) { try { m_target.CheckConfiguration(m_source); } catch (Exception err) { Errors.Report(err); e.Page = wpTarget; return; } } else { StdDialog.ShowError("s_please_select_database"); e.Page = wpTarget; } }
public static bool CheckAbsoluteOutputFileName(string fn, string extensions) { try { if (!Path.IsPathRooted(fn)) { StdDialog.ShowError("s_please_enter_full_path_to_file"); return(false); } string dir = Path.GetDirectoryName(fn); if (!Directory.Exists(dir)) { StdDialog.ShowError("s_output_directory_does_not_exist"); return(false); } if (!IOTool.FileHasOneOfExtension(fn, extensions)) { StdDialog.ShowError(Texts.Get("s_incorrect_file$extension", "extension", extensions.ToLower())); return(false); } } catch (Exception err) { StdDialog.ShowError(err.Message); return(false); } if (File.Exists(fn) && !StdDialog.ReallyOverwriteFile(fn)) { return(false); } return(true); }
/// <summary> /// Finds and selects an XPathNavigatorTreeNode using an XPath expression. /// </summary> /// <param name="xpath">An XPath expression.</param> /// <returns></returns> public bool FindByXpath(string xpath) { // evaluate the expression object result = this.SelectXmlNodes(xpath); if (result == null) { return(false); } // did the expression evaluate to a node set? XPathNodeIterator iterator = result as XPathNodeIterator; if (iterator != null) { // the expression evaluated to a node set if (iterator == null || iterator.Count < 1) { return(false); } if (!iterator.MoveNext()) { return(false); } // select the first node in the set return(this.SelectXmlTreeNode(iterator.Current)); } else { StdDialog.ShowInfo("XPath result:" + result.ToString()); return(true); } }
private void btnOk_Click(object sender, EventArgs e) { if (rbtDetail.Checked) { if (lsvDetailReferences.SelectedItems.Count == 0) { StdDialog.ShowError("s_please_select_foreign_key"); return; } IForeignKey fk = (IForeignKey)lsvDetailReferences.SelectedItems[0].Tag; m_result = CreateDetailReference(fk, m_dialect); m_resultFk = fk; } if (rbtMaster.Checked) { if (lsvMasterReferences.SelectedItems.Count == 0) { StdDialog.ShowError("s_please_select_foreign_key"); return; } IForeignKey fk = (IForeignKey)lsvMasterReferences.SelectedItems[0].Tag; m_resultFk = fk; m_result = CreateMasterReference(fk, m_dialect); } DialogResult = DialogResult.OK; Close(); }
private void DeleteSelectedObjects() { if (listView1.SelectedItems.Count == 0) { return; } if (!Widget.Caps.Delete) { return; } if (!StdDialog.YesNoDialog("s_really_delete$items", "items", listView1.SelectedItems.Count.ToString())) { return; } var itemsToDelete = new List <Tuple <AppObject, int> >(); using (var wc = new WaitContext()) { foreach (ListViewItem item in listView1.SelectedItems) { var obj = (AppObject)item.Tag; itemsToDelete.Add(new Tuple <AppObject, int>(obj, item.Index)); } } itemsToDelete.SortByKey(t => - t.V2); foreach (var tpl in itemsToDelete) { Widget.DeleteAppObject(tpl.V1, tpl.V2); } RefreshData(); }
public void NewDashboard() { string dname = InputBox.Run("s_type_new_dashboard_name", "new dashboard"); if (dname == null) { return; } string fn = Path.Combine(Core.DashboardsDirectory, dname + ".das"); if (File.Exists(fn)) { if (!StdDialog.ReallyOverwriteFile(fn)) { return; } } var dash = new DockPanelDashboard(fn); dash.Filter = GetFilter(); dash.SaveToFile(fn); //dash.EnableDesign(true); DashboardManager.Instance.Addons.Add(dash); var pars = new DashboardInstanceParams { LayoutName = null }; var win = dash.CreateControl(pars) as DashboardFrame; win.SetSelectedObject(this); MainWindow.Instance.OpenContent(win); MainWindow.Instance.ShowDocker(new PropertiesDockerFactory()); MainWindow.Instance.ShowDocker(new ToolboxDockerFactory()); dash.SetDesignFrame(win); }
private void btnOk_Click(object sender, EventArgs e) { if (rbtCreateNewJob.Checked) { if (tbxJob.Text.IsEmpty()) { StdDialog.ShowError("s_please_specify_job_name"); return; } } if (rbtAppendToExistingJob.Checked) { if (lbxJobs.SelectedIndex < 0) { StdDialog.ShowError("s_please_choose_job"); return; } } Usage["jobname"] = tbxJob.Text; Usage["addtofavorite"] = chbAddToFavorites.Checked ? "1" : "0"; Usage["result"] = "ok"; DialogResult = DialogResult.OK; Close(); }
public override bool Delete(object item) { if (StdDialog.ReallyDeleteFile(item)) { File.Delete(GetFileName(item)); return(true); } return(false); }
protected override void OnDataError(bool displayErrorDialogIfNoHandler, DataGridViewDataErrorEventArgs e) { base.OnDataError(false, e); Logging.Warning("Data error, row={0}, col={1}, error={2}", e.RowIndex, e.ColumnIndex, e.Exception.Message); if (m_showDataErrors > 0) { StdDialog.ShowError(e.Exception.Message); } }
private void btnSend_Click(object sender, EventArgs e) { try { Check(); } catch (Exception err) { Errors.Report(err); return; } var cfg = GlobalSettings.Pages.Email(); MailMessage mail = new MailMessage(); mail.From = cfg.GetFromAddress(); foreach (string addr in emailToFrame1.EmailTo.Split(';')) { mail.To.Add(addr); } mail.Subject = tbxSubject.Text; mail.Body = tbxBody.Text; mail.IsBodyHtml = false; string fn = Core.GetTempFile(".dca"); using (var zipfs = new ZipFileSystem(fn)) { configSelectionFrame1.Root.CopyCheckedTo(zipfs, true, null); zipfs.Flush(); } using (var dcafr = new FileInfo(fn).OpenRead()) { var att = new Attachment(dcafr, "configuration.dca"); mail.Attachments.Add(att); if (chbAddHowTo.Checked) { var ms = new MemoryStream(); var sw = new StreamWriter(ms); sw.Write(CoreRes.sendconfig_howto); sw.Flush(); ms.Position = 0; var atthowto = new Attachment(ms, "howto.html"); mail.Attachments.Add(atthowto); } SmtpClient smtp = cfg.GetClient(); Logging.Info("Sending mail to " + emailToFrame1.EmailTo); smtp.Send(mail); } File.Delete(fn); Close(); StdDialog.ShowInfo("s_configuration_sent"); }
public bool DeleteWithQuery() { if (StdDialog.YesNoDialog(GetConfirmDeleteMessage())) { DoDelete(); return(true); } return(false); }
private void DeleteJob(Dictionary <string, string> args) { string fn = args["job"]; if (StdDialog.ReallyDeleteFile(fn)) { File.Delete(fn); RefreshHtml(); } }
private void btnOk_Click(object sender, EventArgs e) { if (lbxJobs.SelectedIndex < 0) { StdDialog.ShowError("s_please_choose_job"); return; } DialogResult = DialogResult.OK; Close(); }
private void btnOk_Click(object sender, EventArgs e) { GlobalSettings.Pages.BeginEdit(); GlobalSettings.Pages.General().AskWhenUploadUsageStats = false; GlobalSettings.Pages.General().AllowUploadUsageStats = chbAllowUploadStats.Checked; GlobalSettings.Pages.EndEdit(); if (rbtPersonal.Checked) { InstallationInfo.Instance.InstallMode = InstallationMode.Personal; } if (rbtProfessional.Checked) { InstallationInfo.Instance.InstallMode = InstallationMode.Professional; } InstallationInfo.Instance.LastShown = DateTime.UtcNow; InstallationInfo.Instance.Save(); if (grpEval.Enabled && (chbDataSynEval.Checked || chbProEval.Checked || chbVersionDbEval.Checked)) { var evdata = GetEvalCodeForm.Run(); if (evdata == null) { DialogResult = DialogResult.None; return; } int cnt = 0; using (var wc = new WaitContext()) { if (chbDataSynEval.Checked && GetEvalCode.GetLicense(evdata.Name, evdata.Email, "datasyn")) { cnt++; } if (chbProEval.Checked && GetEvalCode.GetLicense(evdata.Name, evdata.Email, "pro")) { cnt++; } if (chbVersionDbEval.Checked && GetEvalCode.GetLicense(evdata.Name, evdata.Email, "versiondb")) { cnt++; } } if (cnt > 0) { LicenseTool.ReloadLicenses(); HLicense.CallChangedLicenses(); StdDialog.ShowInfo("s_license_succesfuly_installed"); } else { StdDialog.ShowError("s_error_when_install_license"); } } Close(); }
static void win_SelectedOk(object sender, CheckSelectedOkEventArgs e) { var win = sender as TreeSelectForm; var node = win.daTreeView1.Selected as IDatabaseTreeNode; if (node == null || node.DatabaseConnection == null) { StdDialog.ShowError("s_please_select_database"); return; } }
public void DeleteLocalContent() { var dbconn = this.FindDatabaseConnection(ConnPack); string path = dbconn.GetPrivateFolder(); if (path != null && StdDialog.YesNoDialog("s_really_delete_local_content$path", "path", path)) { Directory.Delete(path, true); CallCompleteChanged(); } }
public override bool DoDelete() { if (StdDialog.YesNoDialog("s_really_hide_samples_directory")) { GlobalSettings.Pages.BeginEdit(); GlobalSettings.Pages.Tree().HideDataSamplesFolder = true; GlobalSettings.Pages.EndEdit(); return(true); } return(false); }
private void SendUsageForm_FormClosed(object sender, FormClosedEventArgs e) { GlobalSettings.Pages.BeginEdit(); GlobalSettings.Pages.General().AskWhenUploadUsageStats = !cbxDontAskNext.Checked; GlobalSettings.Pages.General().AllowUploadUsageStats = cbxAllowUpload.Checked; GlobalSettings.Pages.EndEdit(); SendUsageStatsThread.SendUsage(); if (GlobalSettings.Pages.General().AllowUploadUsageStats) { StdDialog.ShowInfo("s_thank_you_for_uploading_stats"); } }
private void btnOk_Click(object sender, EventArgs e) { if (listView1.FocusedItem != null) { m_result = (JobCommandWithConnection)listView1.FocusedItem.Tag; Close(); } else { StdDialog.ShowError("s_please_select_command"); } }
private void wpcolmap_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e) { try { var tran = columnMapFrame1.GetTransform(); } catch (Exception err) { StdDialog.ShowError(err.Message); m_wpcolmapError = true; e.Page = wpcolmap; } }
public override void Remove() { try { File.Delete(DiskPath); } catch (Exception err) { StdDialog.ShowError("s_path_cannot_be_deleted_delete_scheduled"); DeletedFileRegistrer.AddPath(DiskPath, true); throw new DeleteError(DiskPath, err); } }
private void button1_Click(object sender, EventArgs e) { if (lbxItems.SelectedItems.Count == 0) { StdDialog.ShowError("s_you_must_select_item_to_create"); lbxItems.Focus(); return; } if (rbtNameInTree.Checked && tbxNewName.Text == "") { StdDialog.ShowError("s_you_must_enter_name"); tbxNewName.Focus(); return; } if (rbtFileOnDisk.Checked && tbxFileName.Text == "") { StdDialog.ShowError("s_input_file_name"); tbxFileName.Focus(); return; } ICreateFactoryItem item = (ICreateFactoryItem)lbxItems.SelectedItems[0].Tag; if (rbtFileOnDisk.Checked) { if (!StdDialog.CheckAbsoluteOutputFileName(tbxFileName.Text, item.FileExtensions)) { return; } } try { Directory.CreateDirectory(m_parent.FileSystemPath); } catch (Exception) { } if (rbtNameInTree.Checked) { if (item.Create(m_parent, tbxNewName.Text)) { Close(); } } if (rbtFileOnDisk.Checked) { if (!item.CreateFile(tbxFileName.Text)) { return; } using (StreamWriter sw = new StreamWriter(Path.Combine(m_parent.FileSystemPath, Path.GetFileNameWithoutExtension(tbxFileName.Text) + ".lnk"))) { sw.Write(tbxFileName.Text); } Close(); } }
private void PushedValue(int row, int col, object value) { if (m_data != null) { try { m_data.Rows[row][col] = value; } catch (Exception err) { StdDialog.ShowError(err.Message); } } InvalidateRow(row); }
public static void ShowErrorWindow(Exception e) { e = ExtractImportantException(e); if (e is BadSettingsError) { BadSettingsErrorForm.Run((BadSettingsError)e); } else if (e is ExpectedError) { StdDialog.ShowError(e.Message); } else { ErrorForm.Run(e, Logging.GetFeedbackLastLogEntries()); } }
public void MenuCreateDatabase() { var dbprops = new DatabaseProperties(); dbprops.Name = "newdb"; if (DatabasePropertiesForm.Run(dbprops, new GenericDatabaseSource(m_conn, m_conn.Connection, null), false)) { if (ArrayTool.Contains(m_conn.Databases, dbprops.Name)) { StdDialog.ShowError(Texts.Get("s_database_allready_exists")); return; } InvokeScript(fmt => { fmt.CreateDatabase(dbprops.Name, dbprops.SpecificData); }); TreeNodeExtension.CompleteRefresh(this); } }
private void pgdbconn_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e) { try { var conn = (TunnelConnection)GetConnection().CreateSystemConnection(); using (var wc = new WaitContext()) { conn.PingDb(); } } catch (Exception err) { StdDialog.ShowError(err.Message); e.Page = pgdbconn; } }
public void DragDrop_CopyTable(AppObject appobj) { //var tobj = appobj as TableAppObject; //if (tobj == null) return; var conn = this.FindDatabaseConnection(); ITableSource tsource = appobj.TableSource; TableStructure tbl = new TableStructure(tsource.InvokeLoadStructure(TableStructureMembers.AllNoRefs)); TableCopyOptions opts; bool copydata; string newname = CopyTableForm.Run(tsource, conn, out copydata, out opts); if (newname == null) { return; } List <NameWithSchema> names = new List <NameWithSchema>(conn.InvokeLoadFullTableNames()); if (ArrayTool.Contains(names, new NameWithSchema(newname))) { StdDialog.ShowError(Texts.Get("s_table_allready_exists")); return; } tbl.FullName = new NameWithSchema(newname); if (conn.Dialect != null) { conn.Dialect.MigrateTable(tbl, conn.Dialect.CreateMigrationProfile(), null); } tbl.RemoveConstraints <IForeignKey>(); PrimaryKey pk = (PrimaryKey)TableStructureExtension.FindConstraint <IPrimaryKey>(tbl); if (pk != null && pk.Name != null && pk.Name.ToUpper().StartsWith("PK_")) { pk.Name = "PK_" + tbl.Name; } try { ITableSource dst = conn.CreateTable(tbl); if (copydata) { BulkCopyJob.Create(tsource.GetDataStoreAndClone(), dst.GetDataStoreAndClone(), new IdentityTransform(tbl), opts, null).StartProcess(); } } catch (Exception e) { Errors.Report(e); } }
private void btnInstallLicense_Click(object sender, EventArgs e) { if (openFileDialogLicense.ShowDialogEx() == DialogResult.OK) { var lic = LicenseTool.LoadLicense(openFileDialogLicense.FileName); if (lic != null) { LicenseTool.InstallLicense(openFileDialogLicense.FileName); StdDialog.ShowInfo("s_license_installed_please_restart"); ReloadLicenses(); } else { StdDialog.ShowError("s_license_file_is_not_valid"); } } }