private void CbTypeSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (IsLoaded)
     {
         TypeChanged?.Invoke(this, e);
     }
 }
예제 #2
0
        public void Handle(TypeChanged e)
        {
            if (e.TypeId.HasValue)
            {
                var type = _elastic.Get <Configuration.AccountType.Responses.Index>(e.TypeId.Value).Source;

                _elastic.Update <Responses.Index, Object>(x => x
                                                          .Id(e.AccountId)
                                                          .Doc(new { TypeId = e.TypeId, Type = type.Name })
                                                          .RetryOnConflict(3)
                                                          .Refresh()
                                                          );
            }
            else
            {
                _elastic.Update <Responses.Index, Object>(x => x
                                                          .Id(e.AccountId)
                                                          .Doc(new { TypeId = (Guid?)null, Type = "" })
                                                          .RetryOnConflict(3)
                                                          .Refresh()
                                                          );
            }

            var index = _elastic.Get <Responses.Index>(e.AccountId);

            _manager.Publish(index.Source);
        }
예제 #3
0
        private void PopulateDecoratorNodes(GenericMenu menu, BonsaiNode node)
        {
            var decorators = BonsaiEditor.RegisteredBehaviourNodeTypes.Where(t => t.IsSubclassOf(typeof(BTAuxiliary)) && !t.IsAbstract);

            foreach (var subclass in decorators)
            {
                menu.AddItem(new GUIContent("Decorator/" + subclass.Name), false, () =>
                {
                    CreateNodeRequest?.Invoke("Decorator", subclass);
                    TypeChanged?.Invoke(this, node);
                });
            }
        }
예제 #4
0
        private void InitializeSaveChanges(MessageUpdate msg, Configurations config, out TestALMethod testALMethod, out int scenarioLine, out int elementLine, bool elementOfNewValue, out List <string> fileContent, out ScenarioElementType scenarioElementType, out string oldProcedureNameOfElement, out string newProcedureNameOfElement)
        {
            string               scenarioName         = msg.Scenario;
            string               fsPath               = msg.FsPath;
            string               elementOldValue      = msg.OldValue;
            string               elementNewValue      = msg.NewValue;
            TypeChanged          typeChanged          = msg.Type;
            ALTestCodeunitReader alTestCodeunitReader = new ALTestCodeunitReader();
            TestALCodeunit       testCodeunit         = (TestALCodeunit)alTestCodeunitReader.ReadSingle(fsPath);

            testALMethod        = testCodeunit.Methods.First(m => (m.Scenario != null) && (m.Scenario.Name == scenarioName));
            scenarioElementType = Library.ALMethodHelper.ToEnum <ScenarioElementType>(typeChanged.ToString().ToUpper());

            if (elementOldValue == null)
            {
                oldProcedureNameOfElement = "";
            }
            else
            {
                oldProcedureNameOfElement = Library.ALMethodHelper.GetProcedurename(scenarioElementType, elementOldValue, config.prefixGiven, config.prefixWhen, config.prefixThen);
            }
            if (elementNewValue == null)
            {
                newProcedureNameOfElement = "";
            }
            else
            {
                newProcedureNameOfElement = Library.ALMethodHelper.GetProcedurename(scenarioElementType, elementNewValue, config.prefixGiven, config.prefixWhen, config.prefixThen);
            }

            fileContent  = File.ReadAllLines(fsPath).ToList();
            elementLine  = 0;
            scenarioLine = Library.Helpers.ALTestCodeunitHelper.FindScenarioLine(testALMethod.Scenario.Name, fileContent);
            if (scenarioLine == 0)
            {
                return;
            }

            if (elementOfNewValue)
            {
                elementLine = Library.Helpers.ALTestCodeunitHelper.FindElementLine(fileContent, scenarioElementType, elementNewValue, scenarioLine);
            }
            else
            {
                elementLine = Library.Helpers.ALTestCodeunitHelper.FindElementLine(fileContent, scenarioElementType, elementOldValue, scenarioLine);
            }
            if (elementLine == 0)
            {
                return;
            }
        }
        private void PopulateTypeConversions(GenericMenu menu, BonsaiNode node)
        {
            Type coreType       = BonsaiEditor.CoreType(node.Behaviour);
            var  behaviourTypes = BonsaiEditor.RegisteredBehaviourNodeTypes;

            foreach (Type subclass in behaviourTypes.Where(t => t.IsSubclassOf(coreType) && !t.IsAbstract))
            {
                menu.AddItem(new GUIContent("Change Type/" + subclass.Name), false, () =>
                {
                    EditorChangeNodeType.ChangeType(node, subclass);
                    TypeChanged?.Invoke(this, node);
                });
            }
        }
