Ejemplo n.º 1
0
        public bool Execute()
        {
            bool bRet = false;
            if (calcinitFlag == false || calc == null)
            {
                return bRet;
            }

            int iconut = 0;
            if (sampleDatas == null)
            {
                sampleDatas = new SampleDataManager();
                if (sampleDatas == null)
                {
                    return bRet;
                }
                sampleDatas.FolderPath = this.CurFilePath;

                //1万件分読み込んでおく
                sampleDatas.DeserializeData(0, 10000);
            }

            int start = 0;
            int Calcstart = 0;
            iconut = sampleDatas.SamplesCount;
            try
            {
                for (int i = 0; i < iconut; i++)
                {
                    SampleData x = (SampleData)sampleDatas.GetRange(start, 1)[0];

                    for (int j = 0; j < x.ChannelDatas.Length; j++)
                    {
                        if (x.ChannelDatas[j].DataValues.GetType() == typeof(Value_Standard))
                        {
                            valVariable[j] = (double)((Value_Standard)x.ChannelDatas[j].DataValues).Value;
                        }
                        else if (x.ChannelDatas[j].DataValues.GetType() == typeof(Value_Mode2))
                        {
                            valVariable[j] = 0;// (double)((Value_Mode2)x.ChannelDatas[j].DataValues).Values;
                        }
                        else if (x.ChannelDatas[j].DataValues.GetType() == typeof(Value_MaxMin))
                        {
                            valVariable[j] = (double)((Value_MaxMin)x.ChannelDatas[j].DataValues).MinValue;
                        }

                    }

                    //演算実行
                    if (calc.Execute(ref strErrorMessage) < 0)
                    {
                        //error
                        MessageBox.Show(strErrorMessage + "\n", "演算実行", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    }

                    Calcstart = 0;
                    for (int j = 0; j < iCalcIndex.Length; j++)
                    {
                        if (iCalcIndex[j] > 0)
                        {
                            int idx = iCalcIndex[j];

                            if (x.ChannelDatas[idx].DataValues.GetType() == typeof(Value_Standard))
                            {
                                ((Value_Standard)x.ChannelDatas[idx].DataValues).Value = (decimal)valCalcResult[Calcstart];
                            }
                            else if (x.ChannelDatas[idx].DataValues.GetType() == typeof(Value_Mode2))
                            {
                                //((Value_Standard)x.ChannelDatas[idx].DataValues).Value = (decimal)valCalcResult[Calcstart];
                            }
                            else if (x.ChannelDatas[idx].DataValues.GetType() == typeof(Value_MaxMin))
                            {
                                ((Value_MaxMin)x.ChannelDatas[idx].DataValues).MinValue = (decimal)valCalcResult[Calcstart];
                            }
                            Calcstart++;

                        }
                    }

                    start++;
                }

            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
            return bRet;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// データのデシリアライズ
        /// </summary>
        /// <param name="xmlFilename"></param>
        public void Deserialize_Data_forInit(string xmlFilename)
        {
            sampleDatas = new SampleDataManager();
            sampleDatas.FolderPath = System.IO.Path.GetDirectoryName(xmlFilename);

            //1万件分読み込んでおく
            sampleDatas.DeserializeData(0, 10000);

        }