Пример #1
0
        public bool DodelaParametraProcesu(UlazniParametar velicina, IAnalizaProblema problem, ScintillaNET.Scintilla scintilla)
        {
            if (velicina != null)
            {
                var propertys = from f in problem.GetType().GetFields()
                                where f.GetCustomAttributes(typeof(UlazniParametar), false).Any()
                                select new AnalizaProcesa.PropertyEx()
                {
                    Field = f,
                    Atr   = f.GetCustomAttributes(typeof(UlazniParametar), false).First() as UlazniParametar
                };

                var property = (from p in propertys
                                where p.Atr.Ime == velicina.Ime
                                select p).FirstOrDefault();

                if (property != null)
                {
                    var dialog = new JednaVrednost();
                    dialog.label2.Text = property.Atr.Labela;

                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        property.Field.SetValue(problem, dialog.Vrednost);

                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public void PopuniCombo(ComboBox cmb, IAnalizaProblema problem)
        {
            var ulazneVelicine = (from f in problem.GetType().GetFields()
                                  where f.GetCustomAttributes(typeof(UlazniParametar), false).Any()
                                  select f.GetCustomAttributes(typeof(UlazniParametar), false).First()).ToList();

            foreach (var ulaznaVelicina in ulazneVelicine)
            {
                cmb.Items.Add(ulaznaVelicina);
            }
        }