Subversion Repositories spk

Rev

Rev 39 | 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;

namespace SpkExplorer {

        /// <summary>
        /// Summary for ConvertFile
        ///
        /// 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 ConvertFile : public System::Windows::Forms::Form
        {
        public:
                ConvertFile(String ^file)
                {
                        InitializeComponent();

                        this->label2->Text = file;
                }

        protected:
                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~ConvertFile()
                {
                        if (components)
                        {
                                delete components;
                        }
                }

        private:
                /// <summary>
                /// Required designer variable.
                /// </summary>
        private: System::ComponentModel::BackgroundWorker ^ backgroundWorker1;
        private: System::Windows::Forms::Panel^  panel1;
        private: System::Windows::Forms::ProgressBar^  progressBar1;
        private: System::Windows::Forms::Label^  label1;
        private: System::Windows::Forms::Label^  label2;
                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->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
                        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->panel1->SuspendLayout();
                        this->SuspendLayout();
                        // 
                        // backgroundWorker1
                        // 
                        this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &ConvertFile::backgroundWorker1_DoWork);
                        this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &ConvertFile::backgroundWorker1_RunWorkerCompleted);
                        // 
                        // progressBar1
                        // 
                        this->progressBar1->Dock = System::Windows::Forms::DockStyle::Bottom;
                        this->progressBar1->Location = System::Drawing::Point(5, 87);
                        this->progressBar1->Name = L"progressBar1";
                        this->progressBar1->Size = System::Drawing::Size(407, 30);
                        this->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Marquee;
                        this->progressBar1->TabIndex = 0;
                        // 
                        // 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(5, 5);
                        this->label1->Name = L"label1";
                        this->label1->Size = System::Drawing::Size(407, 36);
                        this->label1->TabIndex = 1;
                        this->label1->Text = L"Converting File";
                        this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
                        // 
                        // label2
                        // 
                        this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->label2->Location = System::Drawing::Point(5, 41);
                        this->label2->Name = L"label2";
                        this->label2->Size = System::Drawing::Size(407, 46);
                        this->label2->TabIndex = 2;
                        this->label2->Text = L"label2";
                        this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
                        // 
                        // panel1
                        // 
                        this->panel1->BackColor = System::Drawing::SystemColors::Control;
                        this->panel1->Controls->Add(this->label2);
                        this->panel1->Controls->Add(this->progressBar1);
                        this->panel1->Controls->Add(this->label1);
                        this->panel1->Dock = System::Windows::Forms::DockStyle::Fill;
                        this->panel1->Location = System::Drawing::Point(5, 5);
                        this->panel1->Margin = System::Windows::Forms::Padding(5);
                        this->panel1->Name = L"panel1";
                        this->panel1->Padding = System::Windows::Forms::Padding(5);
                        this->panel1->Size = System::Drawing::Size(417, 122);
                        this->panel1->TabIndex = 3;
                        // 
                        // ConvertFile
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->BackColor = System::Drawing::SystemColors::ControlDark;
                        this->ClientSize = System::Drawing::Size(427, 132);
                        this->ControlBox = false;
                        this->Controls->Add(this->panel1);
                        this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
                        this->Name = L"ConvertFile";
                        this->Padding = System::Windows::Forms::Padding(5);
                        this->ShowIcon = false;
                        this->ShowInTaskbar = false;
                        this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
                        this->Text = L"ConvertFile";
                        this->Load += gcnew System::EventHandler(this, &ConvertFile::ConvertFile_Load);
                        this->panel1->ResumeLayout(false);
                        this->ResumeLayout(false);

                }
#pragma endregion
        private: System::Void ConvertFile_Load(System::Object^  sender, System::EventArgs^  e) {
                                this->backgroundWorker1->RunWorkerAsync();

                         }
        private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
                                System::Threading::Thread::Sleep(100);
                                CXspFile *xsp = new CXspFile;
                                Utils::String sFile = _S(this->label2->Text);
                                if ( xsp->ConvertOld(sFile) )
                                {
                                        if ( xsp->writeFile(sFile) )
                                                this->DialogResult = Windows::Forms::DialogResult::OK;
                                }

                                delete xsp;
                         }
        private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^  sender, System::ComponentModel::RunWorkerCompletedEventArgs^  e) {
                                this->Close();
                         }
};
}