private void Handle( GetValues msg )
 {
     foreach ( var child in Context.GetChildren() )
     {
         child.Tell( msg );
     }
 }
 private void Handle(GetValues msg)
 {
     foreach (var child in Context.GetChildren())
     {
         child.Tell(msg);
     }
 }
示例#3
0
        public void ThenSelectChartTypeFromDropdown_(Table table)
        {
            ExplicitWaiting.waitForTime(15000);
            GetValues _type = table.CreateInstance <GetValues>();

            HelpingFunctions.SelectChartType(_type.ChartType);
        }
示例#4
0
        private void checkLink()
        {
            GetValues value  = new GetValues();
            string    com    = value.getPort();
            int       baud   = value.getBaud();
            int       timeot = value.getTimeout();

            serialPort1.PortName    = com;
            serialPort1.BaudRate    = baud;
            serialPort1.ReadTimeout = timeot;
            serialPort1.Open();
            if (serialPort1.IsOpen)
            {
                label1.Visible = true;
            }
            else
            {
                MessageBox.Show("Komunikacija sa modemom se ne može uspostaviti, molimo postavite novu konfiguraciju...!");
                this.Controls.Clear();
                SMSConfigPanel cfg = new SMSConfigPanel();
                cfg.Show();
                this.Controls.Add(cfg);
            }
            serialPort1.Close();
        }
示例#5
0
        public void GetThreeTest()
        {
            GetValues gv  = new GetValues();
            int       res = gv.GetThree();

            Assert.IsTrue(res == 3);
        }
示例#6
0
        public void ThenSelectDeformationModeFromDropdown_(Table table)
        {
            ExplicitWaiting.waitForTime(3000);
            GetValues _deformationType = table.CreateInstance <GetValues>();

            HelpingFunctions.SelectDeformationMode(_deformationType.DeformationMode);
        }
示例#7
0
    public MappedDataReader(IDataReader dataReader, GetValues getValues)
    {
        ArgumentNullException.ThrowIfNull(dataReader);
        ArgumentNullException.ThrowIfNull(getValues);

        _dataReader = dataReader;
        _getValues  = getValues;
    }
    public MappedDataReader(IDataReader dataReader, GetValues getValues)
    {
        Assert.IsNotNull(dataReader);
        Assert.IsNotNull(getValues);

        _dataReader = dataReader;
        _getValues  = getValues;
    }
示例#9
0
        public object Any(GetValues request)
        {
            var response = new GetValuesResponse
            {
                Values = new ArrayOfString(
                    Redis.GetValues(request.Keys)
                    )
            };

            return(response);
        }
        public Dictionary <Tuple <int, string>, Tuple <DateTime, float> > Automatic(List <PodaciIzBaze> podaci)
        {
            ObradaPodatakaZaDB obrada = new ObradaPodatakaZaDB();
            GetValues          obr    = new GetValues();

            if (podaci == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var item in podaci)
            {
                if (String.IsNullOrEmpty(item.ID))
                {
                    throw new ArgumentNullException();
                }
                if (item.Vrednost < 0 || item.Vrednost > float.MaxValue)
                {
                    throw new ArgumentOutOfRangeException();
                }
                if (item.Vreme > (SqlDateTime)DateTime.Now)
                {
                    throw new VremeException();
                }
            }

            ICalculationFunctions f = new CalculationFunctions();
            List <int>            listaIDFunkcija = obr.GetIDFunkcija();

            Dictionary <string, List <float> > vrednostiZaOdredjenoPodrucje   = obr.GetVrijednostiZaGeoPodrucje(podaci);
            Dictionary <Tuple <int, string>, Tuple <DateTime, float> > retVal = new Dictionary <Tuple <int, string>, Tuple <DateTime, float> >();

            foreach (var item1 in listaIDFunkcija)
            {
                foreach (var item2 in vrednostiZaOdredjenoPodrucje)
                {
                    if (item1 == 1)
                    {
                        retVal.Add(new Tuple <int, string>(1, item2.Key), new Tuple <DateTime, float>(DateTime.Now, f.Average(item2.Value)));
                    }
                    else if (item1 == 2)
                    {
                        retVal.Add(new Tuple <int, string>(2, item2.Key), new Tuple <DateTime, float>(DateTime.Now, f.Maximum(item2.Value)));
                    }
                    else if (item1 == 3)
                    {
                        retVal.Add(new Tuple <int, string>(3, item2.Key), new Tuple <DateTime, float>(DateTime.Now, f.Minimum(item2.Value)));
                    }
                }
            }

            return(retVal);
        }
