Rev 94 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once
using namespace System;
using namespace System::Xml;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace Creator {
/// <summary>
/// Summary for LoadText
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class LoadText : public System::Windows::Forms::Form
{
public:
LoadText(CGameDirectories *dirs, bool reload) : _pVFS(NULL),
_pDirs(dirs),
_bReload(reload)
{
InitializeComponent();
_sCurrentDir = new Utils::String();
}
LoadText(CVirtualFileSystem *vfs) : _pVFS(vfs),
_pDirs(NULL),
_bReload(false)
{
InitializeComponent();
_sCurrentDir = new Utils::String();
*_sCurrentDir = vfs->directory();
}
void Start()
{
this->label2->Text = _US(*_sCurrentDir);
this->backgroundWorker1->RunWorkerAsync();
}
void DoWork()
{
if ( _sCurrentDir->empty() ) return;
if ( _pVFS ) _pVFS->updateTexts(0);
else if ( _pDirs ) _pDirs->updateCurrentVFS(_bReload);
}
void Next()
{
if ( _pDirs ) {
*_sCurrentDir = _pDirs->next();
if ( !_sCurrentDir->empty() ) {
this->Start();
return;
}
}
this->Close();
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~LoadText()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Label^ label2;
private: System::ComponentModel::BackgroundWorker^ backgroundWorker1;
private:
bool _bReload;
CVirtualFileSystem *_pVFS;
Collections::Hashtable ^m_pTextList;
Utils::String *_sCurrentDir;
CGameDirectories *_pDirs;
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
this->SuspendLayout();
//
// label1
//
this->label1->Dock = System::Windows::Forms::DockStyle::Top;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->Location = System::Drawing::Point(10, 10);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(459, 32);
this->label1->TabIndex = 0;
this->label1->Text = L"Loading Text";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
this->label1->UseWaitCursor = true;
//
// label2
//
this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label2->Location = System::Drawing::Point(10, 42);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(459, 23);
this->label2->TabIndex = 1;
this->label2->TextAlign = System::Drawing::ContentAlignment::TopCenter;
this->label2->UseWaitCursor = true;
//
// backgroundWorker1
//
this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &LoadText::backgroundWorker1_DoWork);
this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &LoadText::backgroundWorker1_RunWorkerCompleted);
//
// LoadText
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::Color::Gray;
this->ClientSize = System::Drawing::Size(479, 75);
this->ControlBox = false;
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Cursor = System::Windows::Forms::Cursors::WaitCursor;
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->Name = L"LoadText";
this->Padding = System::Windows::Forms::Padding(10);
this->ShowInTaskbar = false;
this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Hide;
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"LoadText";
this->TopMost = true;
this->UseWaitCursor = true;
this->Load += gcnew System::EventHandler(this, &LoadText::LoadText_Load);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) {
this->DoWork();
}
private: System::Void LoadText_Load(System::Object^ sender, System::EventArgs^ e) {
if ( _pDirs )
*_sCurrentDir = _pDirs->first();
this->Start();
}
private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e) {
this->Next();
}
};
}