Rev 162 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace PluginManager {
/// <summary>
/// Summary for DownloadPackageList
///
/// 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 DownloadPackageList : public System::Windows::Forms::Form
{
public:
DownloadPackageList(CPackages *p, Utils::WStringList *servers);
void NextServer();
void Finished();
void ExtractWebData(String ^data);
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~DownloadPackageList()
{
if (components)
{
delete components;
}
}
private:
int m_iServerPos;
CPackages *m_pPackages;
Utils::WStringList *m_pServers;
Utils::WString *_pCurrentServer;
private: System::Windows::Forms::ProgressBar^ progressBar1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Panel^ panel1;
private: System::Windows::Forms::Panel^ panel2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::ComponentModel::BackgroundWorker^ backgroundWorker1;
private: System::Windows::Forms::Panel^ panel3;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
/// <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->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->panel2 = (gcnew System::Windows::Forms::Panel());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
this->panel3 = (gcnew System::Windows::Forms::Panel());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->panel1->SuspendLayout();
this->panel2->SuspendLayout();
this->panel3->SuspendLayout();
this->SuspendLayout();
//
// progressBar1
//
this->progressBar1->Dock = System::Windows::Forms::DockStyle::Bottom;
this->progressBar1->Location = System::Drawing::Point(5, 109);
this->progressBar1->Name = L"progressBar1";
this->progressBar1->Size = System::Drawing::Size(475, 23);
this->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Marquee;
this->progressBar1->TabIndex = 0;
//
// label1
//
this->label1->Dock = System::Windows::Forms::DockStyle::Left;
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(5, 5);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(125, 20);
this->label1->TabIndex = 1;
this->label1->Text = L"Server:";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// label2
//
this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label2->Location = System::Drawing::Point(130, 5);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(340, 20);
this->label2->TabIndex = 2;
this->label2->Text = L"1/1";
this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// panel1
//
this->panel1->Controls->Add(this->label2);
this->panel1->Controls->Add(this->label1);
this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
this->panel1->Location = System::Drawing::Point(5, 5);
this->panel1->Name = L"panel1";
this->panel1->Padding = System::Windows::Forms::Padding(5);
this->panel1->Size = System::Drawing::Size(475, 30);
this->panel1->TabIndex = 3;
//
// panel2
//
this->panel2->Controls->Add(this->label3);
this->panel2->Controls->Add(this->label4);
this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
this->panel2->Location = System::Drawing::Point(5, 35);
this->panel2->Name = L"panel2";
this->panel2->Padding = System::Windows::Forms::Padding(5);
this->panel2->Size = System::Drawing::Size(475, 30);
this->panel2->TabIndex = 4;
//
// label3
//
this->label3->Dock = System::Windows::Forms::DockStyle::Fill;
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label3->Location = System::Drawing::Point(130, 5);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(340, 20);
this->label3->TabIndex = 2;
this->label3->Text = L"http://";
this->label3->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// label4
//
this->label4->Dock = System::Windows::Forms::DockStyle::Left;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label4->Location = System::Drawing::Point(5, 5);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(125, 20);
this->label4->TabIndex = 1;
this->label4->Text = L"Address:";
this->label4->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// backgroundWorker1
//
this->backgroundWorker1->WorkerReportsProgress = true;
this->backgroundWorker1->WorkerSupportsCancellation = true;
this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &DownloadPackageList::backgroundWorker1_DoWork);
this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &DownloadPackageList::backgroundWorker1_RunWorkerCompleted);
//
// panel3
//
this->panel3->Controls->Add(this->label5);
this->panel3->Controls->Add(this->label6);
this->panel3->Dock = System::Windows::Forms::DockStyle::Top;
this->panel3->Location = System::Drawing::Point(5, 65);
this->panel3->Name = L"panel3";
this->panel3->Padding = System::Windows::Forms::Padding(5);
this->panel3->Size = System::Drawing::Size(475, 30);
this->panel3->TabIndex = 5;
//
// label5
//
this->label5->Dock = System::Windows::Forms::DockStyle::Fill;
this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label5->Location = System::Drawing::Point(130, 5);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(340, 20);
this->label5->TabIndex = 2;
this->label5->Text = L"0";
this->label5->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// label6
//
this->label6->Dock = System::Windows::Forms::DockStyle::Left;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label6->Location = System::Drawing::Point(5, 5);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(125, 20);
this->label6->TabIndex = 1;
this->label6->Text = L"Packages:";
this->label6->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
//
// DownloadPackageList
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(485, 137);
this->Controls->Add(this->panel3);
this->Controls->Add(this->panel2);
this->Controls->Add(this->panel1);
this->Controls->Add(this->progressBar1);
this->MaximizeBox = false;
this->MinimizeBox = false;
this->Name = L"DownloadPackageList";
this->Padding = System::Windows::Forms::Padding(5);
this->ShowIcon = false;
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"Download Package List";
this->Load += gcnew System::EventHandler(this, &DownloadPackageList::DownloadPackageList_Load);
this->panel1->ResumeLayout(false);
this->panel2->ResumeLayout(false);
this->panel3->ResumeLayout(false);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void DownloadPackageList_Load(System::Object^ sender, System::EventArgs^ e) {
this->NextServer();
}
private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) {
String ^url = _US(*_pCurrentServer) + "/xpackagedata.dat";
int error = CheckWebFileExists(url);
if ( backgroundWorker1->CancellationPending )
return;
if ( error == CONNECTERROR_NONE )
{
String ^data = ReadDataFromWeb(url);
if ( data )
this->ExtractWebData(data);
}
}
private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e) {
// update the package list
this->label5->Text = Convert::ToString(m_pPackages->getAvailablePackageList()->size());
// do next server
this->NextServer();
}
};
}