Ejemplo n.º 1
0
 void ISnippetListView.RaiseOnInsert(InsertEventArgs e)
 {
     if (OnInsert != null)
     {
         OnInsert(this, e);
     }
 }
Ejemplo n.º 2
0
            public override void Insert(IDictionary values, DataSourceViewOperationCallback callback)
            {
                var insertArgs = new InsertEventArgs()
                {
                    DataSourceView = UnderlyingView, Callback = callback, Values = values
                };

                AppContext.EventBroker.PublishInTransaction(ActionDS, insertArgs);
            }
Ejemplo n.º 3
0
    protected virtual void OnReplaysInserted(InsertEventArgs e)
    {
        EventHandler <InsertEventArgs> handler = ReplaysInserted;

        if (handler != null)
        {
            handler(this, e);
        }
    }
Ejemplo n.º 4
0
        public void InsertEventArgs_ctor_default_values()
        {
            string expectedValue = "Foo";
            int    expectedIndex = 10;

            InsertEventArgs <string> obj = new InsertEventArgs <string>(expectedIndex, expectedValue);

            Assert.IsFalse(obj.Cancel);
            Assert.AreEqual <int>(expectedIndex, obj.Index);
            Assert.AreEqual <string>(expectedValue, obj.NewValue);
        }
Ejemplo n.º 5
0
		public void InsertEventArgs_ctor_default_values()
		{
			string expectedValue = "Foo";
			int expectedIndex = 10;

			InsertEventArgs<string> obj = new InsertEventArgs<string>( expectedIndex, expectedValue );

			Assert.IsFalse( obj.Cancel );
			Assert.AreEqual<int>( expectedIndex, obj.Index );
			Assert.AreEqual<string>( expectedValue, obj.NewValue );
		}
Ejemplo n.º 6
0
 private void InsertService_ReplaysInserted(object sender, InsertEventArgs e)
 {
     if (e.Done)
     {
         notifySource.Cancel();
         Producing = false;
         insertService.ReplaysInserted -= InsertService_ReplaysInserted;
     }
     else
     {
         insertCount = e.insertCount;
     }
 }
Ejemplo n.º 7
0
 private void OnShortcutsUpdateInsert(object sender, InsertEventArgs e)
 {
     this.Invalidate();
 }
Ejemplo n.º 8
0
 void TableElementList_AfterInsert(object sender, InsertEventArgs <TableElement> e)
 {
     e.Item.ValueChanged += new EventHandler <TableElementValueChangedEventArgs>(Item_ValueChanged);
 }
Ejemplo n.º 9
0
 protected virtual bool OnBeforeInsert(InsertEventArgs arg)
 {
     return(true);
 }
Ejemplo n.º 10
0
 protected virtual void OnAfterInsert(InsertEventArgs arg)
 {
 }
Ejemplo n.º 11
0
 void OutputList_AfterInsert(object sender, InsertEventArgs <IOutput> e)
 {
     e.Item.ValueChanged += new Output.ValueChangedEventHandler(Item_ValueChanged);
 }
Ejemplo n.º 12
0
 private void OnGroupsUpdateInsert(object sender, InsertEventArgs e)
 {
     base.Invalidate();
 }
Ejemplo n.º 13
0
        private void m_insertControl_Insert(object sender, InsertEventArgs e)
        {
            ComplexConcPatternNode node = null;

            switch (((InsertOption)e.Option).Type)
            {
            case ComplexConcordanceInsertType.Morph:
                using (ComplexConcMorphDlg dlg = new ComplexConcMorphDlg())
                {
                    ComplexConcMorphNode morphNode = new ComplexConcMorphNode();
                    dlg.SetDlgInfo(m_cache, m_mediator, morphNode);
                    if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
                    {
                        node = morphNode;
                    }
                }
                break;

            case ComplexConcordanceInsertType.Word:
                using (ComplexConcWordDlg dlg = new ComplexConcWordDlg())
                {
                    ComplexConcWordNode wordNode = new ComplexConcWordNode();
                    dlg.SetDlgInfo(m_cache, m_mediator, wordNode);
                    if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
                    {
                        node = wordNode;
                    }
                }
                break;

            case ComplexConcordanceInsertType.TextTag:
                using (ComplexConcTagDlg dlg = new ComplexConcTagDlg())
                {
                    ComplexConcTagNode tagNode = new ComplexConcTagNode();
                    dlg.SetDlgInfo(m_cache, m_mediator, tagNode);
                    if (dlg.ShowDialog((XWindow)m_mediator.PropertyTable.GetValue("window")) == DialogResult.OK)
                    {
                        node = tagNode;
                    }
                }
                break;

            case ComplexConcordanceInsertType.Or:
                node = new ComplexConcOrNode();
                break;

            case ComplexConcordanceInsertType.WordBoundary:
                node = new ComplexConcWordBdryNode();
                break;
            }

            m_view.Select();

            if (node == null)
            {
                return;
            }

            SelectionHelper sel = SelectionHelper.Create(m_view);

            ComplexConcPatternNode parent;
            int index;

            GetInsertionIndex(sel, out parent, out index);
            // if the current selection is a range remove the items we are overwriting
            if (sel.IsRange)
            {
                foreach (ComplexConcPatternNode n in CurrentNodes)
                {
                    n.Parent.Children.Remove(n);
                }
            }

            parent.Children.Insert(index, node);
            ReconstructView(parent, index, false);
        }
