private void Viewer_PopupMenuShowing(DependencyObject d, PopupMenuShowingEventArgs e) { // Remove the Hand tool item from the page context popup menu. RemoveAction removeHandTool = new RemoveAction(); removeHandTool.ElementName = DefaultPdfBarManagerItemNames.HandTool; e.Actions.Add(removeHandTool); // Remove the Select All item from the page context popup menu. RemoveAction removeSelectAll = new RemoveAction(); removeSelectAll.ElementName = DefaultPdfBarManagerItemNames.SelectAll; e.Actions.Add(removeSelectAll); // Insert the "Save As..." item invoking the Save As dialog. BarButtonItem barButtonItem = new BarButtonItem(); barButtonItem.Content = "Save As..."; barButtonItem.Command = viewer.SaveAsCommand; InsertAction insertBarButtonItem = new InsertAction(); insertBarButtonItem.ContainerName = DefaultPdfBarManagerItemNames.ContextMenu; insertBarButtonItem.Element = barButtonItem; e.Actions.Add(insertBarButtonItem); }
private ActionBlock extendAdvice(NodeReference correctAnswer) { KnowledgePath shortestPath = null; var bestLength = int.MaxValue; foreach (var node in Pool.ActiveNodes) { var path = Graph.GetPaths(node, correctAnswer, 20, 100).FirstOrDefault(); if (path == null) { continue; } if (path.Length < bestLength) { shortestPath = path; bestLength = path.Length; } } IPoolAction action; if (shortestPath == null) { //we doesn't have enough evidence in DB action = new InsertAction(correctAnswer); } else { action = new ExtendAction(shortestPath); } return(new ActionBlock(Pool.Graph, new[] { action })); }
private void UpsertEntity <TEntity>(TableInfo tableInfo, TEntity entity) where TEntity : class { if (tableInfo.IsPrimaryKeySet(entity)) { // update: var updateAction = new UpdateAction <TEntity>(this._metadataStore, entity, this._hydrator, this._connection, this._dialect, this._environment); Action proceed = () => updateAction.Update(entity); var invocation = new DataInvocation(this, this._metadataStore, entity, proceed); _interceptorPipeline.ExecuteOnUpdate(invocation); } else { // insert: var insertAction = new InsertAction <TEntity>(this._metadataStore, entity, this._hydrator, this._connection, this._dialect, this._environment); Action proceed = () => insertAction.Insert(entity); var invocation = new DataInvocation(this, this._metadataStore, entity, proceed); _interceptorPipeline.ExecuteOnInsert(invocation); } }
/* * The internal listeners will create an InsertAction when the text * is inserted. Since it's ugly to have the bug insertion appear * to the user as two items in the undo stack, have this item eat * the other one. */ public override bool CanMerge(EditAction action) { InsertAction insert = action as InsertAction; if (insert == null) { return(false); } if (String.Compare(Id, insert.Chop.Text) == 0) { return(true); } return(false); }
public bool DeepEquals(DestinySocketTypeDefinition?other) { return(other is not null && (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) && (InsertAction is not null ? InsertAction.DeepEquals(other.InsertAction) : other.InsertAction is null) && PlugWhitelist.DeepEqualsList(other.PlugWhitelist) && SocketCategoryHash == other.SocketCategoryHash && Visibility == other.Visibility && AlwaysRandomizeSockets == other.AlwaysRandomizeSockets && IsPreviewEnabled == other.IsPreviewEnabled && HideDuplicateReusablePlugs == other.HideDuplicateReusablePlugs && OverridesUiAppearance == other.OverridesUiAppearance && AvoidDuplicatesOnInitialization == other.AvoidDuplicatesOnInitialization && CurrencyScalars.DeepEqualsList(other.CurrencyScalars) && Hash == other.Hash && Index == other.Index && Redacted == other.Redacted); }
private void HandleInsert(T item) { HandleInsertOverride(item); InsertAction?.Invoke(item); }
public bool Equals(DestinySocketTypeDefinition input) { if (input == null) { return(false); } return (( DisplayProperties == input.DisplayProperties || (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties)) ) && ( InsertAction == input.InsertAction || (InsertAction != null && InsertAction.Equals(input.InsertAction)) ) && ( PlugWhitelist == input.PlugWhitelist || (PlugWhitelist != null && PlugWhitelist.SequenceEqual(input.PlugWhitelist)) ) && ( SocketCategoryHash == input.SocketCategoryHash || (SocketCategoryHash.Equals(input.SocketCategoryHash)) ) && ( Visibility == input.Visibility || (Visibility != null && Visibility.Equals(input.Visibility)) ) && ( AlwaysRandomizeSockets == input.AlwaysRandomizeSockets || (AlwaysRandomizeSockets != null && AlwaysRandomizeSockets.Equals(input.AlwaysRandomizeSockets)) ) && ( IsPreviewEnabled == input.IsPreviewEnabled || (IsPreviewEnabled != null && IsPreviewEnabled.Equals(input.IsPreviewEnabled)) ) && ( HideDuplicateReusablePlugs == input.HideDuplicateReusablePlugs || (HideDuplicateReusablePlugs != null && HideDuplicateReusablePlugs.Equals(input.HideDuplicateReusablePlugs)) ) && ( OverridesUiAppearance == input.OverridesUiAppearance || (OverridesUiAppearance != null && OverridesUiAppearance.Equals(input.OverridesUiAppearance)) ) && ( AvoidDuplicatesOnInitialization == input.AvoidDuplicatesOnInitialization || (AvoidDuplicatesOnInitialization != null && AvoidDuplicatesOnInitialization.Equals(input.AvoidDuplicatesOnInitialization)) ) && ( CurrencyScalars == input.CurrencyScalars || (CurrencyScalars != null && CurrencyScalars.SequenceEqual(input.CurrencyScalars)) ) && ( Hash == input.Hash || (Hash.Equals(input.Hash)) ) && ( Index == input.Index || (Index.Equals(input.Index)) ) && ( Redacted == input.Redacted || (Redacted != null && Redacted.Equals(input.Redacted)) )); }
public void Update(DestinySocketTypeDefinition?other) { if (other is null) { return; } if (!DisplayProperties.DeepEquals(other.DisplayProperties)) { DisplayProperties.Update(other.DisplayProperties); OnPropertyChanged(nameof(DisplayProperties)); } if (!InsertAction.DeepEquals(other.InsertAction)) { InsertAction.Update(other.InsertAction); OnPropertyChanged(nameof(InsertAction)); } if (!PlugWhitelist.DeepEqualsList(other.PlugWhitelist)) { PlugWhitelist = other.PlugWhitelist; OnPropertyChanged(nameof(PlugWhitelist)); } if (SocketCategoryHash != other.SocketCategoryHash) { SocketCategoryHash = other.SocketCategoryHash; OnPropertyChanged(nameof(SocketCategoryHash)); } if (Visibility != other.Visibility) { Visibility = other.Visibility; OnPropertyChanged(nameof(Visibility)); } if (AlwaysRandomizeSockets != other.AlwaysRandomizeSockets) { AlwaysRandomizeSockets = other.AlwaysRandomizeSockets; OnPropertyChanged(nameof(AlwaysRandomizeSockets)); } if (IsPreviewEnabled != other.IsPreviewEnabled) { IsPreviewEnabled = other.IsPreviewEnabled; OnPropertyChanged(nameof(IsPreviewEnabled)); } if (HideDuplicateReusablePlugs != other.HideDuplicateReusablePlugs) { HideDuplicateReusablePlugs = other.HideDuplicateReusablePlugs; OnPropertyChanged(nameof(HideDuplicateReusablePlugs)); } if (OverridesUiAppearance != other.OverridesUiAppearance) { OverridesUiAppearance = other.OverridesUiAppearance; OnPropertyChanged(nameof(OverridesUiAppearance)); } if (AvoidDuplicatesOnInitialization != other.AvoidDuplicatesOnInitialization) { AvoidDuplicatesOnInitialization = other.AvoidDuplicatesOnInitialization; OnPropertyChanged(nameof(AvoidDuplicatesOnInitialization)); } if (!CurrencyScalars.DeepEqualsList(other.CurrencyScalars)) { CurrencyScalars = other.CurrencyScalars; OnPropertyChanged(nameof(CurrencyScalars)); } if (Hash != other.Hash) { Hash = other.Hash; OnPropertyChanged(nameof(Hash)); } if (Index != other.Index) { Index = other.Index; OnPropertyChanged(nameof(Index)); } if (Redacted != other.Redacted) { Redacted = other.Redacted; OnPropertyChanged(nameof(Redacted)); } }