private void AddFile(File f)
        {
            String path = System.IO.Path.GetFileName(f.FileName);
            if (this.Type == ExplorerType.File)
            {
                treeView1.Nodes.Add(path);
                treeView1.Nodes[treeView1.Nodes.Count-1].Nodes.Add("Time Graphs");
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[0].Nodes.Add("Acceleration");
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[0].Nodes.Add("Velocity");
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("Frequency Graphs");
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[1].Nodes.Add("FFT Magnitude");
                treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[1].Nodes.Add("FFT Power");

            }
            else if(this.Type == ExplorerType.Graph)
            {
                treeView1.Nodes[0].Nodes[0].Nodes.Add(path);
                treeView1.Nodes[0].Nodes[1].Nodes.Add(path);
                treeView1.Nodes[1].Nodes[0].Nodes.Add(path);
                treeView1.Nodes[1].Nodes[1].Nodes.Add(path);
            }
        }
 private void Remove(File f)
 {
     throw new NotImplementedException();
 }
 public void Open()
 {
     String filename = null;
     OpenFileDialog brsw = new OpenFileDialog();
     brsw.Title = "Choose an .xml file to read the acceleration information from:";
     brsw.InitialDirectory = "C://Users//Simpson//Desktop//Vibration Test Samples";
     brsw.Filter = "IXSense Files (.ixs)|*.ixs|XML Files (.xml)|*.xml";
     if (brsw.ShowDialog() == DialogResult.OK )
     {
         filename = brsw.FileName;
     }
     else
     {
         MessageBox.Show("No file selected. Try Again.");
         return;
     }
     File nFile = null;
     try
     {
         nFile = new File(filename);
     }
     catch (Exception e)
     {
         MessageBox.Show("File selected was in an incorrect format");
     }
     if (nFile != null)
     {
         Open(nFile);
     }
     //nFile = new File(filename.Substring(0, filename.LastIndexOf('.')) + "1.xml");
     //Open(nFile);
     //nFile = new File(filename.Substring(0, filename.LastIndexOf('.')) + "2.xml");
     //Open(nFile);
     //nFile = new File(filename.Substring(0, filename.LastIndexOf('.')) + "3.xml");
     //Open(nFile);
     //nFile = new File(filename.Substring(0, filename.LastIndexOf('.')) + "4.xml");
     //Open(nFile);
     //nFile = new File(filename.Substring(0, filename.LastIndexOf('.')) + "5.xml");
     //Open(nFile);
     //nFile = new File(filename.Substring(0, filename.LastIndexOf('.')) + "6.xml");
     //Open(nFile);
 }
        private void Open(File oFile)
        {
            OpenedFile = oFile;
            OpenFiles.Add(oFile);
            GraphDock gd = new GraphDock();
            gd.GraphName = OpenedFile.FileName;
            gd.Text = "Time-" + oFile.FileName;
            gd.AddCurve(OpenedFile.AccelerationData, oFile.FileName);
            gd.AddCurve(OpenedFile.VelocityData, oFile.FileName);
            DockList.Add(gd);
            // TODO: Add from xmlFile the RMS optimum vaue and the maximum value.
            GraphEventInstance.CreatedGraph = gd;
            OnGraphCreated(GraphEventInstance);

            /*if (RMSChartingDock == null)
            {
                RMSChartingDock = new RMSChartDoc();
            }

            RMSChartingDock.AddRMSValues(System.IO.Path.GetFileName(OpenedFile.FileName), OpenedFile.VelocityData.RMS, true, (uint)(new Random().Next(3)));
            if (string.IsNullOrEmpty(RMSChartingDock.Text))
            {
                RMSChartingDock.Text = "RMS Values";
                DockList.Add(RMSChartingDock);
            }*/
            GraphDock gd2 = new GraphDock();
            gd2.GraphName = OpenedFile.FileName;
            gd2.Text = "FFT-" + oFile.FileName;
            gd2.AddCurve(OpenedFile.MagnitudeData,oFile.FileName);
            gd2.AddCurve(OpenedFile.PowerData,  oFile.FileName);
            // TODO: Add any bands that appear in the file to the graph
            DockList.Add(gd2);

            GraphEventInstance.CreatedGraph = gd2;
            OnGraphCreated(GraphEventInstance);

            //foreach (_xmlFile._dsSentry_data._band band in oFile.XMLFile.dsSentry_data.bandList)
            //{
            //    ZedGraph.BandObjList.Add(new BandObj(band.center_Freq - band.bandwidth / 2, band.bandwidth, OpenedFile.MagnitudeData.Curve, gd2.ZedGraphControl, band.TimeStampCreated, DateTime.Now, band.quant_Level), gd2.ZedGraphControl);
            //}
            //SpectroGraphDock sp = new SpectroGraphDock();
            //sp.GraphName = OpenedFile.FileName;
            //sp.AddCurve(OpenedFile.AccelerationData.Curve, CurveType.Acceleration, oFile.FileName);
            //sp.AddCurve(OpenedFile.VelocityData.Curve, CurveType.Velocity, oFile.FileName);
            //DockList.Add(sp);
            //SpectroGraphDock sp2 = new SpectroGraphDock();
            //sp2.GraphName = OpenedFile.FileName;
            //sp2.AddCurve(OpenedFile.MagnitudeData.Curve, CurveType.Magnitude, oFile.FileName);
            //sp2.AddCurve(OpenedFile.PowerData.Curve, CurveType.Power, oFile.FileName);
            //DockList.Add(sp2);
            //RMSGaugeDoc rmsGD = new RMSGaugeDoc(OpenedFile.VelocityData.RMSPref, OpenedFile.VelocityData.RMS, OpenedFile.VelocityData.RMSMax);
            //rmsGD.Text = System.IO.Path.GetFileName(OpenedFile.FileName);

            FileOpenEventArgs foea = new FileOpenEventArgs(gd, gd2, null, null);//sp, sp2);
            OnFileOpenEvent(foea);
        }
 public void Open(string filename)
 {
     File nFile = new File(filename);
     Open(nFile);
 }