public bool OnAddCustomField(object argument) { CheckDisposed(); // Only allow adding custom fields when a single client is connected. if (Cache.NumberOfRemoteClients > 1 || (Cache.ProjectId.IsLocal && Cache.NumberOfRemoteClients > 0)) { MessageBoxUtils.Show(ParentForm, xWorksStrings.ksCustomFieldsCanNotBeAddedDueToRemoteClientsText, xWorksStrings.ksCustomFieldsCanNotBeAddedDueToRemoteClientsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(true); } AddCustomFieldDlg.LocationType locationType = AddCustomFieldDlg.LocationType.Lexicon; string areaChoice = m_mediator.PropertyTable.GetStringProperty("areaChoice", string.Empty); switch (areaChoice) { case "lexicon": locationType = AddCustomFieldDlg.LocationType.Lexicon; break; case "notebook": locationType = AddCustomFieldDlg.LocationType.Notebook; break; } using (var dlg = new AddCustomFieldDlg(m_mediator, locationType)) dlg.ShowDialog(this); return(true); // handled }
public bool OnAddCustomField(object argument) { CheckDisposed(); if (SharedBackendServices.AreMultipleApplicationsConnected(Cache)) { MessageBoxUtils.Show(ParentForm, xWorksStrings.ksCustomFieldsCanNotBeAddedDueToOtherAppsText, xWorksStrings.ksCustomFieldsCanNotBeAddedDueToOtherAppsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(true); } AddCustomFieldDlg.LocationType locationType = AddCustomFieldDlg.LocationType.Lexicon; string areaChoice = m_propertyTable.GetStringProperty("areaChoice", string.Empty); switch (areaChoice) { case "lexicon": locationType = AddCustomFieldDlg.LocationType.Lexicon; break; case "notebook": locationType = AddCustomFieldDlg.LocationType.Notebook; break; case "textsWords": locationType = AddCustomFieldDlg.LocationType.Interlinear; break; } using (var dlg = new AddCustomFieldDlg(m_mediator, m_propertyTable, locationType)) { if (dlg.ShowCustomFieldWarning(this)) { dlg.ShowDialog(this); } } return(true); // handled }