예제 #6
0
        public TypeContextMenu(VisualizerTable table, TypeChanged typeChanged, AVGPRStateChanged avgprChanged, Action processCopy, InsertRow insertRow)
        {
            _table = table;

            var typeItems = ((VariableType[])Enum.GetValues(typeof(VariableType)))
                            .Select(type => new MenuItem(type.ToString(), (s, e) => typeChanged(_currentRow, type)));

            var fgColor = new MenuItem("Font Color", new[]
            {
                new MenuItem("Green", (s, e) => _table.ApplyRowHighlight(_currentRow, changeFg: DataHighlightColor.Green)),
                new MenuItem("Red", (s, e) => _table.ApplyRowHighlight(_currentRow, changeFg: DataHighlightColor.Red)),
                new MenuItem("Blue", (s, e) => _table.ApplyRowHighlight(_currentRow, changeFg: DataHighlightColor.Blue)),
                new MenuItem("None", (s, e) => _table.ApplyRowHighlight(_currentRow, changeFg: DataHighlightColor.None))
            });
            var bgColor = new MenuItem("Background Color", new[]
            {
                new MenuItem("Green", (s, e) => _table.ApplyRowHighlight(_currentRow, changeBg: DataHighlightColor.Green)),
                new MenuItem("Red", (s, e) => _table.ApplyRowHighlight(_currentRow, changeBg: DataHighlightColor.Red)),
                new MenuItem("Blue", (s, e) => _table.ApplyRowHighlight(_currentRow, changeBg: DataHighlightColor.Blue)),
                new MenuItem("None", (s, e) => _table.ApplyRowHighlight(_currentRow, changeBg: DataHighlightColor.None))
            });

            var insertRowBefore = new MenuItem("Insert Row Before", (s, e) => insertRow(_currentRow, false));
            var insertRowAfter  = new MenuItem("Insert Row After", (s, e) => insertRow(_currentRow, true));

            _avgprButton = new MenuItem("AVGPR", (s, e) =>
            {
                _avgprButton.Checked = !_avgprButton.Checked;
                avgprChanged(_currentRow, _avgprButton.Checked);
            });

            var copy = new MenuItem("Copy", (s, e) => processCopy());

            var menuItems = typeItems.Concat(new[]
            {
                new MenuItem("-"),
                fgColor,
                bgColor,
                new MenuItem("-"),
                copy,
                new MenuItem("-"),
                insertRowBefore,
                insertRowAfter
                //_avgprButton
            });

            _menu = new ContextMenu(menuItems.ToArray());
        }
예제 #7
0
        public NetPoint(string nam, string desc, int lenght, Point loc)
        {
            name        = nam;
            description = desc;
            time        = lenght;
            location    = loc;
            connected.CollectionChanged += ChangeInside;
            TypeChanged?.Invoke(this, EventArgs.Empty);
            string dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

            for (int i = 0; i < 8; i++)
            {
                Random rnd = new Random();
                id += dict[rnd.Next(dict.Count() - 1)];
            }
        }
예제 #8
0
 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (!IsLoaded)
     {
         return;
     }
     if (MainType.Equals("CAST"))
     {
         cbSecondType.Visibility = Visibility.Visible;
         Appear(cbSecondType);
     }
     else if (cbSecondType.Visibility == Visibility.Visible)
     {
         cbSecondType.Visibility = Visibility.Hidden;
         Disappear(cbSecondType);
     }
     TypeChanged?.Invoke(this, e);
 }
예제 #9
0
        private void AddNewElementToCode(MessageUpdate msg, Configurations config)
        {
            string      scenarioName = msg.Scenario;
            TypeChanged typeChanged  = msg.Type;
            string      fsPath       = msg.FsPath;
            string      elementValue = msg.NewValue;

            if (typeChanged == TypeChanged.Feature)
            {
                List <string> fileContent = new List <string>();
                fileContent.AddRange(Library.Helpers.ALTestCodeunitHelper.GetDefaultTestCodeunitText(elementValue));
                WriteFile(fsPath, fileContent);
            }
            else
            {
                InitializeSaveChanges(msg, config, out TestALMethod testALMethod, out int scenarioLine, out int elementLine, false, out List <string> fileContent, out ScenarioElementType scenarioElementType, out string dummyProcedureNameOfElement, out string procedureNameToCall);
                if (scenarioLine == 0)
                {
                    return;
                }

                int lineToInsert = Library.ALMethodHelper.FindLineToInsertElement(testALMethod, fileContent, scenarioLine, scenarioElementType);
                if (lineToInsert == 0)
                {
                    return;
                }

                bool addLineBreak = testALMethod.Scenario.Elements.Where(e => e.Type == scenarioElementType).Count() == 0;

                Library.Helpers.ALTestMethodHelper.AddElement(ref fileContent, elementValue, scenarioElementType, ref lineToInsert);
                Library.Helpers.ALTestMethodHelper.AddProcedureCall(ref fileContent, procedureNameToCall, ref lineToInsert);
                Library.Helpers.ALTestCodeunitHelper.AddProcedure(ref fileContent, procedureNameToCall, config.addException);

                WriteFile(fsPath, fileContent);
            }
        }
예제 #10
0
        public void Handle(TypeChanged e)
        {
            using (var session = _store.OpenSession())
            {
                var get = session.Load <Responses.Get>(e.AccountId);

                if (e.TypeId.HasValue)
                {
                    var type = _elastic.Get <Configuration.AccountType.Responses.Index>(e.TypeId.Value);

                    get.TypeId = e.TypeId;
                    get.Type   = type.Source.Name;
                }
                else
                {
                    get.TypeId = null;
                    get.Type   = "";
                }

                session.SaveChanges();

                _manager.Publish(get);
            }
        }
 private void OnTypeChanged(object sender, IProductType productType)
 {
     TypeChanged?.Invoke(this, productType);
 }
예제 #12
0
 protected void OnTypeChanged(CellTypeChangedEventArgs arg)
 {
     TypeChanged?.Invoke(this, arg);
 }