// // SelectROMPane.xaml.cpp // Implementation of the SelectROMPane class // #include "pch.h" #include "SelectROMPane.xaml.h" #include "DirectXPage.xaml.h" #include "EmulatorSettings.h" #include "EmulatorFileHandler.h" #include "SelectStatePane.xaml.h" #include "Database\ROMDBEntry.h" #include "Converter.h" #include "App.xaml.h" #include "AdControl.xaml.h" using namespace VBA10; using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Controls::Primitives; using namespace Windows::UI::Xaml::Data; using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Xaml::Media; using namespace Windows::UI::Xaml::Navigation; using namespace Windows::UI::Popups; using namespace Windows::Storage::Pickers; using namespace Windows::Storage; using namespace Windows::Storage::AccessCache; using namespace Windows::UI::ViewManagement; using namespace Windows::ApplicationModel::Resources; using namespace Windows::Devices::HumanInterfaceDevice; using namespace Windows::Devices::Enumeration; StorageFolderModel::StorageFolderModel(StorageFolder ^folder) { this->Folder = folder; } StorageFileModel::StorageFileModel(StorageFile ^file, StorageFolder ^folder) { this->File = file; this->Folder = folder; } // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 SelectROMPane::SelectROMPane() { initdone = false; this->InitializeComponent(); auto loader = Windows::ApplicationModel::Resources::ResourceLoader::GetForViewIndependentUse(); //move command bar to bottom if setting says so if ((EmulatorSettings::Current->CommandButtonPosition == 0 && Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) || EmulatorSettings::Current->CommandButtonPosition == 2) { svContainer->SetValue(Grid::RowProperty, 0); LayoutRoot->RowDefinitions->GetAt(0)->Height = GridLength(1, GridUnitType::Star); LayoutRoot->RowDefinitions->GetAt(1)->Height = GridLength::Auto; topbar->SetValue(Grid::RowProperty, 2); if (App::HasAds) { AdControl^ adControl = ref new AdControl(); LayoutRoot->Children->Append(adControl); adControl->SetValue(Grid::RowProperty, 1); } } else { topbar->SetValue(Grid::RowProperty, 0); LayoutRoot->RowDefinitions->GetAt(0)->Height = GridLength::Auto; svContainer->SetValue(Grid::RowProperty, 1); LayoutRoot->RowDefinitions->GetAt(1)->Height = GridLength(1, GridUnitType::Star); if (App::HasAds) { AdControl^ adControl = ref new AdControl(); LayoutRoot->Children->Append(adControl); adControl->SetValue(Grid::RowProperty, 2); } } //bind list of ROM to display cvsAllROMEntries->Source = App::ROMDB->AllROMDBEntries; romList->SelectedItem = nullptr; //refresh last played image ResetLastPlayedImage(); //disable the command bar if no rom is loaded topbar->IsEnabled = IsROMLoaded(); initdone = true; } void SelectROMPane::ResetLastPlayedImage() { //find the most recently play game if (App::ROMDB->AllROMDBEntries->Size == 0) //no rom in list { lastRomGrid->Visibility = Windows::UI::Xaml::Visibility::Collapsed; //collapse return; } int index = 0; for (unsigned int i = 1; i < App::ROMDB->AllROMDBEntries->Size; i++) { if (App::ROMDB->AllROMDBEntries->GetAt(i)->LastPlayed.UniversalTime > App::ROMDB->AllROMDBEntries->GetAt(index)->LastPlayed.UniversalTime) index = i; } if (App::ROMDB->AllROMDBEntries->GetAt(index)->LastPlayed.UniversalTime > 0) // have been played lastRomGrid->DataContext = App::ROMDB->AllROMDBEntries->GetAt(index); else lastRomGrid->Visibility = Windows::UI::Xaml::Visibility::Collapsed; //collapse } //void SelectROMPane::DeleteFolderClick(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) //{ // Button ^button = safe_cast