Ejemplo n.º 14
0
		/// <summary>
		/// Handles the Insert event of the m_insertionControl control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="InsertEventArgs"/> instance containing the event data.</param>
		private void m_insertionControl_Insert(object sender, InsertEventArgs e)
		{
			var option = (InsertOption) e.Option;

			var undo = string.Format(MEStrings.ksRuleUndoInsert, option);
			var redo = string.Format(MEStrings.ksRuleRedoInsert, option);

			SelectionHelper sel = SelectionHelper.Create(m_view);
			int cellId = -1;
			int cellIndex = -1;
			switch (option.Type)
			{
				case RuleInsertType.Phoneme:
					IEnumerable<IPhPhoneme> phonemes = m_cache.LangProject.PhonologicalDataOA.PhonemeSetsOS[0].PhonemesOC.OrderBy(ph => ph.ShortName);
					ICmObject phonemeObj = DisplayChooser(MEStrings.ksRulePhonemeOpt, MEStrings.ksRulePhonemeChooserLink,
						"phonemeEdit", "RulePhonemeFlatList", phonemes);
					var phoneme = phonemeObj as IPhPhoneme;
					if (phoneme == null)
						return;
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertPhoneme(phoneme, sel, out cellIndex);
						});
					break;

				case RuleInsertType.NaturalClass:
					IEnumerable<IPhNaturalClass> natClasses = m_cache.LangProject.PhonologicalDataOA.NaturalClassesOS.OrderBy(natc => natc.ShortName);
					ICmObject ncObj = DisplayChooser(MEStrings.ksRuleNCOpt, MEStrings.ksRuleNCChooserLink,
						"naturalClassedit", "RuleNaturalClassFlatList", natClasses);
					var nc = ncObj as IPhNaturalClass;
					if (nc == null)
						return;
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertNC(nc, sel, out cellIndex);
						});
					break;

				case RuleInsertType.Features:
					using (var featChooser = new PhonologicalFeatureChooserDlg())
					{
						SetupPhonologicalFeatureChoooserDlg(featChooser);
						featChooser.SetHelpTopic(FeatureChooserHelpTopic);
						DialogResult res = featChooser.ShowDialog();
						if (res == DialogResult.OK)
						{
							UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
								{
									IPhNCFeatures featNC = m_cache.ServiceLocator.GetInstance<IPhNCFeaturesFactory>().Create();
									m_cache.LangProject.PhonologicalDataOA.NaturalClassesOS.Add(featNC);
									featNC.Name.SetUserWritingSystem(string.Format(MEStrings.ksRuleNCFeatsName, RuleName));
									featNC.FeaturesOA = m_cache.ServiceLocator.GetInstance<IFsFeatStrucFactory>().Create();
									IPhSimpleContextNC ctxt;
									cellId = InsertNC(featNC, sel, out cellIndex, out ctxt);
									featChooser.Context = ctxt;
									featChooser.UpdateFeatureStructure();
								});
						}
						else if (res != DialogResult.Cancel)
						{
							featChooser.HandleJump();
						}
					}
					break;

				case RuleInsertType.WordBoundary:
					IPhBdryMarker wordBdry = m_cache.ServiceLocator.GetInstance<IPhBdryMarkerRepository>().GetObject(LangProjectTags.kguidPhRuleWordBdry);
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertBdry(wordBdry, sel, out cellIndex);
						});
					break;

				case RuleInsertType.MorphemeBoundary:
					IPhBdryMarker morphBdry = m_cache.ServiceLocator.GetInstance<IPhBdryMarkerRepository>().GetObject(LangProjectTags.kguidPhRuleMorphBdry);
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertBdry(morphBdry, sel, out cellIndex);
						});
					break;

				case RuleInsertType.Index:
					// put the clicked index in the data field
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertIndex((int) e.Suboption, sel, out cellIndex);
						});
					break;

				case RuleInsertType.Column:
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertColumn(sel);
						});
					break;

				case RuleInsertType.Variable:
					UndoableUnitOfWorkHelper.Do(undo, redo, m_cache.ActionHandlerAccessor, () =>
						{
							cellId = InsertVariable(sel, out cellIndex);
						});
					break;
			}

			m_view.Select();
			if (cellId != -1)
			{
				// reconstruct the view and place the cursor after the newly added item
				ReconstructView(cellId, cellIndex, false);
			}
		}
Ejemplo n.º 15
0
 void _container_Insert(object sender, InsertEventArgs e)
 {
     base.Insert(e.Data);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Raises the Inserted event.
 /// </summary>
 /// <param name="e">A InsertEventArgs that contains the event data.</param>
 protected virtual void OnInserted(InsertEventArgs e)
 {
     if (Inserted != null) {
         Inserted(this, e);
     }
 }