Exemplo n.º 1
0
        private void menuItemShowVideo_Click(object sender, EventArgs e)
        {
            if (this.treeViewFieldData.Nodes.Count == 0 || this.treeViewFieldData.SelectedNode == null || this.treeViewFieldData.SelectedNode.Tag == null)
                return;

            // Show all assigned Images for selected node
            TreeViewNodeData data = this.treeViewFieldData.SelectedNode.Tag as TreeViewNodeData;
            List<String> fileList = new List<string>();
            try
            {
                switch (data.NodeType)
                {
                    case TreeViewNodeTypes.EventNode:
                        IList<CollectionEventImage> ceImgList = DataFunctions.Instance.RetrieveImagesForCollectionEvent("video", this._events.Current);
                        foreach (CollectionEventImage ceImg in ceImgList)
                        {
                            if(ceImg != null)
                                fileList.Add(ceImg.URI);
                        }
                        break;
                    case TreeViewNodeTypes.SpecimenNode:
                        IList<CollectionSpecimenImage> csImgList = DataFunctions.Instance.RetrieveImagesForCollectionSpecimen((int)data.ID, "video");
                        foreach (CollectionSpecimenImage csImg in csImgList)
                        {
                            if (csImg != null)
                                fileList.Add(csImg.URI);
                        }
                        break;
                    case TreeViewNodeTypes.IdentificationUnitNode:
                        IList<CollectionSpecimenImage> csImgListIU = DataFunctions.Instance.RetrieveImagesForCollectionSpecimen(this.findSpecimenID(), (int)data.ID, "video");
                        foreach (CollectionSpecimenImage csImg in csImgListIU)
                        {
                            if (csImg != null)
                                fileList.Add(csImg.URI);
                        }
                        break;
                }
            }
            catch (Exception f)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show("Error while finding Pictures for ID´s. ("+f.Message+")");
                return;
            }
            if (fileList.Count > 0)
            {
                try
                {
                    DirectPlayForm vidForm = new DirectPlayForm(fileList,_currentToolbarImageList);
                    vidForm.ShowDialog();
                }
                catch (Exception)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show("Not enough Memory");
                    return;
                }
            }
            else
            {
                MessageBox.Show("No assigned image found", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
            }
        }
Exemplo n.º 2
0
        private void menuItemPlayAudio_Click(object sender, EventArgs e)
        {
            if (this.treeViewFieldData.Nodes.Count == 0 || this.treeViewFieldData.SelectedNode == null || this.treeViewFieldData.SelectedNode.Tag == null)
                return;

            TreeViewNodeData data = this.treeViewFieldData.SelectedNode.Tag as TreeViewNodeData;
            List<String> fileList = new List<string>();

            try
            {
                switch (data.NodeType)
                {
                    case TreeViewNodeTypes.EventNode:
                        IList<CollectionEventImage> ceImgList = DataFunctions.Instance.RetrieveImagesForCollectionEvent("audio", this._events.Current);
                        foreach (CollectionEventImage ceImg in ceImgList)
                        {
                            if (ceImg != null)
                                fileList.Add(ceImg.URI);
                        }
                        break;
                    case TreeViewNodeTypes.SpecimenNode:
                        IList<CollectionSpecimenImage> csImgList = DataFunctions.Instance.RetrieveImagesForCollectionSpecimen((int)data.ID, "audio");
                        foreach (CollectionSpecimenImage csImg in csImgList)
                        {
                            if (csImg != null)
                                fileList.Add(csImg.URI);
                        }
                        break;
                    case TreeViewNodeTypes.IdentificationUnitNode:
                        IList<CollectionSpecimenImage> csImgListIU = DataFunctions.Instance.RetrieveImagesForCollectionSpecimen(this.findSpecimenID(), (int)data.ID, "audio");
                        foreach (CollectionSpecimenImage csImg in csImgListIU)
                        {
                            if (csImg != null)
                                fileList.Add(csImg.URI);
                        }
                        break;
                }
            }
            catch (ConnectionCorruptedException ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                this.afterSelect(this.treeViewFieldData.SelectedNode);
                return;
            }
            if (fileList.Count > 0)
            {
                try
                {
                    //AudioForm ad = new AudioForm(fileList[0]);
                    DirectPlayForm ad = new DirectPlayForm(fileList, _currentToolbarImageList);
                    ad.Show();
                }
                catch(Exception)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show("Not enough Memory");
                }
            }
            else
            {
                MessageBox.Show("No assigned Record found", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
            }
        }