public void OpenSession(object sender, RoutedEventArgs e) { //var openFileDialog = new OpenFileDialog(); //openFileDialog.Filter = "Session Files|*.sess"; var openFileDialog = new Microsoft.Win32.OpenFileDialog(); var fileName = openFileDialog.BrowseFileToOpen("Session Files|*.sess"); if (!string.IsNullOrEmpty(fileName)) { FlushPreviousSessionAndScoreDetails(); if (_abcFlag) { ABCSessionWindow.InvokeSessionClosed(sender, _abcModelList); } else if (_mushraFlag) { MUSHRASessionWindow.InvokeSessionClosed(sender, _mushraModelList); } var msg = string.Format("Opening an Exisiting Session from the file {0}", fileName); Log.Write(LogLevel.Info, msg); if (ReadSessionFile(fileName)) { if (_countSampleTags > 1) { _mushraFlag = true; _abcFlag = false; MUSHRASessionWindow.LoadMushraView(); MUSHRASessionWindow.InvokeEvents(sender, _mushraModelList); } else { _mushraFlag = false; _abcFlag = true; ABCSessionWindow.LoadAbcView(); ABCSessionWindow.InvokeEvents(sender, _abcModelList); } } else { System.Windows.Forms.MessageBox.Show("The Session file is corrupted!!!! \n Or the audio files path is incorrect", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
public void CloseSession() { FlushPreviousSessionAndScoreDetails(); if (_abcFlag) { ABCSessionWindow.InvokeSessionClosed(this, _abcModelList); } else if (_mushraFlag) { MUSHRASessionWindow.InvokeSessionClosed(this, _mushraModelList); } if (_abcFlag || _mushraFlag) { System.Windows.Forms.MessageBox.Show("The Session is Closed!!!!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); Log.Write(LogLevel.Info, "The Current Session is Closed!!!"); _abcFlag = false; _mushraFlag = false; } }