Subversion Repositories spk

Rev

Rev 1 | Go to most recent revision | 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;

#include <spk.h>

namespace PluginManager {

        /// <summary>
        /// Summary for StartUp
        ///
        /// 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 StartUp : public System::Windows::Forms::Form
        {
        public:
                StartUp(CPackages *p, Utils::String *dir, bool hide, bool advanced)
                {
                        InitializeComponent();

                        m_bLoaded = false;
                        m_pPackages = p;
                        m_bHide = hide;
                        progressBar1->Hide();
                        _sDir = dir;
                        m_iLoadStatus = 0;
                        m_iProgressMax = m_iProgressCount = 0;

                        backgroundWorker1->DoWork += gcnew DoWorkEventHandler( this, &StartUp::Background_DoWork );
                        backgroundWorker1->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler( this, &StartUp::Background_Finished );
                        backgroundWorker1->ProgressChanged += gcnew ProgressChangedEventHandler( this, &StartUp::Background_Progress );

                        this->Text = GetProgramName(advanced) + " " + GetVersionString();
                }

                bool LoadDirectory();

                void SetProgress(const long cur, const long max)
                {
                }

                ProgressBar ^GetProgress() { return progressBar1; }

                void Background_DoWork(System::Object ^Sender, DoWorkEventArgs ^E);
                void Background_Progress(System::Object ^Sender, ProgressChangedEventArgs ^E);
                void Background_Finished(System::Object ^Sender, RunWorkerCompletedEventArgs ^E);
        protected:
                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~StartUp()
                {
                        if (components)
                        {
                                delete components;
                        }
                }
        private: System::Windows::Forms::Label^  label1;
        private: System::Windows::Forms::ProgressBar^  progressBar1;
        protected: 
                CPackages  *m_pPackages;
                Utils::String  *_sDir;
                bool        m_bLoaded;
                int                     m_iLoadStatus;
                int                     m_iProgressMax;
                int                     m_iProgressCount;
                bool            m_bHide;

        private: System::Windows::Forms::Label^  label2;
        private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
        private: System::Windows::Forms::PictureBox^  pictureBox1;
        protected: 

        private:
                /// <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)
                {
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(StartUp::typeid));
                        this->label1 = (gcnew System::Windows::Forms::Label());
                        this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
                        this->label2 = (gcnew System::Windows::Forms::Label());
                        this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
                        this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
                        this->SuspendLayout();
                        // 
                        // label1
                        // 
                        this->label1->Anchor = System::Windows::Forms::AnchorStyles::None;
                        this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->label1->Location = System::Drawing::Point(11, 117);
                        this->label1->Name = L"label1";
                        this->label1->Padding = System::Windows::Forms::Padding(5);
                        this->label1->Size = System::Drawing::Size(465, 35);
                        this->label1->TabIndex = 0;
                        this->label1->Text = L"Loading Directory";
                        this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
                        this->label1->Click += gcnew System::EventHandler(this, &StartUp::label1_Click);
                        // 
                        // progressBar1
                        // 
                        this->progressBar1->Dock = System::Windows::Forms::DockStyle::Bottom;
                        this->progressBar1->Location = System::Drawing::Point(0, 186);
                        this->progressBar1->Name = L"progressBar1";
                        this->progressBar1->Size = System::Drawing::Size(489, 25);
                        this->progressBar1->TabIndex = 1;
                        this->progressBar1->Visible = false;
                        // 
                        // label2
                        // 
                        this->label2->Anchor = System::Windows::Forms::AnchorStyles::Top;
                        this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->label2->Location = System::Drawing::Point(12, 157);
                        this->label2->Name = L"label2";
                        this->label2->Size = System::Drawing::Size(465, 20);
                        this->label2->TabIndex = 2;
                        this->label2->Text = L"label2";
                        this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
                        // 
                        // backgroundWorker1
                        // 
                        this->backgroundWorker1->WorkerReportsProgress = true;
                        // 
                        // pictureBox1
                        // 
                        this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
                        this->pictureBox1->Location = System::Drawing::Point(0, 2);
                        this->pictureBox1->Name = L"pictureBox1";
                        this->pictureBox1->Size = System::Drawing::Size(487, 112);
                        this->pictureBox1->TabIndex = 3;
                        this->pictureBox1->TabStop = false;
                        // 
                        // StartUp
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(96, 96);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Dpi;
                        this->AutoSize = true;
                        this->ClientSize = System::Drawing::Size(489, 211);
                        this->Controls->Add(this->pictureBox1);
                        this->Controls->Add(this->label2);
                        this->Controls->Add(this->progressBar1);
                        this->Controls->Add(this->label1);
                        this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
                        this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
                        this->Name = L"StartUp";
                        this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
                        this->Text = L"X-Universe Plugin Manager Lite";
                        this->TopMost = true;
                        this->Load += gcnew System::EventHandler(this, &StartUp::StartUp_Load);
                        (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
                        this->ResumeLayout(false);

                }
#pragma endregion
        private: System::Void StartUp_Load(System::Object^  sender, System::EventArgs^  e) {
                                this->label2->Text = _US(*_sDir);
                                if ( m_bHide )
                                {
                                        this->Hide();
                                        this->WindowState = System::Windows::Forms::FormWindowState::Minimized;
                                }
                                else
                                        this->Show();
                                backgroundWorker1->RunWorkerAsync();
                         }
private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
                 }
};

        /*
        public class StartUpProgress : public CProgressInfo
        {
        public:
                StartUpProgress() { }
                virtual void ProgressUpdated ( const long cur, const long max ) 
                { 
                        StartupUpdateProgress(cur, max);
                };
                virtual void ProgressUpdated2 ( const long cur, const long max ) { };
                virtual void StatusUpdated(int i) { }
                virtual void DoingFile ( C_File *file ) { };
        };*/
}