Ejemplo n.º 1
0
        /// <summary>
        /// Merge address
        /// </summary>
        /// <param name="to">end address</param>
        /// <param name="Item">variable item</param>
        /// <param name="lastArrayLength">array length</param>
        public override void Merge(IAddress to, VariableItem Item, int?lastArrayLength)
        {
            Item.DataType = DataType.UInt16Bytes;
            switch (MemoryArea)
            {
            case FinsMemoryArea.WR:
            {
                Item.DataType = DataType.BooleanBytes;
                break;
            }
            }

            Item.ReadAddress  = ComputeAddress();
            Item.WriteAddress = Item.ReadAddress;
            Item.ArrayLength  = to.MainAddress - MainAddress + Item.DataType.SizeIn(MemoryArea);
            if (lastArrayLength.HasValue && lastArrayLength.Value > 1)
            {
                Item.ArrayLength += (lastArrayLength.Value - 1) * Item.DataType.SizeIn(MemoryArea);
            }

            switch (MemoryArea)
            {
            case FinsMemoryArea.WR:
            {
                Item.ReadAddress += ".0";
                Item.ArrayLength  = Item.ArrayLength.Value * 16;
                break;
            }
            }
        }
        public List <VariableItem> ProcessResults(List <VariableItem> results)
        {
            // delete ?
            string currentquestion    = "";
            List <VariableItem> items = new List <VariableItem>();

            foreach (var result in results)
            {
                if (result.description != null)
                {
                    currentquestion = result.description;
                }
                if (result.selected == true)
                {
                    VariableItem item = new VariableItem();
                    item.uniqueId     = result.uniqueId;
                    item.equivalence  = result.equivalence;
                    item.name         = result.name;
                    item.description  = currentquestion;
                    item.counter      = result.counter;
                    item.questionName = result.questionName;
                    item.questionText = currentquestion;
                    item.studyGroup   = result.studyGroup;
                    item.study        = result.study;
                    item.questionItem = result.questionItem;
                    item.identifier   = result.identifier;
                    item.concept      = result.concept;
                    item.column       = result.column;
                    item.selected     = result.selected;
                    items.Add(item);
                }
            }
            return(items);
        }
Ejemplo n.º 3
0
        public void TestVariableItem()
        {
            Interpreter interp = new Interpreter();

            VariableItem varItem = new VariableItem();

            varItem.VariableValue = new IntItem(100);

            // Simulate creation of finding a variable
            var word = new PushStackItemWord("x", varItem);

            word.Execute(interp);

            Assert.AreEqual(1, interp.stack.Count);
            dynamic item = interp.stack.Peek();
            dynamic val  = item.VariableValue;

            Assert.AreEqual(100, val.IntValue);

            // Change variable value and check that the original changed, too
            item.VariableValue = new IntItem(21);
            dynamic val2 = varItem.VariableValue;

            Assert.AreEqual(21, val2.IntValue);
        }
Ejemplo n.º 4
0
        public void AddVariable(ref VariableItem variable, double x, double y)
        {
            var gsMenu = new GetSetMenu(ref variable)
            {
                Host = this
            };

            AddChildren(gsMenu, x, y);
        }
Ejemplo n.º 5
0
 public ExecutionStackItem(Argument arg)
 {
     _variable = new VariableItem();
     _variable.Value = arg.Value;
     if(arg.Value.Type == HVMType.Variable)
     {
         _variable.Name = arg.Value.StringValue;
     }
 }
 private void assignRibbonItem_Click(object sender, RoutedEventArgs e)
 {
     if (lvVariables.SelectedItem != null)
     {
         _oldValue = (lvVariables.SelectedItem as VariableItem);
         VariableItem item = _oldValue.Clone <VariableItem>();
         _variables.Remove(_oldValue);
         ModalDialog(item, false);
     }
     SetRibbonButton();
 }
