コード例 #1
0
ファイル: XWorksViewBase.cs プロジェクト: sillsdev/WorldPad
		public bool OnAddCustomField(object argument)
		{
			CheckDisposed();

			// initialize the dialog according to the proper context. (cf. LT-4404)
			int owningFlid = Clerk.OwningFlid;
			int dstClass = (int)Cache.GetDestinationClass((uint)owningFlid);
			if (dstClass == 0)
				dstClass = LexEntry.kclsidLexEntry;	// default will be Entry Class.
			using (AddCustomFieldDlg dlg = new AddCustomFieldDlg(m_mediator, dstClass))
			{
				dlg.ShowDialog();
			}

			return true;	// handled
		}
コード例 #2
0
ファイル: XWorksViewBase.cs プロジェクト: bbriggs/FieldWorks
        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;
            }
            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_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))
            {
                if (dlg.ShowCustomFieldWarning(this))
                    dlg.ShowDialog(this);
            }

            return true;	// handled
        }