public void LoadToXML(GLPoint[] data)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(GLPoint[]));
     TextWriter writer = new StreamWriter(Filename);
     serializer.Serialize(writer, data);
     writer.Dispose();
 }
Ejemplo n.º 2
0
        public void PushPoint(DateTime in_datetime, int in_value)
        {

            bool need_left_shift = true;
            for (int i = 0; i < GraphicLineDataArr.Length; i++)
            {
                if (GraphicLineDataArr[i]==null)
                {
                    GraphicLineDataArr[i] = new GLPoint();
                    GraphicLineDataArr[i].datetime = in_datetime;
                    GraphicLineDataArr[i].value = in_value;
                    need_left_shift = false;
                    break;
                }
            }



            if (need_left_shift)
            {

                //MessageBox.Show(GraphicLineDataArr[0].datetime.ToString()+ " " + GraphicLineDataArr[1].datetime.ToString());

                for (int i = 0; i < GraphicLineDataArr.Length-1; i++)
                {
                    GraphicLineDataArr[i].datetime = GraphicLineDataArr[i + 1].datetime;
                    GraphicLineDataArr[i].value = GraphicLineDataArr[i + 1].value;
                    //MessageBox.Show(GraphicLineDataArr[0].datetime.ToString() + " " + GraphicLineDataArr[1].datetime.ToString());
                }
                GraphicLineDataArr[GraphicLineDataArr.Length - 1].datetime = in_datetime;
                GraphicLineDataArr[GraphicLineDataArr.Length - 1].value = in_value;
            }




            //if (need_left_shift==true)
            //{
            //    for (int i = 0; i < GraphicLineDataArr.Length-1; i++)
            //    {
            //        GraphicLineDataArr[i] = GraphicLineDataArr[i + 1];
            //    }
            //    GraphicLineDataArr[GraphicLineDataArr.Length - 1].datetime = in_datetime;
            //    GraphicLineDataArr[GraphicLineDataArr.Length - 1].value = in_value;
            //}

        }
Ejemplo n.º 3
0
        public void PushPoint(DateTime in_datetime, int in_value)
        {
            bool need_left_shift = true;

            for (int i = 0; i < GraphicLineDataArr.Length; i++)
            {
                if (GraphicLineDataArr[i] == null)
                {
                    GraphicLineDataArr[i]          = new GLPoint();
                    GraphicLineDataArr[i].datetime = in_datetime;
                    GraphicLineDataArr[i].value    = in_value;
                    need_left_shift = false;
                    break;
                }
            }



            if (need_left_shift)
            {
                //MessageBox.Show(GraphicLineDataArr[0].datetime.ToString()+ " " + GraphicLineDataArr[1].datetime.ToString());

                for (int i = 0; i < GraphicLineDataArr.Length - 1; i++)
                {
                    GraphicLineDataArr[i].datetime = GraphicLineDataArr[i + 1].datetime;
                    GraphicLineDataArr[i].value    = GraphicLineDataArr[i + 1].value;
                    //MessageBox.Show(GraphicLineDataArr[0].datetime.ToString() + " " + GraphicLineDataArr[1].datetime.ToString());
                }
                GraphicLineDataArr[GraphicLineDataArr.Length - 1].datetime = in_datetime;
                GraphicLineDataArr[GraphicLineDataArr.Length - 1].value    = in_value;
            }



            //if (need_left_shift==true)
            //{
            //    for (int i = 0; i < GraphicLineDataArr.Length-1; i++)
            //    {
            //        GraphicLineDataArr[i] = GraphicLineDataArr[i + 1];
            //    }
            //    GraphicLineDataArr[GraphicLineDataArr.Length - 1].datetime = in_datetime;
            //    GraphicLineDataArr[GraphicLineDataArr.Length - 1].value = in_value;
            //}
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //DateTime T1 = get_T1(get_CURR());
            DateTime T1 = new DateTime(2015, 04, 24, 06, 0, 0);
            int Size = 43200*7;
            GraphicLine.GLPoint[] a1 = new GLPoint[Size]; //720 min + 1
            
            Random rnd_v = new Random();
            //for (int i = 0; i < a1.Length; i++)
            for (int i = 0; i < Size; i++)
            {
                //if (i < 40 || i > 65)
                //a1[i] = new GLPoint((i * 60)/10800 , T1.AddMinutes(i));
                a1[i] = new GLPoint(((i * 60)/(43200*7)) , T1.AddSeconds(i));
            }

            XmlSerializer serializer = new XmlSerializer(typeof(GLPoint[]));

            //TextWriter writer = new StreamWriter(@"C:\Users\serzh\Documents\GitHub\CalandrePresentation\CalanderPresentation\bin\x86\toHost\graphicLine1Data.xml");
            TextWriter writer = new StreamWriter(@"C:\Users\serzh\VirtualBox VMs\mutualSSD\CalanderPresentation\graphicLine1Data.xml");
            serializer.Serialize(writer, a1);
            writer.Dispose();
            

            //if (File.Exists(@"C:\Users\serzh\Documents\GitHub\CalandrePresentation\CalanderPresentation\bin\DebugToHost\GraphicLineData.xml"))
            //{
            //    XmlSerializer XmlSerializer1 = new XmlSerializer(typeof(Settings));
            //    TextReader reader1 = new StreamReader("settings.xml");
            //    Settings1 = (Settings)XmlSerializer1.Deserialize(reader1);
            //    reader1.Dispose();

            //    this.textBox1.Text = Settings1.SQLConnectionString;
            //    this.radioButton1.Checked = (Settings1.SQLWindowsAuthorization) ? true : false;
            //    this.radioButton2.Checked = (Settings1.SQLWindowsAuthorization) ? false : true;
            //    this.textBox5.Text = Settings1.SQLLogin;
            //    this.textBox6.Text = Settings1.SQLPassword;

            //    this.textBox3.Text = Settings1.OPCConnectionString;
            //    this.textBox4.Text = Settings1.OPCRingsCounterName;
            //}
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Add point to Data
        /// </summary>
        /// <param name="in_value">value - any values of int. Component will fit it</param>
        public void AddPoint(int in_value, DateTime datetime)
        {
            GLPoint a1 = new GLPoint(in_value, datetime);

            Data.Add(a1);
        }
 /// <summary>
 /// Add point to Data
 /// </summary>
 /// <param name="in_value">value - any values of int. Component will fit it</param>
 public void AddPoint(int in_value, DateTime datetime)
 {
     GLPoint a1 = new GLPoint(in_value, datetime);
     Data.Add(a1);
 }