Ejemplo n.º 7
0
 public static void SetVariableType(VariableItem variableItem)
 {
     try
     {
         variableItem.Type = EnumHelper.GetIdByName<VariableItemType>(variableItem.TypeName);
     }
     catch (Exception ex)
     {
         throw new ArgumentException("\n>> " + TypeName + ".SetVariableType Error: " + ex.Message);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns the variable with the specified name.
        /// </summary>
        /// <param name="variableName">The variable name which to return.</param>
        /// <returns>The named variable.</returns>
        public VariableItem GetVariable(string variableName)
        {
            VariableItem item;

            if (!variableList.TryGetValue(variableName, out item))
            {
                item = new VariableItem(variableName);
                variableList.Add(variableName, item);
            }

            return(item);
        }
Ejemplo n.º 9
0
        public VariablesModel(PoolControl poolControl, IHardwareManager hardwareManager)
        {
            var state = poolControl.GetPoolControlInformation().SystemState;

            this.Outputs = hardwareManager.GetOutputs().ToArray();

            this.Variables = new List <VariableItem>();
            this.Variables.Add(VariableItem.Create("Température extérieure", state.AirTemperature));
            this.Variables.Add(VariableItem.Create("Température eau brute (sonde)", state.WaterTemperature));
            this.Variables.Add(VariableItem.Create("Température min jour", state.PoolTemperatureMinOfTheDay));
            this.Variables.Add(VariableItem.Create("Température max jour", state.PoolTemperatureMaxOfTheDay));
            this.Variables.Add(VariableItem.Create("Température de consigne", state.PoolTemperatureDecision));
            this.Variables.Add(VariableItem.Create("Température du bassin", state.PoolTemperature));
            this.Variables.Add(VariableItem.Create("Durée de filtration/jour", state.PumpingDurationPerDayInHours));
            this.Variables.Add(VariableItem.Create("Pompe", state.Pump));
        }
        public AssignVariable(VariableItem variableItem, IWizardHostService host, bool variableIsInputVariable)
            : base(variableItem)
        {
            InitializeComponent();

            txtVariabelValue.ContextBrowserButton = btnContextBrowse2;
            txtVariabelValue.PluginContext        = host.ServiceProvider;
            if (variableIsInputVariable)
            {
                txtVariabelValue.AddingFieldPart += new AddingPartHandler(addingFieldPart_CheckRead);
            }
            else
            {
                txtVariabelValue.AddingFieldPart += new AddingPartHandler(addingFieldPart_CheckWrite);
            }
        }
Ejemplo n.º 11
0
Archivo: Cgt.cs Proyecto: bubbafat/HVM
        public override void Execute(ExecutionEnvironment environment)
        {
            environment.LocalStack.DemandSize(2, this);

            ExecutionStackItem item_rhs = environment.LocalStack.PopItem();
            VariableItem var_rhs = environment.LocalStack.Scope.ResolveStackItem(item_rhs);

            ExecutionStackItem item_lhs = environment.LocalStack.PopItem();
            VariableItem var_lhs = environment.LocalStack.Scope.ResolveStackItem(item_lhs);

            bool result = (var_lhs.Value.CompareTo(var_rhs.Value) > 0);

            VariableItem v = new VariableItem(null, result);

            environment.LocalStack.PushItem(new ExecutionStackItem(v));
        }
        private void ModalDialog(VariableItem item, bool add)
        {
            IModalWindow modalDialog = null;

            try
            {
                _dialogPage = new AssignVariable(item, base.Wizard.Host, VariableIsInputVariable);
                modalDialog = base.Wizard.Host.ShowModalWindow(new IWizardPage[] { _dialogPage }, new System.Drawing.Size((int)_dialogPage.Width, (int)_dialogPage.Height), false);
                modalDialog.ShowButton(ModalWindowButtonTypes.OK);
                modalDialog.ShowButton(ModalWindowButtonTypes.Cancel);
                modalDialog.OKClicked += new EventHandler <ModalWindowButtonClickEventArgs>(modalDialog_OKClicked);
                if (add)
                {
                    modalDialog.SetTitle("Add Variable");
                }
                else
                {
                    modalDialog.SetTitle("Assign Variable");
                    modalDialog.CancelClicked += new EventHandler <ModalWindowButtonClickEventArgs>(modalDialog_CancelClicked);
                }

                modalDialog.Show();
            }
            catch (Exception Ex)
            {
                ModalWindow.ShowMessage(base.Wizard.Host.WindowHandle, ModalWindowIconTypes.Error, "K2", Ex.Message.ToString(), new ModalWindowButtonTypes[] { ModalWindowButtonTypes.OK });
            }
            finally
            {
                if (_dialogPage != null)
                {
                    _dialogPage.Dispose();
                    _dialogPage = null;
                }

                if (modalDialog != null)
                {
                    modalDialog.OKClicked -= modalDialog_OKClicked;
                    if (!add)
                    {
                        modalDialog.CancelClicked -= modalDialog_CancelClicked;
                    }
                    modalDialog.Dispose();
                    modalDialog = null;
                }
            }
        }
Ejemplo n.º 13
0
        public GetSetMenu(ref VariableItem variable)
        {
            Style = (Style)FindResource("GetSetMenu");
            var item = variable;

            Loaded += (e, i) =>
            {
                ApplyTemplate();
                Variable    = item;
                Get         = (Button)Template.FindName("GetButton", this);
                Set         = (Button)Template.FindName("SetButton", this);
                Get.Click  += Get_Click;
                Set.Click  += Set_Click;
                MouseLeave += (s, ee) =>
                              Host.Children.Remove(this);
            };
        }
        public List <VariableItem> ProcessResults(RepositoryItemMetadata result, List <VariableItem> items, QuestionModel model, string equivalence, int uniqueId, int counter)
        {
            var variables = RepositoryHelper.GetReferences(result.AgencyId, result.Identifier).Where(x => x.ItemType == new Guid("683889c6-f74b-4d5e-92ed-908c0a42bb2d"));

            foreach (var variable in variables)
            {
                VariableItem item = new VariableItem();
                item.name         = null;
                item.description  = variable.DisplayLabel;
                item.counter      = counter;
                item.questionName = variable.ItemName.FirstOrDefault().Value;
                item.questionText = variable.Label.FirstOrDefault().Value;
                item.questionItem = variable.CompositeId.ToString();
                item.parentitem   = result.Identifier.ToString();
                item.studyGroup   = variable.AgencyId;
                item.identifier   = variable.Identifier;

                var concept = (from a in model.AllConcepts
                               where a.ItemType == result.Identifier
                               select a).FirstOrDefault();
                var v = RepositoryHelper.GetConcept(result.AgencyId, result.Identifier);
                RepositoryItemMetadata mainconcept = new RepositoryItemMetadata();
                if (concept != null)
                {
                    mainconcept = RepositoryHelper.GetConcept(concept.AgencyId, concept.Identifier);
                }
                var dataset = RepositoryHelper.GetConcept(variable.AgencyId, variable.Identifier);
                if (concept != null)
                {
                    item.concept = concept.Label.Values.FirstOrDefault() + " - " + mainconcept.Label.Values.FirstOrDefault();
                }
                item.description  = variable.Label.Values.FirstOrDefault();
                item.questionText = item.description;
                item.questionName = variable.ItemName.Values.FirstOrDefault();
                item.study        = RepositoryHelper.GetStudy(result.AgencyId, result.Identifier);
                item.name         = variable.DisplayLabel;

                items.Add(item);
                item.uniqueId    = uniqueId;
                item.equivalence = equivalence.Trim();
                // item.column = RepositoryHelper.GetStudyColumn(item.study, model.StudyId);
                item.selected     = true;
                item.isdeprecated = variable.IsDeprecated;
            }
            return(items);
        }
Ejemplo n.º 15
0
 public Get(VirtualControl host, VariableItem variable, bool spontaneousAddition) : base(host,
                                                                                         NodeTypes.VariableGet,
                                                                                         spontaneousAddition)
 {
     Host  = host;
     Title = string.Empty;
     AddObjectPort(this, "Return " + variable.Name, PortTypes.Output, RTypes.Generic, true);
     Description = @"Gets the value of " + variable.Name + ".";
     OutputPorts[0].Data.Value = variable.Name;
     if (variable.Type != null)
     {
         NodesManager.ChangeColorOfVariableNode(OutputPorts[0], variable.Type);
     }
     _item = variable;
     _item.Gets++;
     _item.DsOfNodes.Add(Id);
 }
        public AssignVariable(VariableItem variableItem, IWizardHostService host, bool variableIsInputVariable)
            : base(variableItem)
        {

            InitializeComponent();

            txtVariabelValue.ContextBrowserButton = btnContextBrowse2;
            txtVariabelValue.PluginContext = host.ServiceProvider;
            if (variableIsInputVariable)
            {
                txtVariabelValue.AddingFieldPart += new AddingPartHandler(addingFieldPart_CheckRead);
            }
            else
            {
                txtVariabelValue.AddingFieldPart += new AddingPartHandler(addingFieldPart_CheckWrite);

            }

        }
Ejemplo n.º 17
0
        public Set(VirtualControl host, VariableItem variable, bool spontaneousAddition) : base(host,
                                                                                                NodeTypes.VariableSet,
                                                                                                spontaneousAddition)
        {
            Title = "Set";
            Host  = host;

            AddExecPort(this, "", PortTypes.Input, "");
            AddExecPort(this, "", PortTypes.Output, "");
            AddObjectPort(this, variable.Name, PortTypes.Input, RTypes.Generic, false);
            Description = @"Sets the value of " + variable.Name + ".";
            if (variable.Type != null)
            {
                NodesManager.ChangeColorOfVariableNode(InputPorts[0], variable.Type);
            }
            variable.Sets++;
            _item = variable;
            _item.DsOfNodes.Add(Id);
            Console.WriteLine("Sets: " + variable.Gets);
        }
Ejemplo n.º 18
0
        public override void Execute(ExecutionEnvironment environment)
        {
            DemandArgs(1);

            Variable v = environment.LocalScope.ResolveAny(Arguments[0].Value.StringValue);

            if(v == null || v.Type != HVMType.Array)
            {
                throw new OpCodeArgumentException(0, HVMType.Variable, this);
            }

            VariableArray va = v as VariableArray;

            if(va == null)
            {
                throw new OpCodeArgumentException(0, HVMType.Variable, this);
            }

            VariableItem result = new VariableItem(null, va.Length);
            environment.LocalStack.PushItem(new ExecutionStackItem(result));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Returns the reference that matches the provided string. First the variables are searched, then the functions.
        /// If no reference are found that matches the name, a new variable is retruned.
        /// </summary>
        /// <param name="referenceName">The reference name to search for.</param>
        /// <returns>The mentioned reference.</returns>
        public ExpressionItem GetReference(string referenceName)
        {
            VariableItem varItem;
            FunctionItem funItem;

            //try to find a variable that matches the name.
            if (variableList.TryGetValue(referenceName, out varItem))
            {
                return(varItem);
            }
            //Try to find a function that matches the name.
            else if (functionList.TryGetValue(referenceName, out funItem))
            {
                return((FunctionItem)funItem.Clone());
            }

            //No matches
            //Create new variable and return it.
            varItem = new VariableItem(referenceName);
            variableList.Add(referenceName, varItem);

            return(varItem);
        }
Ejemplo n.º 20
0
 public override void Merge(IAddress to, VariableItem item, int?lastArrayLength)
 {
     throw new System.NotImplementedException();
 }
        public QuestionModel PopulateQuestionMessages(QuestionModel model, List <TreeViewNode> selecteditems)
        {
            // keep
            List <VariableItem> items = new List <VariableItem>();
            int    i        = 0;
            int    j        = 0;
            string question = null;

            List <Word>   words1    = new List <Word>();
            List <string> wordList1 = model.WordSelection.Split(',').ToList();

            foreach (var word in wordList1)
            {
                if (word.Trim().Length != 0)
                {
                    Word currentword = new Word();
                    currentword.Value = word;
                    words1.Add(currentword);
                }
            }

            List <RepositoryItemMetadata> questions1 = new List <RepositoryItemMetadata>();
            List <RepositoryItemMetadata> questions2 = new List <RepositoryItemMetadata>();

            foreach (var selectedword in words1)
            {
                questions1 = model.AllVariables;
                questions2 = model.AllVariables;
                List <Word>   words2    = new List <Word>();
                List <string> wordList2 = selectedword.Value.Split(' ').ToList();
                foreach (var word2 in wordList2)
                {
                    Word currentword = new Word();
                    currentword.Value = word2;
                    words2.Add(currentword);
                }
                foreach (var selectedword2 in words2)
                {
                    questions1 = (from a in questions1
                                  where words2.Any(word => a.Label.FirstOrDefault().Value.ToLower().Contains(selectedword2.Value.ToLower()))
                                  select a).ToList();
                }

                //var questions3 = (from a in questions1
                //                group a by a.Identifier into a1
                //                 select new { Identifier = a1.Key, Count = a1.Count() }).ToList();

                //questions1 = questions1.OrderBy(x => x.Identifier).ToList();
                if (questions1.Count != 0)
                {
                    i++;

                    foreach (var result in questions1)
                    {
                        var question4 = questions1.FirstOrDefault(x => x.Identifier == result.Identifier);

                        j++;
                        VariableItem item = new VariableItem();
                        item.name         = null;
                        item.description  = question4.DisplayLabel;
                        item.counter      = j;
                        item.questionName = question4.ItemName.FirstOrDefault().Value;
                        item.questionText = question4.DisplayLabel;
                        item.questionItem = question4.CompositeId.ToString();
                        item.parentitem   = question4.ItemType.ToString();
                        item.studyGroup   = question4.AgencyId;
                        item.identifier   = question4.Identifier;

                        var concept = (from a in model.AllConcepts
                                       where a.ItemType == question4.ItemType
                                       select a).FirstOrDefault();
                        var v           = RepositoryHelper.GetConcept(question4.AgencyId, question4.Identifier);
                        var mainconcept = RepositoryHelper.GetConcept(concept.AgencyId, concept.Identifier);
                        var dataset     = RepositoryHelper.GetConcept(question4.AgencyId, question4.Identifier);
                        item.concept      = concept.Label.Values.FirstOrDefault() + " - " + mainconcept.Label.Values.FirstOrDefault();
                        item.description  = question4.Label.Values.FirstOrDefault();
                        item.questionText = item.description;
                        item.questionName = question4.ItemName.Values.FirstOrDefault();
                        item.study        = RepositoryHelper.GetStudy(question4.AgencyId, question4.ItemType);
                        item.name         = question4.DisplayLabel;

                        items.Add(item);
                        item.uniqueId    = i;
                        item.equivalence = selectedword.Value;
                        // item.column = RepositoryHelper.GetStudyColumn(item.study, model.StudyId);
                        item.selected     = true;
                        item.isdeprecated = question4.IsDeprecated;
                        question          = question4.DisplayLabel;
                    }
                }
            }
            model.AllResults = items;
            return(model);
        }
Ejemplo n.º 22
0
 public override void Execute(ExecutionEnvironment environment)
 {
     DemandArgs(1);
     VariableItem v = new VariableItem(null, Arguments[0].Value.StringValue);
     environment.LocalStack.PushItem(new ExecutionStackItem(v));
 }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            Scanner sc;

            try
            {
                sc = new Scanner(null);
                Console.WriteLine("Fail");
                Console.WriteLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine();
            }

            sc = new Scanner("Hej på dig min lilla vän", "ll");

            while (sc.HasNext())
            {
                Console.WriteLine(sc.Peek());
                Console.WriteLine(sc.Next());
            }

            string testString = "hej123   34uie 12 87.23e+45 .23 34E-100 .9E32 +-*/";

            Console.WriteLine(testString);
            Scanner sc0 = new Scanner(testString);

            State        state;
            List <Token> tokenList = new List <Token>();

            while (sc0.HasNext())
            {
                state = new Q0State(sc0);

                while (!state.IsComplete())
                {
                    state = state.Next();
                }

                tokenList.Add(state.Token);
            }

            ReferenceResolver resolver = ReferenceResolver.GetResolver();
            VariableItem      item     = resolver.GetVariable("hej123");

            item.Value = 123456789;
            VariableItem[] items = resolver.Variables;

            List <ExpressionItem> itemList = new List <ExpressionItem>();

            for (int i = 0; i < tokenList.Count; i++)
            {
                Console.WriteLine(tokenList.ElementAt(i));
                itemList.Add(tokenList.ElementAt(i).GetExpressionItem());
            }

            Console.WriteLine();
            Console.WriteLine();

            for (int i = 0; i < itemList.Count; i++)
            {
                try
                {
                    Console.WriteLine(itemList.ElementAt(i).Value);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            Console.WriteLine();
            Console.WriteLine();

            items = resolver.Variables;

            for (int i = 0; i < items.Length; i++)
            {
                Console.WriteLine(items[i].Value);
            }

            string expressionString = "1+2*-variable";

            Console.WriteLine(expressionString);
            Scanner sc1 = new Scanner(expressionString);

            State        state1;
            List <Token> tokenList1 = new List <Token>();

            while (sc1.HasNext())
            {
                state1 = new Q0State(sc1);

                while (!state1.IsComplete())
                {
                    state1 = state1.Next();
                }

                tokenList1.Add(state1.Token);
            }

            List <ExpressionItem> itemList1 = new List <ExpressionItem>();

            for (int i = 0; i < tokenList1.Count; i++)
            {
                Console.WriteLine(tokenList1.ElementAt(i));
                itemList1.Add(tokenList1.ElementAt(i).GetExpressionItem());
            }

            Interpreter    interpreter = new Interpreter(itemList1);
            ExpressionItem item1;

            try
            {
                item1 = interpreter.Interpret();
                Console.WriteLine(item1.Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.Source);
                Console.WriteLine(ex.StackTrace);
            }
            Console.Read();
        }
        public QuestionModel PopulateQuestionMessages(QuestionModel model, List <TreeViewNode> selecteditems, string type)
        {
            List <VariableItem> items = new List <VariableItem>();
            int    i        = 0;
            int    j        = 0;
            string question = null;

            List <Word> words1 = new List <Word>();

            List <RepositoryItemMetadata> questions = new List <RepositoryItemMetadata>();

            foreach (var selectedwords in model.WordList)
            {
                questions = model.AllQuestions;
                List <Word>   words2    = new List <Word>();
                List <string> wordList2 = selectedwords.Value.Split(' ').ToList();
                foreach (var word2 in wordList2)
                {
                    Word currentword = new Word();
                    currentword.Value = word2;
                    words2.Add(currentword);
                }
                string selectedword = "";
                foreach (var currentword in words2)
                {
                    selectedword = " " + currentword.Value + " ";
                    questions    = (from a in questions
                                    where words2.Any(word => a.Summary.FirstOrDefault().Value.ToLower().Contains(selectedword.ToLower()))
                                    select a).ToList();
                }

                if (questions.Count != 0)
                {
                    i++;

                    foreach (var result in questions)
                    {
                        var question4 = questions.FirstOrDefault(x => x.Identifier == result.Identifier);

                        j++;
                        if (type == "Question")
                        {
                            VariableItem item = new VariableItem();
                            item.name         = null;
                            item.description  = question4.DisplayLabel;
                            item.counter      = j;
                            item.questionName = question4.ItemName.FirstOrDefault().Value;
                            item.questionText = question4.DisplayLabel;
                            item.questionItem = question4.CompositeId.ToString();
                            item.parentitem   = question4.ItemType.ToString();
                            item.studyGroup   = question4.AgencyId;
                            item.identifier   = question4.Identifier;

                            var concept = (from a in model.AllConcepts
                                           where a.ItemType == question4.Identifier
                                           select a).FirstOrDefault();
                            var v = RepositoryHelper.GetConcept(question4.AgencyId, question4.Identifier);
                            RepositoryItemMetadata mainconcept = new RepositoryItemMetadata();
                            if (concept != null)
                            {
                                mainconcept = RepositoryHelper.GetConcept(concept.AgencyId, concept.Identifier);
                            }
                            var dataset = RepositoryHelper.GetConcept(question4.AgencyId, question4.Identifier);
                            if (concept != null)
                            {
                                item.concept = concept.Label.Values.FirstOrDefault() + " - " + mainconcept.Label.Values.FirstOrDefault();
                            }
                            item.description  = question4.Summary.Values.FirstOrDefault();
                            item.questionText = item.description;
                            item.questionName = question4.ItemName.Values.FirstOrDefault();
                            item.study        = RepositoryHelper.GetStudy(question4.AgencyId, question4.Identifier);
                            item.name         = question4.DisplayLabel;

                            items.Add(item);
                            item.uniqueId    = i;
                            item.equivalence = selectedword.Trim();
                            // item.column = RepositoryHelper.GetStudyColumn(item.study, model.StudyId);
                            item.selected     = true;
                            item.isdeprecated = question4.IsDeprecated;
                            question          = question4.DisplayLabel;
                        }
                        else
                        {
                            items = ProcessResults(result, items, model, selectedword, i, j);
                        }
                        if (model.SelectedStudies.Count == 1)
                        {
                            model.StudyName = RepositoryHelper.GetStudy(result.AgencyId, result.Identifier);
                        }
                    }
                }
            }
            model.AllResults = items;
            return(model);
        }
 private void addRibbonItem_Click(object sender, RoutedEventArgs e)
 {
     this._oldValue = null;
     ModalDialog(new VariableItem(), true);
     SetRibbonButton();
 }
        private void ModalDialog(VariableItem item, bool add)
        {
            IModalWindow modalDialog = null;
            try
            {
                _dialogPage = new AssignVariable(item, base.Wizard.Host, VariableIsInputVariable);
                modalDialog = base.Wizard.Host.ShowModalWindow(new IWizardPage[] { _dialogPage }, new System.Drawing.Size((int)_dialogPage.Width, (int)_dialogPage.Height), false);
                modalDialog.ShowButton(ModalWindowButtonTypes.OK);
                modalDialog.ShowButton(ModalWindowButtonTypes.Cancel);
                modalDialog.OKClicked += new EventHandler<ModalWindowButtonClickEventArgs>(modalDialog_OKClicked);
                if (add)
                {
                    modalDialog.SetTitle("Add Variable");
                }
                else
                {
                    modalDialog.SetTitle("Assign Variable");
                    modalDialog.CancelClicked += new EventHandler<ModalWindowButtonClickEventArgs>(modalDialog_CancelClicked);
                }

                modalDialog.Show();
            }
            catch (Exception Ex)
            {
                ModalWindow.ShowMessage(base.Wizard.Host.WindowHandle, ModalWindowIconTypes.Error, "K2", Ex.Message.ToString(), new ModalWindowButtonTypes[] { ModalWindowButtonTypes.OK });
            }
            finally
            {
                if (_dialogPage != null)
                {
                    _dialogPage.Dispose();
                    _dialogPage = null;
                }

                if (modalDialog != null)
                {
                    modalDialog.OKClicked -= modalDialog_OKClicked;
                    if (!add)
                    {
                        modalDialog.CancelClicked -= modalDialog_CancelClicked;
                    }
                    modalDialog.Dispose();
                    modalDialog = null;
                }
            }

        }
 private void assignRibbonItem_Click(object sender, RoutedEventArgs e)
 {
     if (lvVariables.SelectedItem != null)
     {
         _oldValue = (lvVariables.SelectedItem as VariableItem);
         VariableItem item = _oldValue.Clone<VariableItem>();
         _variables.Remove(_oldValue);
         ModalDialog(item, false);
     }
     SetRibbonButton();
 }
 private void addRibbonItem_Click(object sender, RoutedEventArgs e)
 {
     this._oldValue = null;
     ModalDialog(new VariableItem(), true);
     SetRibbonButton();
 }
Ejemplo n.º 29
0
 public ExecutionStackItem(VariableItem v)
 {
     _variable = v.Clone() as VariableItem;
 }
Ejemplo n.º 30
0
        private void ProcessToolCheck()
        {
            try
            {
                string Too_Value_Flag = "";
                int    ArryCount      = 0;

                commStatus = NetRemoting.Comm_IDGet(EquipInfo.WORKCENTER + "_" + EquipInfo.ROUTE_NO);
                if (commStatus != null)
                {
                    Dictionary <string, Dabom.TagAdapter.Item.VariableItem> mVariableItems = (new Dabom.TagAdapter.StateParse(commStatus)).ToVariableItems();//DICTIONARY 넣기

                    //------------------------- 수정 2017.02.21-------------------------------------
                    VariableItem result = new VariableItem();

                    //string[] Tool_Value = mVariableItems["TOOL_VALUE"].Value.ToString().Split(':');

                    string[] Tool_Value = null;
                    bool     exist      = mVariableItems.TryGetValue("TOOL_VALUE", out result);

                    if (exist)
                    {
                        Tool_Value = mVariableItems["TOOL_VALUE"].Value.ToString().Split(':');
                    }

                    //--------------------------------------------------------------------------------


                    //if (Tool_Value[0].Equals("") && Tool_Value.Length == 1)
                    if (Tool_Value[0].Equals("") && Tool_Value.Length == 1)
                    {
                        ArryCount = 0;
                        // 2014 11 18 유민호 수정 ---------------------------------------------------------------------------
                        mVariableItems = null;
                        mVariableItems = (new Dabom.TagAdapter.StateParse(commStatus)).ToVariableItems();//DICTIONARY 넣기
                        Tool_Value     = mVariableItems["TOOL_VALUE"].Value.ToString().Split(':');
                        ArryCount      = Tool_Value.Length;
                        //if (Tool_Value[0].Equals("") && Tool_Value.Length == 1)
                        if (Tool_Value.Length == 1)
                        {
                            ArryCount = 0;
                        }
                        // 여기까지----------------------------------------------------------------------------------------------
                    }
                    else
                    {
                        ArryCount = Tool_Value.Length;
                    }


                    /////
                    slog = DateTime.Now + "[frmWorkElectricTool] :      " + "mVariableItems 개수  " + Tool_Value.Length + "ArryCount 개수" + ArryCount;
                    Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                    /////


                    //if (ArryCount > tgdToolRecvCnt && ArryCount != 0)
                    if (ArryCount > tgdToolRecvCnt && ArryCount != 0 && tgdTotalCnt != 0)
                    {
                        if (Tool_Value[ArryCount - 1].ToString().Split('_')[1].ToString() != "")
                        {
                            Too_Value_Flag = Tool_Value[ArryCount - 1].ToString().Split('_')[0].ToString();


                            ////
                            slog = DateTime.Now + "[ArryCount & tgdToolRecvCnt & tgdTotalCnt]  :      " + ArryCount + " // " + tgdTotalCnt + " // " + tgdToolRecvCnt + " // " + tgdToolOkCnt;
                            Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                            ////


                            if (Too_Value_Flag == "Y")
                            {
                                //////
                                slog = DateTime.Now + "[frmWorkElectricTool 측정값 OK] :      " + Tool_Value[ArryCount - 1].ToString().Split('_')[1].ToString() + "@" + tgdToolRecvCnt + "@" + ArryCount;
                                Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                                //////

                                if (double.Parse(Tool_Value[ArryCount - 1].ToString().Split('_')[1].ToString()) >= double.Parse(Low_Value) && double.Parse(Tool_Value[ArryCount - 1].ToString().Split('_')[1].ToString()) <= double.Parse(High_Value))
                                {
                                    dataGridView_Alc.Rows[tgdToolOkCnt].Cells["@@측정값"].Value        = Tool_Value[ArryCount - 1].ToString().Split('_')[1].ToString();
                                    dataGridView_Alc.Rows[tgdToolOkCnt].Cells["결과"].Value           = "OK";
                                    dataGridView_Alc.Rows[tgdToolOkCnt].Cells["결과"].Style.ForeColor = Color.Blue;

                                    tgdToolOkCnt++;
                                    Tool_Position();
                                }
                            }
                            else
                            {
                                //////
                                slog = DateTime.Now + "[frmWorkElectricTool 측정값 NG] :      " + dataGridView_Alc.Rows[tgdToolOkCnt].Cells["@@측정값"].Value;
                                Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                                //////

                                dataGridView_Alc.Rows[tgdToolOkCnt].Cells["@@측정값"].Value        = Tool_Value[ArryCount - 1].ToString().Split('_')[1].ToString();
                                dataGridView_Alc.Rows[tgdToolOkCnt].Cells["결과"].Value           = "NG";
                                dataGridView_Alc.Rows[tgdToolOkCnt].Cells["결과"].Style.ForeColor = Color.Red;
                            }

                            tgdToolRecvCnt++;
                        }
                    }



                    //그리드의 총 로우 수량과 체결 수량이 같으면 폼을 CLOSE 한다.
                    //2017.03.24 예외파트 구별로 인한 화면 멈춤현상 수정 : 전제 그리드 카운트가 0일 때 확인하는 방법
                    if (tgdTotalCnt == tgdToolOkCnt || tgdTotalCnt == 0)
                    {
                        //RESET
                        Dabom.TagAdapter.Item.WorkDataUp datup = new Dabom.TagAdapter.Item.WorkDataUp(EquipInfo.WORKCENTER + "_" + EquipInfo.ROUTE_NO, true);
                        datup.Variables.Add("TOOL_VALUE", new VariableItem {
                            VarID = "TOOL_VALUE", Value = ""
                        });
                        datup.Variables.Add("TR_ID", new VariableItem {
                            VarID = "TR_ID", Value = ""
                        });
                        NetRemoting.Comm_IDSet_Etool(datup);
                        //

                        //////
                        slog = DateTime.Now + "[frmWorkElectricTool-TAG TOO_VALUE/TR_ID 초기화 함] :      ";
                        Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                        //////

                        timer_Position.Enabled   = false;
                        timer_Tool_Check.Enabled = false;

                        //////
                        slog = DateTime.Now + "[frmWorkElectricTool TOOL 체결값 체크 끝] :      ";
                        Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                        //////

                        dataGridView_Alc.Refresh();
                        System.Threading.Thread.Sleep(500);

                        //////
                        slog = DateTime.Now + "[frmWorkElectricTool TOOL 작업 완료됨] :      ";
                        Global.EquipInfo.fhLog.TextFileWriteAppend(slog);
                        //////

                        //frmMsg = new frmMsg("WORK_COMPLETE", "작업이 완료 되었습니다!.");
                        //frmMsg.ShowDialog();
                        //frmMessageClose();
                        //System.Threading.Thread.Sleep(500);
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                slog = DateTime.Now + "[frmWorkElectricTool] : ProcessToolCheck     " + ex;
                Global.EquipInfo.fh_Err_Log.TextFileWriteAppend(slog);
            }
        }
Ejemplo n.º 31
0
 public override void Execute(ExecutionEnvironment environment)
 {
     string val = Console.ReadLine();
     VariableItem v = new VariableItem(null, val);
     environment.LocalStack.PushItem(new ExecutionStackItem(v));
 }