mirror of
https://github.com/izzy2lost/vba10.git
synced 2026-03-26 18:15:30 -07:00
add binding to rom list retrieved from data base
This commit is contained in:
@@ -10,8 +10,8 @@ using namespace Platform::Collections;
|
||||
|
||||
namespace VBA10
|
||||
{
|
||||
ROMDBEntry::ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ folderpath)
|
||||
:_locationType(locationtype), _displayName(displayname), _fileName(filename), _folderPath(folderpath)
|
||||
ROMDBEntry::ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ filepath)
|
||||
:_locationType(locationtype), _displayName(displayname), _fileName(filename), _filePath(filepath)
|
||||
{
|
||||
_lastPlayed = DateTime{ 0 };
|
||||
_autoSaveIndex = 0;
|
||||
@@ -19,9 +19,9 @@ namespace VBA10
|
||||
|
||||
}
|
||||
|
||||
ROMDBEntry::ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ folderpath,
|
||||
ROMDBEntry::ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ filepath,
|
||||
DateTime lastplayed, int autosaveindex, Platform::String^ snapshoturi)
|
||||
:_locationType(locationtype), _displayName(displayname), _fileName(filename), _folderPath(folderpath),
|
||||
:_locationType(locationtype), _displayName(displayname), _fileName(filename), _filePath(filepath),
|
||||
_lastPlayed(lastplayed), _autoSaveIndex(autosaveindex), _snapshotUri(snapshoturi)
|
||||
{
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ using namespace concurrency;
|
||||
|
||||
namespace VBA10
|
||||
{
|
||||
|
||||
[Windows::UI::Xaml::Data::BindableAttribute]
|
||||
public ref class ROMDBEntry sealed
|
||||
{
|
||||
public:
|
||||
ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ folderpath);
|
||||
ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ filepath);
|
||||
|
||||
ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ folderpath,
|
||||
ROMDBEntry(int locationtype, Platform::String^ displayname, Platform::String^ filename, Platform::String^ filepath,
|
||||
DateTime lastplayed, int autosaveindex, Platform::String^ snapshoturi);
|
||||
|
||||
//property int ID
|
||||
@@ -71,15 +71,15 @@ namespace VBA10
|
||||
}
|
||||
}
|
||||
|
||||
property Platform::String^ FolderPath
|
||||
property Platform::String^ FilePath
|
||||
{
|
||||
Platform::String^ get()
|
||||
{
|
||||
return _folderPath;
|
||||
return _filePath;
|
||||
}
|
||||
void set(Platform::String^ value)
|
||||
{
|
||||
_folderPath = value;
|
||||
_filePath = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace VBA10
|
||||
int _locationType;
|
||||
Platform::String^ _displayName;
|
||||
Platform::String^ _fileName;
|
||||
Platform::String^ _folderPath;
|
||||
Platform::String^ _filePath;
|
||||
Windows::Foundation::DateTime _lastPlayed;
|
||||
int _autoSaveIndex;
|
||||
Platform::String^ _snapshotUri;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace VBA10
|
||||
"LOCATIONTYPE INT NOT NULL,"\
|
||||
"DISPLAYNAME TEXT NOT NULL,"\
|
||||
"FILENAME INT NOT NULL,"\
|
||||
"FOLDERPATH INT NOT NULL,"\
|
||||
"FILEPATH INT NOT NULL,"\
|
||||
"LASTPLAY INT NOT NULL,"\
|
||||
"AUTOSAVEINDEX INT NOT NULL, "\
|
||||
"SNAPSHOTURI TEXT NOT NULL );");
|
||||
@@ -84,11 +84,15 @@ namespace VBA10
|
||||
{
|
||||
return create_task([this, entry]
|
||||
{
|
||||
Platform::String^ cmd = "INSERT INTO ROMTABLE (LOCATIONTYPE, DISPLAYNAME, FILENAME, FOLDERPATH, LASTPLAY, AUTOSAVEINDEX, SNAPSHOTURI) VALUES (";
|
||||
//first add this rom to the list
|
||||
_allROMDBEntries->Append(entry);
|
||||
|
||||
//prepare statement to add to rom table
|
||||
Platform::String^ cmd = "INSERT INTO ROMTABLE (LOCATIONTYPE, DISPLAYNAME, FILENAME, FILEPATH, LASTPLAY, AUTOSAVEINDEX, SNAPSHOTURI) VALUES (";
|
||||
cmd += entry->LocationType + ",";
|
||||
cmd += "'" + entry->DisplayName + "',";
|
||||
cmd += "'" + entry->FileName + "',";
|
||||
cmd += "'" + entry->FolderPath + "',";
|
||||
cmd += "'" + entry->FilePath + "',";
|
||||
cmd += entry->LastPlay.UniversalTime + ",";
|
||||
cmd += entry->AutoSaveIndex + ",";
|
||||
cmd += "'" + entry->SnapshotUri + "')";
|
||||
@@ -117,6 +121,7 @@ namespace VBA10
|
||||
}).then([this, items](bool ret)
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
return create_iterative_task([this, items]
|
||||
{
|
||||
return create_task([this, items]
|
||||
@@ -130,7 +135,9 @@ namespace VBA10
|
||||
return statement->StepAsync();
|
||||
});
|
||||
});;
|
||||
|
||||
}
|
||||
else
|
||||
return create_task([] {});
|
||||
}).then([items](task<void> t)
|
||||
{
|
||||
return items; //t.get();
|
||||
|
||||
@@ -32,9 +32,9 @@ namespace VBA10
|
||||
task<void> Initialize(void);
|
||||
task<void> Add(ROMDBEntry^ entry);
|
||||
task<Vector<ROMDBEntry^>^> RetrieveQuerry();
|
||||
property WFC::IObservableVector<ROMDBEntry^>^ AllROMDBEntries
|
||||
property PC::Vector<ROMDBEntry^>^ AllROMDBEntries
|
||||
{
|
||||
WFC::IObservableVector<ROMDBEntry^>^ get()
|
||||
PC::Vector<ROMDBEntry^>^ get()
|
||||
{
|
||||
return _allROMDBEntries;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace VBA10
|
||||
SQLiteWinRT::Database^ db;
|
||||
SQLiteWinRT::Statement^ statement; //temporary pointer to store statement
|
||||
|
||||
WFC::IObservableVector<ROMDBEntry^>^ _allROMDBEntries;
|
||||
PC::Vector<ROMDBEntry^>^ _allROMDBEntries;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user