Esempio n. 1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            this.btnOK.Enabled     = false;
            this.btnCancel.Enabled = false;

            if (StaticWindows.Requester(
                    "Wollen Sie wirklich Ihre Microsoft SQL Server Datenbank in die SQLite Datenbank migrieren?"
                    ) == System.Windows.Forms.DialogResult.Yes)
            {
                this.lblState.Text = "Migration gestartet, lade Daten...";

                this.btnCancel.Enabled = true;

                this._importer = new SQLServerToSQLiteImporter();
                this._importer.PercentState += new ImportPercentEventHandler(_importer_PercentState);

                if (this._importer.Import())
                {
                    StaticWindows.InfoBox("Erfolgreich migriert!");
                }
                else
                {
                    StaticWindows.ErrorBox("Während der Migration ist ein Fehler aufgetreten!");
                }
            }
            else
            {
                this.lblState.Text = "Migration abgebrochen!";

                this.btnOK.Enabled     = true;
                this.btnCancel.Enabled = true;
            }
        }
Esempio n. 2
0
        // ---------------------------------------------------
        // CONSTRUCTORS
        // ---------------------------------------------------

        /// <summary>
        /// Default Ctor
        /// </summary>
        public DatabaseBackupForm()
        {
            InitializeComponent();

            this._brh = new BackupRestoreHandler(Configuration.ConnectionString);

            this.DialogResult = DialogResult.Cancel;

            this._brh.BackupPercentEvent  += new BackupRestoreHandler.BackupPercentEventHandler(_brh_BackupPercentEvent);
            this._brh.BackupCompleteEvent += new BackupRestoreHandler.BackupCompleteEventHandler(_brh_BackupCompleteEvent);

            this.pbProgress.Minimum = 0;
            this.pbProgress.Maximum = 100;

            this.fbDialog.RootFolder = Environment.SpecialFolder.MyComputer;

            try {
                this.gbBackup.Text = "Letztes Backup am: " + this._brh.GetLastBackupDate().ToString();
                this.txtPath.Text  = Configuration.CommonApplicationTempPath;
            }
            catch (Exception ex) {
                StringBuilder str = new StringBuilder();
                str.Append("Die Backupschnittstelle konnte nicht initialisiert werden.");
                str.Append(" Eventuell sind nicht alle notwendigen Komponenten installiert.");
                str.Append("\n\n");
                str.Append("Fehlermeldung: ");
                str.Append(ex.Message);

                StaticWindows.ErrorBox(str.ToString());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the Click event of the btnOpenEditor control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnOpenEditor_Click(object sender, EventArgs e)
        {
            if (this.txtResponse.Text.Length > 0)
            {
                WikipediaParser parser = new WikipediaParser(
                    Configuration.ConnectionString
                    );

                Movie mov = parser.Parse(this.txtResponse.Text);

                // search for movie with title like mov.Title

                if (mov != null)
                {
                    MovieForm form = new MovieForm(mov);

                    if (form.ShowDialog(this) == DialogResult.OK)
                    {
                        // alles schliessen
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                        this.DialogResult = DialogResult.OK;
                    }
                }
                else
                {
                    StaticWindows.ErrorBox("Fehler: Es konnte kein Film geparst werden!");
                }
            }
            else
            {
                StaticWindows.ErrorBox("Fehler: Es ist kein Wikipedia Artikel ausgewählt!");
            }
        }
Esempio n. 4
0
        /// <summary>
        /// _export_s the excel export finish.
        /// </summary>
        /// <param name="successfull">if set to <c>true</c> [successfull].</param>
        /// <param name="text">The text.</param>
        void _export_ExcelExportFinish(bool successfull, string text)
        {
            this.btnOK.Enabled     = true;
            this.btnCancel.Enabled = true;

            this.txtFilename.Enabled   = true;
            this.txtTargetPath.Enabled = true;
            this.txtSheettitle.Enabled = true;

            this.cbExport.Enabled = true;

            foreach (CheckBox chk in this.colsPanel.Controls)
            {
                chk.Enabled = true;
            }

            if (this._filename.Trim() != "" &&
                successfull)
            {
                this.pbState.Value = this.pbState.Maximum;
                this.lblState.Text = text;

                this.lblState.Refresh();
                this.lblState.Update();

                try {
                    AppLoader loader = new AppLoader();
                    loader.LoadApp(this._filename);
                }
                catch (Exception ex) {
                    StaticWindows.ErrorBox(ex.Message);
                }

                this.pbState.Value = 0;
                this.lblState.Text = "";

                this.lblState.Refresh();
                this.lblState.Update();
            }
            else
            {
                StaticWindows.ErrorBox("Es trat ein unbekannter Fehler während des Exports auf!");
            }

            this.pbState.Maximum = this._movies.Count;

            foreach (CheckBox chk in this.colsPanel.Controls)
            {
                this.pbState.Maximum += 1;
            }
        }
Esempio n. 5
0
        static void Main()
        {
            bool __startOldApp    = false;
            int  __windowsVersion = Environment.OSVersion.Version.Major;

            if (__windowsVersion < 6)
            {
                StaticWindows.InfoBox(
                    "MovieMatic2: Windows Vista Not Found",
                    "This program requires Windows Vista or later to run,"
                    + "\nbut for compatibility reason we start the old version."
                    );

                __startOldApp = true;
            }

            if (__startOldApp)
            {
                string mmPath = Application.ResourceAssembly.Location;
                mmPath = mmPath.Replace(Application.ResourceAssembly.ManifestModule.Name, "MovieMatic.exe");

                if (File.Exists(mmPath))
                {
                    AppLoader loader = new AppLoader();
                    loader.LoadApp(mmPath);
                }
                else
                {
                    StaticWindows.ErrorBox(
                        "MovieMatic2: MovieMatic version 1.x not found",
                        "MovieMatic version 1.x cannot start then the program was not found."
                        );
                }
            }
            else
            {
                App.Main();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Handles the Click event of the btnOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            this.pbState.Value = 0;
            this.lblState.Text = "";

            this.lblState.Text = "Starte Export...";
            this.lblState.Refresh();
            this.lblState.Update();

            string filename   = "Movies_" + DateTime.Now.ToFileNameString() + ".xls";
            string targetPath = Configuration.CommonApplicationTempPath;
            string sheetTitle = "Filmliste vom " + DateTime.Now.ToShortDateString();

            if (!this.txtFilename.Text.IsNullOrTrimmedEmpty())
            {
                if (!PathExtensions.GetFullExtension(this.txtFilename.Text).ToLower().Contains(".xls") &&
                    !PathExtensions.GetFullExtension(this.txtFilename.Text).ToLower().Contains(".xlsx") &&
                    !PathExtensions.GetFullExtension(this.txtFilename.Text).ToLower().Contains(".ods"))
                {
                    this.txtFilename.Text = this.txtFilename.Text + ".xls";
                }

                filename = this.txtFilename.Text;
            }

            if (!this.txtTargetPath.Text.IsNullOrTrimmedEmpty())
            {
                bool thisTarget = false;

                if (!Directory.Exists(this.txtTargetPath.Text))
                {
                    if (StaticWindows.Requester(
                            "Das angegebene Verzeichnis existiert nicht, wollen sie es nun anlegen?"
                            ) == DialogResult.Yes)
                    {
                        try {
                            Directory.CreateDirectory(this.txtTargetPath.Text);

                            thisTarget = true;
                        }
                        catch (Exception ex) {
                            Exception ex2 = new Exception("Verzeichnis konnte nicht erstellt werden!", ex);

                            StaticWindows.DisplayErrorMessagebox(ex2);
                        }
                    }
                }

                if (thisTarget)
                {
                    targetPath = this.txtTargetPath.Text;
                }
            }

            if (!this.txtSheettitle.Text.IsNullOrTrimmedEmpty())
            {
                sheetTitle = this.txtSheettitle.Text;
            }

            this.btnOK.Enabled     = false;
            this.btnCancel.Enabled = false;

            this.txtFilename.Enabled   = false;
            this.txtTargetPath.Enabled = false;
            this.txtSheettitle.Enabled = false;

            this.cbExport.Enabled = false;

            this.groupBox1.Refresh();
            this.groupBox1.Update();

            foreach (CheckBox chk in this.colsPanel.Controls)
            {
                chk.Enabled = false;
            }

            this.groupBox2.Refresh();
            this.groupBox2.Update();

            this._Export(filename, targetPath, sheetTitle);
        }