Ejemplo n.º 1
0
        /// <summary>
        /// Called when the event was fired (processing completed).
        /// </summary>
        /// <param name="eventTopic">The event topic.</param>
        /// <param name="publication">The publication.</param>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public override void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e)
        {
            INamedItem namedItem = publication.Publisher as INamedItem;

            if (namedItem != null)
            {
                this.log.DebugFormat(
                    CultureInfo.InvariantCulture,
                    "Fired event '{0}'. Invoked by publisher '{1}' with name '{2}' with sender '{3}' and EventArgs '{4}'.",
                    eventTopic.Uri,
                    publication.Publisher,
                    namedItem.EventBrokerItemName,
                    sender,
                    e);
            }
            else
            {
                this.log.DebugFormat(
                    CultureInfo.InvariantCulture,
                    "Fired event '{0}'. Invoked by publisher '{1}' with sender '{2}' and EventArgs '{3}'.",
                    eventTopic.Uri,
                    publication.Publisher,
                    sender,
                    e);
            }
        }
 /// <summary>
 /// Only override the item's Namespace if it is null
 /// </summary>
 /// <param name="item">The item to be fixed up</param>        
 protected override void FixupNamedItem(INamedItem item)
 {
     if (item.NamespaceName == null)
     {
         item.NamespaceName = this.DefaultNamespaceName;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Only override the item's Namespace if it is null
 /// </summary>
 /// <param name="item">The item to be fixed up</param>
 protected override void FixupNamedItem(INamedItem item)
 {
     if (item.NamespaceName == null)
     {
         item.NamespaceName = this.DefaultNamespaceName;
     }
 }
        private void ItemSelectedDelegate(INamedItem item)
        {
            if (item == null)
                return;

            m_engine.Actions.GetItem((IItem)item);
            Escape();
        }
        private void OptionSelectedDelegate(INamedItem item)
        {
            if (item == null)
                return;

            TextElement element = (TextElement)item;
            switch (element.DisplayName)
            {
                case "Heal Player":
                {
                    m_engine.Debugger.DebugRequest("HealPlayer", null);
                    Escape();
                    return;
                }
                case "Create Item":
                {
                    SetCreateItemMenu();
                    m_gameInstance.UpdatePainters();
                    return;
                }
                case "Create Monster":
                {
                    SetMonsterMenu();
                    m_gameInstance.UpdatePainters();
                    return;
                }
                case "Map Debug Settings":
                {
                    CreateMapDebugSettings();
                    m_gameInstance.UpdatePainters();
                    return;
                }
                case "Add Skill Points":
                {
                    m_engine.Debugger.DebugRequest("AddSkillPoints", 50);
                    Escape();
                    return;
                }
                case "Add All Skills":
                {
                    m_engine.Debugger.DebugRequest("AddAllSkills", null);
                    Escape();
                    return;
                }
                case "Kill Monsters on Floor":
                {
                    m_engine.Debugger.DebugRequest("KillMonstersOnFloor", null);
                    Escape();
                    return;
                }
                case "Exit":
                default:
                {
                    Escape();
                    return;
                }
            }
        }
Ejemplo n.º 6
0
 internal static ValidationStates ValidateNameProperty(INamedItem toValidate)
 {
     var results = new List<ValidationResult>();
     var context = new ValidationContext(toValidate, null, null);
     context.MemberName = NAME_PROPERTY;
     Validator.TryValidateProperty(toValidate.Name, context, results);
     var states = ConvertResultsToStates(results);
     return new ValidationStates(states);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherFunction = other as Function;
            if (otherFunction == null)
            {
                return false;
            }

            return (this.Name == otherFunction.Name) && (this.NamespaceName == otherFunction.NamespaceName);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherComplex = other as ComplexType;
            if (otherComplex == null)
            {
                return false;
            }

            return (this.Name == otherComplex.Name) && (this.NamespaceName == otherComplex.NamespaceName);
        }
Ejemplo n.º 9
0
        private void SpellSelectedDelegate(INamedItem spellName)
        {
            ISpell spell = (ISpell)spellName;
            if (!m_engine.Player.CouldCastSpell(spell))
                return;

            m_gameInstance.SendPaintersRequest(new ShowListSelectionWindow(false));

            HandleInvoke(spell, spell.Targeting, x => m_engine.Actions.CastSpell(spell, x), m_keystroke);
        }
Ejemplo n.º 10
0
        public RenderResultModel RenderMatch(INamedItem @object, CodeGenerationConfigBuilder builder)
        {
            Models.RenderModels.Object renderModel = RenderModel.FromNamedItem(builder, @object);

            var serialRenderModel = JSON.Convert(renderModel);

            _logger.LogError(new LogModel
            {
                Message       = serialRenderModel,
                Title         = renderModel?.ToString(),
                AdditionalKey = $"{renderModel?.ToString()}_{DateTime.Now:yyyy-MM-dd-HH-mm-ss}",
                Scopes        = LogScope.Objects
            });


            TemplateContext templateContext = new TemplateContext();
            ScriptObject    scriptObject    = new ScriptObject();

            scriptObject.Import(typeof(StringFunctions));
            scriptObject.Import(renderModel);
            templateContext.PushGlobal(scriptObject);

            string templateContent = TemplateHelper.FindTemplateFile(builder.Input.Template);

            if (!string.IsNullOrEmpty(templateContent))
            {
                Template template = Template.Parse(templateContent);

                List <Template> fileNameTemplates = new List <Template>();
                if (builder.Output.OutputPathTemplates != null && builder.Output.OutputPathTemplates.Any())
                {
                    fileNameTemplates.AddRange(builder.Output.OutputPathTemplates.Select(t => Template.Parse(t)));
                }
                else
                {
                    fileNameTemplates.Add(Template.Parse(builder.Output.OutputPathTemplate));
                }

                string result = template.Render(templateContext);

                List <string> outputFilePaths = new List <string>(fileNameTemplates.Select(r => r.Render(templateContext)));

                RenderResultModel renderResult = new RenderResultModel {
                    Result = result, BuilderConfig = builder, OutputPaths = outputFilePaths
                };

                return(renderResult);
            }
            else
            {
                _logger.LogError("Error finding template", "Could not find the following template: " + builder.Input.Template);
                return(null);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherComplex = other as ComplexType;

            if (otherComplex == null)
            {
                return(false);
            }

            return((this.Name == otherComplex.Name) && (this.NamespaceName == otherComplex.NamespaceName));
        }
    /* Handles when the 'x' button is pressed on any of the items.
     * The item in question is found and the RemoveItem event subscribers are notified.
     * If the subscribers do not cancel the event, then the item is removed.
     */
    private void BtnRemove_Click(object sender, RoutedEventArgs e)
    {       //Obtain the item that corresponds to the remove button that was clicked.
        INamedItem          removeItem = ((FrameworkElement)sender).DataContext as INamedItem;
        RemoveItemEventArgs args       = new RemoveItemEventArgs(removeItem);

        RaiseRemoveItem(args);
        if (!args.Cancel)
        {       //If not cancelled, then remove the item.
            items.Remove(removeItem);
        }
    }
Ejemplo n.º 13
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            INamedItem other = obj as INamedItem;

            if (other == null)
            {
                return(false);
            }

            return(this.Equals(other));
        }
Ejemplo n.º 14
0
        public int IndexOf(INamedItem item)
        {
            int idx = IndexOf(item.Name);

            if (idx >= 0 && !object.Equals(_list[idx], item))
            {
                idx = -1;
            }

            return(idx);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherEntity = other as EntityType;

            if (otherEntity == null)
            {
                return(false);
            }

            return((this.Name == otherEntity.Name) && (this.NamespaceName == otherEntity.NamespaceName));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(INamedItem other)
        {
            var otherComplex = other as EntityContainer;

            if (otherComplex == null)
            {
                return(false);
            }

            return((this.Name == otherComplex.Name) && (this.NamespaceName == otherComplex.NamespaceName));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            EnumType otherEnum = other as EnumType;

            if (otherEnum == null)
            {
                return(false);
            }

            return((this.Name == otherEnum.Name) && (this.NamespaceName == otherEnum.NamespaceName));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherFunction = other as Function;

            if (otherFunction == null)
            {
                return(false);
            }

            return((this.Name == otherFunction.Name) && (this.NamespaceName == otherFunction.NamespaceName));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherAssociation = other as AssociationType;

            if (otherAssociation == null)
            {
                return(false);
            }

            return((this.Name == otherAssociation.Name) && (this.NamespaceName == otherAssociation.NamespaceName));
        }
Ejemplo n.º 20
0
        public TreeNode(INamedItem item) : this()
        {
            setupHeader(item);

            _subject            = item;
            ContextMenu         = new ContextMenu();
            ContextMenuOpening += TreeNode_ContextMenuOpening;

            this.Bind(MouseAction.LeftDoubleClick).ToMessage(() => new OpenItemMessage(item));
            this.Bind(Key.Enter).ToMessage(() => new OpenItemMessage(item));
            this.BindControlAnd(MouseAction.LeftClick).ToMessage(() => new ExecuteTestMessage(item.AllTests));
        }
        private void ItemSelectedDelegate(INamedItem item)
        {
            if (item == null)
                return;

            m_gameInstance.SendPaintersRequest(new ShowListSelectionWindow(false));
            m_gameInstance.SetHandlerName("InventoryItem", "Inventory");

            List<ItemOptions> optionList = m_engine.GameState.GetOptionsForInventoryItem((IItem)item);
            m_gameInstance.SendPaintersRequest(new ShowInventoryItemWindow(true, (IItem)item, optionList));
            m_gameInstance.UpdatePainters();
        }
Ejemplo n.º 22
0
        public TreeNode(INamedItem item)
            : this()
        {
            setupHeader(item);

            _subject = item;
            ContextMenu = new ContextMenu();
            ContextMenuOpening += TreeNode_ContextMenuOpening;

            this.Bind(MouseAction.LeftDoubleClick).ToMessage(() => new OpenItemMessage(item));
            this.Bind(Key.Enter).ToMessage(() => new OpenItemMessage(item));
            this.BindControlAnd(MouseAction.LeftClick).ToMessage(() => new ExecuteTestMessage(item.AllTests));
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Called when an item was registered.
        /// </summary>
        /// <param name="item">The item that was registered.</param>
        public override void RegisteredItem(object item)
        {
            INamedItem namedItem = item as INamedItem;

            if (namedItem != null)
            {
                this.log.DebugFormat("Registered item '{0}' with name '{1}'.", item, namedItem.EventBrokerItemName);
            }
            else
            {
                this.log.DebugFormat("Registered item '{0}'.", item);
            }
        }
        private void EquipmentSelectedDelegate(INamedItem item)
        {
            // Don't try to pop out information on slots without equipment or "your fists"
            if (item != null && item.DisplayName != "Melee")
            {
                m_gameInstance.SendPaintersRequest(new ShowEquipmentWindow(false));
                m_gameInstance.SetHandlerName("InventoryItem", "Equipment");

                List<ItemOptions> optionList = m_engine.GameState.GetOptionsForEquipmentItem((IItem)item);
                m_gameInstance.SendPaintersRequest(new ShowInventoryItemWindow(true, (IItem)item, optionList));
            }
            m_gameInstance.UpdatePainters();
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CoCoL.Network.PendingNetworkRequest"/> class for representing a read request.
 /// </summary>
 /// <param name="channel">The channel to communicate over.</param>
 /// <param name="channeldatatype">The datatype on the channel.</param>
 /// <param name="timeout">The timeout associated with the request.</param>
 /// <param name="offer">The two-phase offer, if any.</param>
 /// <param name="task">The <see cref="System.Threading.Tasks.TaskCompletionSource&lt;T&gt;"/> instance for signaling.</param>
 public PendingNetworkRequest(INamedItem channel, Type channeldatatype, DateTime timeout, ITwoPhaseOffer offer, object task)
 {
     ChannelID         = channel.Name;
     AssociatedChannel = channel;
     ChannelDataType   = channeldatatype;
     RequestID         = Guid.NewGuid().ToString("N");
     SourceID          = NetworkConfig.SelfID;
     Timeout           = timeout;
     Offer             = offer;
     Task        = task;
     RequestType = NetworkMessageType.ReadRequest;
     NoOffer     = offer == null;
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Called when an item was unregistered.
        /// </summary>
        /// <param name="item">The item that was unregistered.</param>
        public override void UnregisteredItem(object item)
        {
            INamedItem namedItem = item as INamedItem;

            if (namedItem != null)
            {
                Debug.WriteLine("Unregistered item '{0}' with name '{1}'.", item, namedItem.EventBrokerItemName);
            }
            else
            {
                Debug.WriteLine("Unregistered item '{0}'.", item);
            }
        }
Ejemplo n.º 27
0
        public TreeNode(INamedItem item)
        {
            setupHeader(item);

            _subject = item;
            _runTest = new ActionCommand(runTest);
            ContextMenu = new ContextMenu();
            ContextMenuOpening += TreeNode_ContextMenuOpening;

            MouseDoubleClick += (s, args) => Top().OnSelection(this);

            //TODO: Yuck.  Need to find a better way to do this.
            InputBindings.Add(new InputBinding(_runTest, new MouseGesture(MouseAction.LeftClick, ModifierKeys.Control)));
        }
        private Type GetClrType(INamedItem nominalType, IEnumerable <Assembly> assemblies)
        {
            Type clrType = assemblies
                           .Where(a => a != null).Select(a => a.GetTypes()
                                                         .Where(t => t.Name == nominalType.Name && t.Namespace == nominalType.NamespaceName).SingleOrDefault())
                           .Where(t => t != null).SingleOrDefault();

            if (clrType == null)
            {
                throw new TaupoInvalidOperationException(
                          string.Format(CultureInfo.InvariantCulture, "Failed to create object data generator for '{0}.{1}' type because it cannot be found in the supplied assemblies.", nominalType.NamespaceName, nominalType.Name));
            }

            return(clrType);
        }
Ejemplo n.º 29
0
        public static void SaveAs(IContentView view)
        {
            IStorableContent content = view.Content as IStorableContent;

            if (!view.Locked && content != null)
            {
                if (saveFileDialog == null)
                {
                    saveFileDialog             = new SaveFileDialog();
                    saveFileDialog.Title       = "Save Item";
                    saveFileDialog.DefaultExt  = "hl";
                    saveFileDialog.Filter      = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";
                    saveFileDialog.FilterIndex = 2;
                }

                INamedItem namedItem         = content as INamedItem;
                string     suggestedFileName = string.Empty;
                if (!string.IsNullOrEmpty(content.Filename))
                {
                    suggestedFileName = content.Filename;
                }
                else if (namedItem != null)
                {
                    suggestedFileName = namedItem.Name;
                }
                else
                {
                    suggestedFileName = "Item";
                }

                saveFileDialog.FileName = suggestedFileName;

                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    MainFormManager.GetMainForm <HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
                    SetSaveOperationProgressInContentViews(content, true, saveFileDialog.FileName);
                    if (saveFileDialog.FilterIndex == 1)
                    {
                        ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted);
                    }
                    else
                    {
                        ContentManager.SaveAsync(content, saveFileDialog.FileName, true, SavingCompleted);
                    }
                }
            }
        }
Ejemplo n.º 30
0
 private void OnSampleLoaded(INamedItem sample, ListViewGroup group, double progress)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <INamedItem, ListViewGroup, double>(OnSampleLoaded), sample, group, progress);
     }
     else
     {
         ListViewItem item = new ListViewItem(new string[] { sample.Name, sample.Description }, group);
         item.ToolTipText = sample.ItemName + ": " + sample.ItemDescription;
         samplesListView.SmallImageList.Images.Add(sample.ItemImage);
         item.ImageIndex = samplesListView.SmallImageList.Images.Count - 1;
         item.Tag        = sample;
         samplesListView.Items.Add(item);
         this.progress.ProgressValue += progress;
     }
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Gets the fully qualified name (Namespace.Name or Alias.Name)
        /// </summary>
        /// <param name="namedItem">The item that has a Namespace and a Name.</param>
        /// <returns>The fully qualified name.</returns>
        public string GetFullyQualifiedName(INamedItem namedItem)
        {
            string prefix = string.Empty;
            if (namedItem.NamespaceName != null)
            {
                string alias;
                if (this.TryGetAlias(namedItem.NamespaceName, out alias))
                {
                    prefix = alias + ".";
                }
                else
                {
                    prefix = namedItem.NamespaceName + ".";
                }
            }

            return prefix + namedItem.Name;
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Gets the fully qualified name (Namespace.Name or Alias.Name)
        /// </summary>
        /// <param name="namedItem">The item that has a Namespace and a Name.</param>
        /// <returns>The fully qualified name.</returns>
        public string GetFullyQualifiedName(INamedItem namedItem)
        {
            string prefix = string.Empty;

            if (namedItem.NamespaceName != null)
            {
                string alias;
                if (this.TryGetAlias(namedItem.NamespaceName, out alias))
                {
                    prefix = alias + ".";
                }
                else
                {
                    prefix = namedItem.NamespaceName + ".";
                }
            }

            return(prefix + namedItem.Name);
        }
Ejemplo n.º 33
0
        public static Object FromNamedItem(CodeGenerationConfigBuilder builder, INamedItem namedItem)
        {
            Object returnItem = null;

            if (namedItem is RoslynClassMetadata classMetadata && ClassImpl.FromMetadata(classMetadata, null) is Class @class)
            {
                returnItem = @class;
            }
            if (namedItem is RoslynEnumMetadata enumMetadata && EnumImpl.FromMetadata(enumMetadata, null) is Enum @enum)
            {
                returnItem = @enum;
            }
            if (namedItem is RoslynInterfaceMetadata interfaceMetadata && InterfaceImpl.FromMetadata(interfaceMetadata, null) is Interface @interface)
            {
                returnItem = @interface;
            }
            if (returnItem != null)
            {
                returnItem.Template = builder.Input.Template;
            }
            return(returnItem);
        }
Ejemplo n.º 34
0
        private void setupHeader(INamedItem item)
        {
            var stack = new TreeStack()
            {
                Orientation = Orientation.Horizontal,
                Background  = new SolidColorBrush(Colors.Transparent)
            };

            _image = new Image();


            stack.Children.Add(_image);
            _label = new Label
            {
                Content    = item.Name.GetLabelTextWithoutHotkey(),
                Background = new SolidColorBrush(Colors.Transparent)
            };
            stack.Children.Add(_label);
            Header = stack;

            Icon = Icon.Unknown;
        }
Ejemplo n.º 35
0
        /// <summary>
        /// Called when the event was fired (processing completed).
        /// </summary>
        /// <param name="eventTopic">The event topic.</param>
        /// <param name="publication">The publication.</param>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public override void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e)
        {
            INamedItem namedItem = publication.Publisher as INamedItem;

            if (namedItem != null)
            {
                Debug.WriteLine(
                    "Fired event '{0}'. Invoked by publisher '{1}' with name '{2}' with sender '{3}' and EventArgs '{4}'.",
                    eventTopic.Uri,
                    publication.Publisher,
                    namedItem.EventBrokerItemName,
                    sender,
                    e);
            }
            else
            {
                Debug.WriteLine(
                    "Fired event '{0}'. Invoked by publisher '{1}' with sender '{2}' and EventArgs '{3}'.",
                    eventTopic.Uri,
                    publication.Publisher,
                    sender,
                    e);
            }
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherEntity = other as EntityType;
            if (otherEntity == null)
            {
                return false;
            }

            return (this.Name == otherEntity.Name) && (this.NamespaceName == otherEntity.NamespaceName);
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            var otherAssociation = other as AssociationType;
            if (otherAssociation == null)
            {
                return false;
            }

            return (this.Name == otherAssociation.Name) && (this.NamespaceName == otherAssociation.NamespaceName);
        }
Ejemplo n.º 38
0
        private void setupHeader(INamedItem item)
        {
            var stack = new TreeStack()
            {
                Orientation = Orientation.Horizontal,
                Background = new SolidColorBrush(Colors.Transparent)
            };
            _image = new Image();

            stack.Children.Add(_image);
            _label = new Label
            {
                Content = item.Name.GetLabelTextWithoutHotkey(),
                Background = new SolidColorBrush(Colors.Transparent)
            };
            stack.Children.Add(_label);
            Header = stack;

            Icon = Icon.Unknown;
        }
Ejemplo n.º 39
0
 /// <summary>
 /// Check if the item that has Name and Namespace is valid
 /// </summary>
 /// <param name="item">The item to be checked</param>
 /// <returns>true if the item is valid, false otherwise.</returns>
 protected abstract bool IsNamedItemValid(INamedItem item);
Ejemplo n.º 40
0
 private void OnSampleLoaded(INamedItem sample, ListViewGroup group, double progress) {
   if (InvokeRequired)
     Invoke(new Action<INamedItem, ListViewGroup, double>(OnSampleLoaded), sample, group, progress);
   else {
     ListViewItem item = new ListViewItem(new string[] { sample.Name, sample.Description }, group);
     item.ToolTipText = sample.ItemName + ": " + sample.ItemDescription;
     samplesListView.SmallImageList.Images.Add(sample.ItemImage);
     item.ImageIndex = samplesListView.SmallImageList.Images.Count - 1;
     item.Tag = sample;
     samplesListView.Items.Add(item);
     this.progress.ProgressValue += progress;
   }
 }
Ejemplo n.º 41
0
        private void MapDebuggingSelectedDelegate(INamedItem item)
        {
            if (item == null)
                return;

            switch (item.DisplayName)
            {
                case "Debug Map Moveable":
                    m_gameInstance.SendPaintersRequest(new ToggleDebuggingMoveable(m_engine));
                    m_gameInstance.UpdatePainters();
                    break;
                case "Debug FOV":
                    m_gameInstance.SendPaintersRequest(new ToggleDebuggingFOV(m_engine));
                    m_gameInstance.UpdatePainters();
                    break;
                case "Toggle FOV":
                    m_gameInstance.SendPaintersRequest(new SwapFOVEnabledStatus());
                    m_gameInstance.UpdatePainters();
                    break;
            }
            m_option = OptionMode.DebugMainMenu;
            Escape();
        }   
Ejemplo n.º 42
0
 private void CreateMonsterSelectedDelegate(INamedItem monster)
 {
     m_spawnItem = false;
     m_toSpawnName = monster.DisplayName;
     SetCreateLevelMenu(5);
     m_gameInstance.UpdatePainters();
 }
Ejemplo n.º 43
0
        public void OpenScreen(INamedItem subject)
        {
            IScreenLocator screenLocator = _screenObjectLocator.BuildSubject(subject);

            OpenScreen(screenLocator);
        }
Ejemplo n.º 44
0
 public bool IsEnabled(INamedItem item)
 {
     return m_shouldBeSelectedDelegate != null ? m_shouldBeSelectedDelegate(item) : true; 
 }
Ejemplo n.º 45
0
        private void setupHeader(INamedItem item)
        {
            var stack = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };
            _image = new Image();
            stack.Children.Add(_image);
            _label = new Label
            {
                Content = item.Name,
            };
            stack.Children.Add(_label);
            Header = stack;

            Icon = Icon.Unknown;
        }
Ejemplo n.º 46
0
 public ValidationStates ValidateNameProperty(INamedItem toValidate)
 {
     return(ValidateToStates(this.namedItemValidator, toValidate));
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Determines where the specified <see cref="INamedItem"/> is equal to this instance.
 /// </summary>
 /// <param name="other">The other <see cref="INamedItem"/>.</param>
 /// <returns>A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.</returns>
 public abstract bool Equals(INamedItem other);
Ejemplo n.º 48
0
 /// <summary>
 /// Check if the item that has Name and Namespace is valid
 /// </summary>
 /// <param name="item">The item to be checked</param>
 /// <returns>true if the item is valid, false otherwise.</returns>
 protected abstract bool IsNamedItemValid(INamedItem item);
Ejemplo n.º 49
0
 /// <summary>
 /// Perform the fix up on the item that has Name and Namespace
 /// </summary>
 /// <param name="item">The item to be fixed up</param>
 protected abstract void FixupNamedItem(INamedItem item);
Ejemplo n.º 50
0
 /// <summary>
 /// Determines where the specified <see cref="INamedItem"/> is equal to this instance.
 /// </summary>
 /// <param name="other">The other <see cref="INamedItem"/>.</param>
 /// <returns>A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.</returns>
 public abstract bool Equals(INamedItem other);
Ejemplo n.º 51
0
 private void CreateItemSelectedDelegate(INamedItem item)
 {
     m_spawnItem = true;
     m_toSpawnName = item.DisplayName;
     SetCreateLevelMenu(10);
     m_gameInstance.UpdatePainters();
 }
 public void OpenScreen(INamedItem subject)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 53
0
 private void CreateLevelSelectedDelegate(INamedItem item)
 {
     if (item == null)
         return;
     if (m_spawnItem)
         m_engine.Debugger.DebugRequest("SpawnItem", new Pair<string, int>(m_toSpawnName, int.Parse(item.DisplayName, CultureInfo.InvariantCulture)));
     else
         m_engine.Debugger.DebugRequest("SpawnMonster", new Pair<string, int>(m_toSpawnName, int.Parse(item.DisplayName, CultureInfo.InvariantCulture)));
     m_option = OptionMode.DebugMainMenu;
     Escape();
 }
Ejemplo n.º 54
0
 public OpenItemMessage(INamedItem item)
 {
     _item = item;
 }
 /// <summary>
 /// Check if the item that has Name and Namespace is valid
 /// </summary>
 /// <param name="item">The item to be checked</param>
 /// <returns>true if the item is valid, false otherwise.</returns>        
 protected override bool IsNamedItemValid(INamedItem item)
 {
     return item.NamespaceName != null;
 }
Ejemplo n.º 56
0
 public RemoveItemEventArgs(INamedItem item)
 {
     RemoveItem = item;
 }
Ejemplo n.º 57
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(INamedItem other)
        {
            var otherComplex = other as EntityContainer;
            if (otherComplex == null)
            {
                return false;
            }

            return (this.Name == otherComplex.Name) && (this.NamespaceName == otherComplex.NamespaceName);
        }
Ejemplo n.º 58
0
 /// <summary>
 /// Gets the fully qualified name
 /// </summary>
 /// <param name="type">the type name</param>
 /// <returns>the fully qualified name</returns>
 private string GetFullyQualifiedName(INamedItem type)
 {
     return(this.NamespaceAliasManager.GetFullyQualifiedName(type));
 }
Ejemplo n.º 59
0
    private void RegisterNamedItemEvents(INamedItem namedItem) {
      namedItem.ToStringChanged += new EventHandler(namedItem_ToStringChanged);
      namedItem.ItemImageChanged += new EventHandler(namedItem_ItemImageChanged);

      var algorithm = namedItem as IAlgorithm;
      var batchRun = namedItem as BatchRun;
      var experiment = namedItem as Experiment;

      if (algorithm != null) {
        algorithm.Prepared += new EventHandler(algorithm_Prepared);
        algorithm.ProblemChanged += new EventHandler(algorithm_ProblemChanged);
      } else if (batchRun != null) {
        batchRun.OptimizerChanged += new EventHandler(batchRun_OptimizerChanged);
        batchRun.RepetetionsCounterChanged += new EventHandler(batchRun_RepetitionsCounterChanged);
        batchRun.RepetitionsChanged += new EventHandler(batchRun_RepetitionsChanged);
      } else if (experiment != null) {
        experiment.Optimizers.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsAdded);
        experiment.Optimizers.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsMoved);
        experiment.Optimizers.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsRemoved);
        experiment.Optimizers.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_ItemsReplaced);
        experiment.Optimizers.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<IOptimizer>>(Optimizers_CollectionReset);
      }
    }
Ejemplo n.º 60
0
        /// <summary>
        /// Determines whether the specified <see cref="INamedItem"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="INamedItem"/> to compare with this instance.</param>
        /// <returns>
        /// A value of <c>true</c> if the specified <see cref="INamedItem"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(INamedItem other)
        {
            EnumType otherEnum = other as EnumType;
            if (otherEnum == null)
            {
                return false;
            }

            return (this.Name == otherEnum.Name) && (this.NamespaceName == otherEnum.NamespaceName);
        }