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(); }
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(); }
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 IRealTreeNode FindNode(string path, bool allowPrepareChildren) { try { tree.BeginUpdate(); using (var wc = new WaitContext()) { string[] p = path.Split('/'); if (p[0] != RootPath) { return(null); } IRealTreeNode item = Root.RealNode; for (int i = 1; i < p.Length; i++) { if (item == null) { return(null); } bool found = false; if (allowPrepareChildren && !item.LogicalNode.PreparedChildren) { item.LogicalNode.GetChildrenNow(); } item.RefreshChilds(false); foreach (var rchild in item.RealChildren) { if (rchild.LogicalNode.Name == p[i] || rchild.LogicalNode.Name + ".con" == p[i]) { item = rchild; found = true; break; } } if (!found) { return(null); } } return(item); } } finally { tree.EndUpdate(); } }
public void SetBindings(ITabularDataStore source, ITabularDataStore target) { using (WaitContext wc = new WaitContext()) { Async.SafeOpen(source.Connection); Async.SafeOpen(target.Connection); try { IAsyncResult res1 = source.BeginGetRowFormat(null); Async.WaitFor(res1); m_source = source.EndGetRowFormat(res1); } catch (Exception err) { throw new BulkCopyInputError("DAE-00181", err); } if (m_source.Columns.Count == 0) { throw new ExpectedError("DAE-00182 " + Texts.Get("s_no_columns_detected_in_imported_source")); } IAsyncResult res2 = target.BeginGetRowFormat(null); Async.WaitFor(res2); m_target = target.EndGetRowFormat(res2); int acty = labValue.Top + labValue.Height + 10; int colindex = 0; foreach (IColumnStructure col in m_target.Columns) { Label lab = new Label(); Controls.Add(lab); lab.Left = labTarget.Left; lab.Top = acty; lab.Text = col.ColumnName + " :"; CheckBox skip = new CheckBox(); Controls.Add(skip); skip.Top = acty; skip.Width = 30; skip.Left = labSkip.Left; m_checks.Add(skip); skip.Tag = colindex; skip.CheckedChanged += new EventHandler(skip_CheckedChanged); ComboBox type = new ComboBox(); Controls.Add(type); type.Left = labType.Left; type.Top = acty; type.DropDownStyle = ComboBoxStyle.DropDownList; GenericTransform.GetColExprTypes(type.Items); type.SelectedIndex = 0; type.Tag = colindex; m_typeCombos.Add(type); ComboBox sel = new ComboBox(); Controls.Add(sel); sel.Left = labValue.Left; sel.Top = acty; sel.DropDownStyle = ComboBoxStyle.DropDown; sel.DropDownClosed += new EventHandler(sel_DropDownClosed); sel.Tag = colindex; foreach (IColumnStructure srccol in m_source.Columns) { sel.Items.Add(srccol.ColumnName); } sel.SelectedIndex = sel.Items.IndexOf(col.ColumnName); if (sel.SelectedIndex < 0) { if (col.ColumnOrder < sel.Items.Count) { sel.SelectedIndex = col.ColumnOrder; } else { sel.SelectedIndex = 0; } } m_combos.Add(sel); acty += Math.Max(sel.Height, lab.Height) * 5 / 4; colindex++; } } }