Browse files

Updated recording to propt when user is asked to save.

  • Loading branch information...
1 parent 5ce499a commit 5d65501a0cbb1982f1a210d414d871c2fb23c74c @mdfeist committed Jun 21, 2013
Showing with 30 additions and 7 deletions.
  1. +8 −0 BlinkAnalysis/MainFormController.cpp
  2. +2 −0 BlinkAnalysis/MainFormController.h
  3. +20 −7 BlinkAnalysis/Recording.cpp
View
8 BlinkAnalysis/MainFormController.cpp
@@ -74,3 +74,11 @@ void MainFormController::getFilePath(std::string& pathBuffer, std::string defaul
}
}
+bool MainFormController::propt(LPCTSTR title, LPCTSTR msg) {
+ if (MessageBox::Show(gcnew String(msg), gcnew String(title), MessageBoxButtons::YesNo) == DialogResult::Yes) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
View
2 BlinkAnalysis/MainFormController.h
@@ -46,5 +46,7 @@ public ref class MainFormController sealed :
std::string getSpecialFolderMyDocuments();
void getFilePath(std::string& pathBuffer);
void getFilePath(std::string& pathBuffer, std::string defaultPath);
+
+ bool propt(LPCTSTR title, LPCTSTR msg);
};
View
27 BlinkAnalysis/Recording.cpp
@@ -253,15 +253,28 @@ void Recording::closeRecording() {
fileStream.close();
}
- std::string filePath;
- MainFormController::getInstance()->getFilePath(filePath, Settings::getInstance()->getDefaultProjectDirectory());
+ bool save = true;
- if (filePath != "") {
- TCHAR destination[MAX_PATH + 1];
- MultiByteToWideChar(CP_ACP, 0, filePath.c_str(), -1, destination, filePath.length());
+ if (!MainFormController::getInstance()->propt(L"Save Recording", L"Would you like to save the recording?"))
+ save = false;
- destination[filePath.length()] = 0;
+ while (save) {
+ std::string filePath;
+ MainFormController::getInstance()->getFilePath(filePath, Settings::getInstance()->getDefaultProjectDirectory());
- MoveFileEx(szTempFileName, destination, MOVEFILE_REPLACE_EXISTING);
+ if (filePath != "") {
+ TCHAR destination[MAX_PATH + 1];
+ MultiByteToWideChar(CP_ACP, 0, filePath.c_str(), -1, destination, filePath.length());
+
+ destination[filePath.length()] = 0;
+
+ MoveFileEx(szTempFileName, destination, MOVEFILE_REPLACE_EXISTING);
+
+ save = false;
+ } else {
+ if (MainFormController::getInstance()->propt(L"Save Recording", L"Are you sure you would like to continue without saving the recording?")) {
+ save = false;
+ }
+ }
}
}

0 comments on commit 5d65501

Please sign in to comment.