Esempio n. 1
0
        /// <summary>
        /// Handles the xWorks message to insert a new Data Notebook record.
        /// Invoked by the RecordClerk
        /// </summary>
        /// <param name="argument">The xCore Command object.</param>
        /// <returns>true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter</returns>
        public bool OnDialogInsertItemInVector(object argument)
        {
            CheckDisposed();

            var    command   = (Command)argument;
            string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");

            if (className == null || className != "RnGenericRec")
            {
                return(false);
            }

            bool subrecord    = XmlUtils.GetOptionalBooleanAttributeValue(command.Parameters[0], "subrecord", false);
            bool subsubrecord = XmlUtils.GetOptionalBooleanAttributeValue(command.Parameters[0], "subsubrecord", false);

            using (var dlg = new InsertRecordDlg())
            {
                var       cache       = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
                ICmObject obj         = null;
                ICmObject objSelected = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject") as ICmObject;
                ICmObject objOwning   = m_mediator.PropertyTable.GetValue("ActiveClerkOwningObject") as ICmObject;
                if (subsubrecord)
                {
                    obj = objSelected;
                }
                else if (subrecord && objSelected != null)
                {
                    obj = objSelected;
                    while (obj.Owner is IRnGenericRec)
                    {
                        obj = obj.Owner;
                    }
                }
                else
                {
                    obj = objOwning;
                }
                dlg.SetDlgInfo(cache, m_mediator, obj);
                if (dlg.ShowDialog(Form.ActiveForm) == DialogResult.OK)
                {
                    IRnGenericRec newRec = dlg.NewRecord;
                    m_mediator.SendMessage("JumpToRecord", newRec.Hvo);
                }
            }
            return(true);            // We "handled" the message, regardless of what happened.
        }
Esempio n. 2
0
 protected override void m_btnInsert_Click(object sender, EventArgs e)
 {
     using (var dlg = new InsertRecordDlg())
     {
         string    title        = m_tbForm.Text.Trim();
         ITsString titleTrimmed = TsStringUtils.MakeString(title, TsStringUtils.GetWsAtOffset(m_tbForm.Tss, 0));
         dlg.SetDlgInfo(m_cache, m_mediator, m_propertyTable, m_cache.LanguageProject.ResearchNotebookOA, titleTrimmed);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             m_selObject = dlg.NewRecord;
             HandleMatchingSelectionChanged();
             if (m_btnOK.Enabled)
             {
                 m_btnOK.PerformClick();
             }
         }
     }
 }
Esempio n. 3
0
		/// <summary>
		/// Handles the xWorks message to insert a new Data Notebook record.
		/// Invoked by the RecordClerk
		/// </summary>
		/// <param name="argument">The xCore Command object.</param>
		/// <returns>true, if we handled the message, otherwise false, if there was an unsupported 'classname' parameter</returns>
		public bool OnDialogInsertItemInVector(object argument)
		{
			CheckDisposed();

			var command = (Command) argument;
			string className = XmlUtils.GetOptionalAttributeValue(command.Parameters[0], "className");
			if (className == null || className != "RnGenericRec")
				return false;

			bool subrecord = XmlUtils.GetOptionalBooleanAttributeValue(command.Parameters[0], "subrecord", false);
			bool subsubrecord = XmlUtils.GetOptionalBooleanAttributeValue(command.Parameters[0], "subsubrecord", false);

			using (var dlg = new InsertRecordDlg())
			{
				var cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
				ICmObject obj = null;
				ICmObject objSelected = m_mediator.PropertyTable.GetValue("ActiveClerkSelectedObject") as ICmObject;
				ICmObject objOwning = m_mediator.PropertyTable.GetValue("ActiveClerkOwningObject") as ICmObject;
				if (subsubrecord)
					obj = objSelected;
				else if (subrecord && objSelected != null)
				{
					obj = objSelected;
					while (obj.Owner is IRnGenericRec)
						obj = obj.Owner;
				}
				else
					obj = objOwning;
				dlg.SetDlgInfo(cache, m_mediator, obj);
				if (dlg.ShowDialog(Form.ActiveForm) == DialogResult.OK)
				{
					IRnGenericRec newRec = dlg.NewRecord;
					m_mediator.SendMessage("JumpToRecord", newRec.Hvo);
				}
			}
			return true; // We "handled" the message, regardless of what happened.
		}
Esempio n. 4
0
		protected override void m_btnInsert_Click(object sender, EventArgs e)
		{
			using (var dlg = new InsertRecordDlg())
			{
				string title = m_tbForm.Text.Trim();
				ITsString titleTrimmed = TsStringUtils.MakeTss(title, TsStringUtils.GetWsAtOffset(m_tbForm.Tss, 0));
				dlg.SetDlgInfo(m_cache, m_mediator, m_cache.LanguageProject.ResearchNotebookOA, titleTrimmed);
				if (dlg.ShowDialog() == DialogResult.OK)
				{
					m_selObject = dlg.NewRecord;
					HandleMatchingSelectionChanged();
					if (m_btnOK.Enabled)
						m_btnOK.PerformClick();
				}
			}
		}