BeginTrans() public method

public BeginTrans ( ) : void
return void
示例#1
0
        private void MenuItem_Test_Click(object sender, RoutedEventArgs e)
        {
            #region mog txt to database
            StreamReader sr       = new StreamReader(File.Open(@"J:\Kinect data\mog141-180.txt", FileMode.Open));
            string       dataPath = @"J:\Kinect data\database141-181.db";
            m_DBmanager = DBManager.GetSingleton(dataPath);
            m_DBmanager.BeginTrans();

            string line  = sr.ReadLine();
            int    count = 1;
            while (line != null && line != "")
            {
                string[] cell    = line.Split();
                int      frame   = Convert.ToInt32(cell[1]);
                bool     isRight = cell[2] == "r";
                if (cell.Count() >= 27)
                {
                    float[] Mog = cell.Skip(3).Take(24).Select(x => Convert.ToSingle(x)).ToArray();
                    m_DBmanager.UpdateMogData(frame, Mog, isRight);
                }
                Console.WriteLine(count++);
                line = sr.ReadLine();
            }
            m_DBmanager.Commit();
            m_DBmanager.Close();
            sr.Close();
            #endregion

            #region kmeans

            #endregion
        }
        private void MenuItem_Test_Click(object sender, RoutedEventArgs e)
        {
            #region mog txt to database
            StreamReader sr = new StreamReader(File.Open(@"J:\Kinect data\mog141-180.txt", FileMode.Open));
            string dataPath = @"J:\Kinect data\database141-181.db";
            m_DBmanager = DBManager.GetSingleton(dataPath);
            m_DBmanager.BeginTrans();

            string line = sr.ReadLine();
            int count = 1;
            while (line != null && line != "")
            {
                string[] cell = line.Split();
                int frame = Convert.ToInt32(cell[1]);
                bool isRight = cell[2] == "r";
                if (cell.Count() >= 27)
                {
                    float[] Mog = cell.Skip(3).Take(24).Select(x => Convert.ToSingle(x)).ToArray();
                    m_DBmanager.UpdateMogData(frame, Mog, isRight);
                }
                Console.WriteLine(count++);
                line = sr.ReadLine();
            }
            m_DBmanager.Commit();
            m_DBmanager.Close();
            sr.Close();
            #endregion

            #region kmeans

            #endregion
        }