示例#11
0
        private void SetGetNamesDelegate()
        {
            GetNames = delegate(ref List<Record> storage, string valueToCompare, int binarySearchIndex)
            {
                Record recordBuffer;

                while (binarySearchIndex > 0)
                {
                    recordBuffer = new Record(path, positions[sortedNames[binarySearchIndex - 1]]);
                    if (recordBuffer.name != valueToCompare)
                    {
                        break;
                    }
                    --binarySearchIndex;
                }

                while (binarySearchIndex < sortedNames.Length)
                {
                    recordBuffer = new Record(path, positions[sortedNames[binarySearchIndex]]);

                    if (recordBuffer.name != valueToCompare)
                    {
                        break;
                    }
                    else
                    {
                        storage.Add(recordBuffer);
                        ++binarySearchIndex;
                    }
                }
            };
        }
示例#12
0
        static private ConfigObject[] readConfig()
        {
            if (!System.IO.File.Exists(_configFilePath))
            {
                return(new ConfigObject[] { });
            }

            var fullPath     = System.IO.Path.GetFullPath(_configFilePath);
            var fileInfo     = new System.IO.FileInfo(fullPath);
            var excelPackage = new ExcelPackage(fileInfo);

            var workbook = excelPackage.Workbook;

            var rawConfigObject = workbook.Worksheets.Select(sheet =>
            {
                var cells           = sheet.Cells;
                var InspectName     = cells[1, 2].GetValue <string>();
                var TopSentence     = cells[2, 2].GetValue <string>();
                var RankCount       = cells[5, 2].GetValue <int>();
                var RankNames       = GetValues <string>(cells, (5, 3), (5, 2 + RankCount)).First(); //Enumerable.Range(3, 2 + RankCount).Select(j => $"{cells[5, j].Value}").ToArray();//  cells[5, 3, 5, 2 + RankCount].GetValue<string[]>();
                var RankMaxVals     = GetValues <int>(cells, (6, 3), (6, 2 + RankCount)).First();    //Enumerable.Range(3, 2 + RankCount).Select(j => Convert.ToInt32(cells[6, j].Value)).ToArray();//(cells[6, 3, 6, 2 + RankCount].Value as Object[]).OfType<int>().ToArray();
                var RankMinVal      = cells[7, 2].GetValue <int>();
                var ChoiceCount     = cells[10, 2].GetValue <int>();
                var ChoiceStrings   = GetValues <string>(cells, (10, 3), (10, 2 + ChoiceCount)).First();                            //(cells[10, 3, 10, 2 + ChoiceCount].Value as Object[]).OfType<string>().ToArray();
                var QuestionCount   = cells[12, 2].GetValue <int>();                                                                //Convert.ToInt32(cells[12, 2].Value);
                var QuestionStrings = GetValues <string>(cells, (14, 2), (13 + QuestionCount, 2)).Select(x => x.First()).ToArray(); //(cells[14, 2, 13 + QuestionCount, 2].Value as Object[]).OfType<string>().ToArray();
                var AnswerEvals     = GetValues <int>(cells, (14, 3), (13 + QuestionCount, 2 + ChoiceCount));                       //Enumerable.Range(0, AnswerEvalsTmp.GetLength(0)).
                return(new
                {
                    InspectName,
                    TopSentence,
                    RankCount,
                    RankNames,
                    RankMaxVals,
                    RankMinVal,
                    ChoiceCount,
                    ChoiceStrings,
                    QuestionCount,
                    QuestionStrings,
                    AnswerEvals
                });
            }
                                                             ).ToArray();

            return(rawConfigObject.Select(
                       rawConfig =>
                       new ConfigObject()
            {
                Name = rawConfig.InspectName,
                TopSentence = rawConfig.TopSentence,
                Ranks = rawConfig.RankMaxVals.
                        Prepend(rawConfig.RankMinVal).
                        Zip(rawConfig.RankMaxVals, (min, max) => (min, max)).
                        Zip(
                    rawConfig.RankNames,
                    (minmax, name) =>
                    new Rank()
                {
                    RankName = name, Lower = minmax.min, Upper = minmax.max
                }
                    ).ToArray(),
                Choices = rawConfig.ChoiceStrings,
                Questions = rawConfig.QuestionStrings.
                            Select((str, index) => (str, index)).
                            Zip(
                    rawConfig.AnswerEvals,
                    (strAndIndex, evals) =>
                    new Question(strAndIndex.index + 1, strAndIndex.str, evals)
                    ).ToArray()
            }
示例#13
0
        public void ThenSelectAdhesiveTypeFromDropdown_(Table table)
        {
            GetValues _adhesive = table.CreateInstance <GetValues>();

            HelpingFunctions.SelectAdhesiveType(_adhesive.AdhesiveType);
        }
示例#14
0
 private void Handle( GetValues msg )
 {
     Sender.Tell( new PublishMetrics( m_MetricName, m_value) );
 }
示例#15
0
        public void ThenSelectModelPhaseFromDropdown_(Table table)
        {
            GetValues _model = table.CreateInstance <GetValues>();

            HelpingFunctions.SelectModelPhase(_model.ModelPhase);
        }
示例#16
0
/*        class Factorial
 *      {
 *          public double display(double n)
 *          {
 *              double res = 1;
 *              while (n != 1)
 *              {
 *                  res = res * n;
 *                  n = n - 1;
 *              }
 *              return res;
 *          }
 *      }*/

        public void button_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;


            Calculate?.Invoke(values, Convert.ToDouble(textBox1.Text), button.Text);
            string x = GetValues?.Invoke();

            listBox1.Items.Add(x);

            #region

            /*                switch (button.Text)
             *              {
             *                  case "Прибавить":
             *
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          values[i] = values[i] + Convert.ToDouble(textBox1.Text);
             *                          label1.Text = string.Join("; ", values);
             *                      }
             *                      listBox1.Items.Add(label1.Text);
             *                      s(button.Text);
             *                      break;
             *
             *                  case "Отнять":
             *
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          values[i] = values[i] - Convert.ToDouble(textBox1.Text);
             *                          label1.Text = string.Join("; ", values);
             *                      }
             *                      listBox1.Items.Add(label1.Text);
             *                      break;
             *
             *                  case "Умножить":
             *
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          values[i] = values[i] * Convert.ToDouble(textBox1.Text);
             *                          label1.Text = string.Join("; ", values);
             *                      }
             *                      listBox1.Items.Add(label1.Text);
             *                      break;
             *
             *                  case "Разделить":
             *                      if (textBox1.Text == "0")
             *                          MessageBox.Show("Деление на 0", "Ошибка");
             *                      else
             *                      {
             *                          for (int i = 0; i < values.Length; i++)
             *                          {
             *                              values[i] = values[i] / Convert.ToDouble(textBox1.Text);
             *                              label1.Text = string.Join("; ", values);
             *                          }
             *                          listBox1.Items.Add(label1.Text);
             *                      }
             *                      break;
             *
             *                  case "Возвести в квадрат":
             *
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          values[i] = Math.Pow(values[i], 2);
             *                          label1.Text = string.Join("; ", values);
             *                      }
             *                      listBox1.Items.Add(label1.Text);
             *                      break;
             *
             *                  case "Возвести в степень":
             *                      if (Convert.ToDouble(textBox1.Text) % 1 != 0)
             *                          MessageBox.Show("Степень не целое число", "Ошибка");
             *                      else
             *                      {
             *                          for (int i = 0; i < values.Length; i++)
             *                          {
             *                              values[i] = Math.Pow(values[i], Convert.ToDouble(textBox1.Text));
             *                              label1.Text = string.Join("; ", values);
             *                          }
             *                          listBox1.Items.Add(label1.Text);
             *                      }
             *                      break;
             *
             *                  case "Квадратный корень":
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          if (values[i] < 0)
             *                              MessageBox.Show("Под корнем отрицательное число", "Ошибка");
             *                          else
             *                          {
             *                              values[i] = Math.Sqrt(values[i]);
             *                              label1.Text = string.Join("; ", values);
             *                          }
             *                      }
             *                      listBox1.Items.Add(label1.Text);
             *                      break;
             *
             *                  case "Корень заданной степени":
             *                      if (Convert.ToDouble(textBox1.Text) % 1 != 0)
             *                          MessageBox.Show("Степень не целое число", "Ошибка");
             *                      else
             *                      {
             *                          for (int i = 0; i < values.Length; i++)
             *                          {
             *                              if (values[i] < 0)
             *                                  MessageBox.Show("Под корнем отрицательное число", "Ошибка");
             *                              else
             *                              {
             *                                  values[i] = Math.Pow(values[i], 1.0 / Convert.ToDouble(textBox1.Text));
             *                                  label1.Text = string.Join("; ", values);
             *                              }
             *                          }
             *                          listBox1.Items.Add(label1.Text);
             *                      }
             *                      break;
             *                  case "Логарифм по заданному основанию":
             *
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          if (Convert.ToDouble(textBox1.Text) < 0 | values[i] < 0)
             *                              MessageBox.Show("Логарифм отрицательного числа", "Ошибка");
             *                          else
             *                          {
             *                              values[i] = Math.Log(values[i]) / Math.Log(Convert.ToDouble(textBox1.Text));
             *                              label1.Text = string.Join("; ", values);
             *                          }
             *                      }
             *                      listBox1.Items.Add(label1.Text);
             *                      break;
             *                  case "Факториал":
             *
             *                      for (int i = 0; i < values.Length; i++)
             *                      {
             *                          if (Convert.ToDouble(values[i]) % 1 != 0)
             *                          {
             *                              MessageBox.Show("Факториал не целого числа", "Ошибка");
             *                              break;
             *                          }
             *                          else
             *                          {
             *                              Factorial fact = new Factorial();
             *                              values[i] = fact.display(values[i]);
             *                              label1.Text = string.Join("; ", values);
             *                          }
             *                          listBox1.Items.Add(label1.Text);
             *                      }
             *                      break;
             *
             *                  case "Медиана":
             *
             *                      Array.Sort(values);
             *                      if (values.Length % 2 == 0)
             *                      {
             *                          double med = (values[values.Length / 2] + values[values.Length / 2 - 1]) / 2;
             *                          Array.Resize(ref values, 1);
             *                          values[0] = med;
             *                      }
             *                      else
             *                      {
             *                          double med = values[values.Length / 2];
             *                          Array.Resize(ref values, 1);
             *                          values[0] = med;
             *                      }
             *                      label1.Text = string.Join("; ", values);
             *                      listBox1.Items.Add(label1.Text);
             *
             *                      break;
             *
             *                  case "Стандартное отклонение":
             *
             *                      double av = 0;
             *                      double t = 0;
             *                      foreach (double i in values)
             *                          av += i;
             *                      av = av / values.Length;
             *                      foreach (double i in values)
             *                          t += Math.Pow(i - av, 2);
             *                      t = t / values.Length;
             *                      Array.Resize(ref values, 1);
             *                      values[0] = Math.Sqrt(t);
             *
             *                      label1.Text = string.Join("; ", values);
             *                      listBox1.Items.Add(label1.Text);
             *
             *                      break;
             *                  default:
             *                      break;
             *              }*/
            #endregion
        }
示例#17
0
 private void Handle(GetValues msg)
 {
     Sender.Tell(new PublishMetrics(m_MetricName, m_value));
 }