Beispiel #1
0
        private void GetEventFrames_Click(object sender, EventArgs e)
        {
            if (afTreeView1.AFSelectedPath == afTreeView1.AFRootPath)
            {
                MessageBox.Show("Please Select Element from ElementTree");
            }
            else
            {
                //Clear ListBoxes
                EFListView.Items.Clear();
                EFAttrView.Items.Clear();

                myElement = myAFDatabase.Elements[afTreeView1.AFSelectedPath];
                AFAttributes myAFAttributes = myElement.Attributes;
                if (myAFAttributes.Count == 0)
                {
                    //MessageBox.Show("No Attribute Found");
                }
                else
                {
                    AFNamedCollectionList <AFEventFrame> EFs;
                    String SearchString = "ElementName:" + myElement.Name;
                    //Use EventFrameTemplate for searching
                    myElementTemplate = myAFDatabase.ElementTemplates[EventFrameTemplateComboBox.SelectedItem.ToString()];
                    EFs = myElement.GetEventFrames(AFSearchMode.Overlapped, StartTimeTextBox.Text, EndTimeTextBox.Text, "", null, myElementTemplate, AFSortField.StartTime, AFSortOrder.Descending, 0, 1000);
                    foreach (AFEventFrame EF in EFs)
                    {
                        string[] displayvalues = new string[5];
                        displayvalues[0] = EF.Name;
                        TimeSpan EFDuration = EF.EndTime - EF.StartTime;
                        //Not ending eventframe returns 9999 year.
                        if (EFDuration.TotalSeconds < 5000000)
                        {
                            displayvalues[1] = EFDuration.TotalSeconds.ToString();
                        }
                        else
                        {
                            displayvalues[1] = "-";
                        }
                        displayvalues[2] = EF.StartTime.LocalTime.ToString();
                        displayvalues[3] = EF.EndTime.LocalTime.ToString();
                        displayvalues[4] = EF.UniqueID;
                        ListViewItem lvi = new ListViewItem(displayvalues);
                        EFListView.Items.Add(lvi);
                    }
                }
            }
        }
        public bool CheckEventFrameExists(AFElement element, string name, AFElementTemplate efTemplate)
        {
            AFNamedCollectionList<AFEventFrame> listEF = element.GetEventFrames(new AFTime("*"), 0, 1, 
                AFEventFrameSearchMode.BackwardFromStartTime, name, null, efTemplate);

            if (listEF.Count > 0)
            {
                PIFitnessLog.Write(TraceEventType.Information, 0, string.Format("Event frame already exists: {0}", name));
                return true;
            }
            else
            {
                return false;
            }

        }
        private void GetEventFrames_Click(object sender, EventArgs e)
        {
            if (afTreeView1.AFSelectedPath == afTreeView1.AFRootPath)
            {
                MessageBox.Show("Please Select Element from ElementTree");
            }
            else
            {
                //Clear ListBoxes
                EFListView.Items.Clear();
                EFAttrView.Items.Clear();

                myElement = myAFDatabase.Elements[afTreeView1.AFSelectedPath];
                AFAttributes myAFAttributes = myElement.Attributes;
                if (myAFAttributes.Count == 0)
                {
                    //MessageBox.Show("No Attribute Found");
                }
                else
                {
                    AFNamedCollectionList<AFEventFrame> EFs;
                    String SearchString = "ElementName:"+myElement.Name;
                    //Use EventFrameTemplate for searching
                    myElementTemplate = myAFDatabase.ElementTemplates[EventFrameTemplateComboBox.SelectedItem.ToString()];
                    EFs = myElement.GetEventFrames(AFSearchMode.Overlapped,StartTimeTextBox.Text,EndTimeTextBox.Text,"",null,myElementTemplate,AFSortField.StartTime,AFSortOrder.Descending,0,1000);
                    foreach (AFEventFrame EF in EFs)
                    {
                        string[] displayvalues = new string[5];
                        displayvalues[0] = EF.Name;
                        TimeSpan EFDuration = EF.EndTime - EF.StartTime;
                        //Not ending eventframe returns 9999 year.
                        if (EFDuration.TotalSeconds < 5000000)
                        {
                            displayvalues[1] = EFDuration.TotalSeconds.ToString();
                        }
                        else
                        {
                            displayvalues[1] = "-";
                        }
                        displayvalues[2] = EF.StartTime.LocalTime.ToString();
                        displayvalues[3] = EF.EndTime.LocalTime.ToString();
                        displayvalues[4] = EF.UniqueID;
                        ListViewItem lvi = new ListViewItem(displayvalues);
                        EFListView.Items.Add(lvi);
                    }
                }
            }
        }