Esempio n. 1
0
        /// <summary>
        /// Reload the cochleogram chart in the main window. Used to refresh the graph after changing settings like dots to paint or chart color.
        /// </summary>
        public void reloadCochcleogram()
        {
            if (isLoaded)
            {
                try
                {
                    if (settings.MainS.eventSize == 16)
                    {
                        aedatObject16.closeAedat();
                        aedatObject16 = new aedat16(root);
                        aedatObject16.adaptAedat();
                    }

                    if (settings.MainS.eventSize == 32)
                    {
                        aedatObject32.closeAedat();
                        aedatObject32 = new aedat32(root);
                        aedatObject32.adaptAedat();
                    }
                    initState();
                    displayCharts();
                    if (cochleaInfo == EnumCochleaInfo.MONO32 || cochleaInfo == EnumCochleaInfo.MONO64 || cochleaInfo == EnumCochleaInfo.MONO128 || cochleaInfo == EnumCochleaInfo.MONO256) // If the file corresponds to a mono sound, there's no point on enabling the "Disparity between cochleae" function.
                    {
                        Btn_difference.IsEnabled   = false;
                        Btn_difference.Opacity     = 0.6;
                        Btn_StereoToMono.IsEnabled = false;
                        Btn_StereoToMono.Opacity   = 0.6;
                        Btn_MonoToStereo.IsEnabled = true;
                        Btn_MonoToStereo.Opacity   = 1;
                    }
                    else
                    {
                        Btn_difference.IsEnabled   = true;
                        Btn_difference.Opacity     = 1;
                        Btn_StereoToMono.IsEnabled = true;
                        Btn_StereoToMono.Opacity   = 1;
                        Btn_MonoToStereo.IsEnabled = false;
                        Btn_MonoToStereo.Opacity   = 0.6;
                    }
                    InfoWindow iw = new InfoWindow("Success!", "The Aedat file was loaded correctly");
                    iw.ShowDialog();
                }
                catch (Exception e)
                {
                    this.Cursor = Cursors.Arrow;
                    InfoWindow iw = new InfoWindow("Error", "The Aedat file was not loaded correctly. This may be caused by an incorrect\nconfiguration of the number of channels and address length in NAVIS' settings.");
                    iw.ShowDialog();
                    for (int i = 2; i < buttonList.Count; i++)  //Enable tools buttons after loading the file
                    {
                        buttonList[i].IsEnabled = false;
                        buttonList[i].Opacity   = 0.6;
                    }
                    menuItem_Reload.IsEnabled = false; menuItem_Report.IsEnabled = false; menuItem_Tools.IsEnabled = false;
                    tab_fileLoaded.Visibility = Visibility.Hidden;
                }
            }
        }