getEventFrameData() public static method

Gets the data of the EventFrame attribute chosen.
public static getEventFrameData ( string server_database, string AttributeName, string MatlabName, AFEventFrame frame, bool addToListView ) : void
server_database string Unique string representing the server and database
AttributeName string The name of the AFEventFrame AFAttribute.
MatlabName string The name of the variable in the Matlab workspace.
frame AFEventFrame The AFEventFrame object.
addToListView bool true: adds input into the LogSystem. (Generally true)
return void
Example #1
0
        /// <summary>
        /// Exports the Event Frame Data, using the AFViewControl to select an EventFrame and EventFrame Attribute.
        /// </summary>
        private void exportEventFrameData()
        {
            string name = avcEventAttributes.AFSelection.ToString();

            if (name != null)
            {
                string srv_db = "'" + _curServer + "'_'" + _curDatabase + "'";

                AFAccess.getEventFrameData(srv_db, name, getUserVariableName(name), (AFEventFrame)avcEventFrames.AFSelection, true);
            }
        }
Example #2
0
        // Import Saved Log
        /// <summary>
        /// Imports a saved file into Matlab.
        /// </summary>
        /// <param name="path"> The path to the importe File.</param>
        /// <returns></returns>
        public string[] importLog(string path)
        {
            try
            {
                string[] lines = LogSystem.ImportLog(path);
                foreach (string line in lines)
                {
                    if (line != string.Empty)
                    {
                        string[] info = Regex.Split(line, @"=");
                        mainForm.Status("Importing: " + info[1] + " as " + info[0]);

                        if (info.Length == 2)
                        {
                            _curServer   = info[0];
                            _curDatabase = info[1];
                        }
                        else if (info.Length == 6) //Absolute Time
                        {
                            if (info[5] != string.Empty)
                            {
                                mainForm.dataPrefDialog.setupDataPreferences(info[5]);
                            }
                            string srv_db = "'" + _curServer + "'_'" + _curDatabase + "'";
                            if (info[2] == "PI.Point")
                            {
                                getPIData(info[1], _curServer, info[0], info[3], info[4], true);
                            }
                            else
                            {
                                getAFData(srv_db, info[1], info[0], info[2], info[3], info[4], true);
                            }
                        }
                        else // Dates
                        {
                            string[] time = Regex.Split(info[3], @"-");
                            if (info[4] != string.Empty)
                            {
                                mainForm.dataPrefDialog.setupDataPreferences(info[4]);
                            }
                            string srv_db = "'" + _curServer + "'_'" + _curDatabase + "'";
                            if (info[2] == "PI.Point")
                            {
                                getPIData(info[1], _curServer, info[0], time[0], time[1], true);
                            }
                            else
                            {
                                try
                                {
                                    List <string> paths = new List <string>()
                                    {
                                        info[2]
                                    };
                                    AFKeyedResults <string, AFEventFrame> frames = AFEventFrame.FindEventFramesByPath(paths, null);

                                    int          i     = frames.Count;
                                    AFEventFrame frame = frames[paths[0]];
                                    AFAccess.getEventFrameData(srv_db, info[1], info[0], frame, true);
                                }
                                catch
                                {
                                    getAFData(srv_db, info[1], info[0], info[2], time[0], time[1], true);
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                mainForm.Status("ERROR: Invalid import file. Please choose a different file.");
            }
            return(new string[] { _curServer, _curDatabase });
        }