Exemple #1
0
        /// <summary>
        /// Allow users to alter their settings
        /// </summary>
        private void Mn_Settings_Click(object sender, EventArgs e)
        {
            string sOldSavePath = (string)SQL.GetSetting(SQL.Setting.SavePath);
            Form fmSet = new Settings();
            fmSet.ShowDialog();

            if (fmSet.DialogResult == DialogResult.Yes) {
                lvManga.GridLines = (bool)SQL.GetSetting(SQL.Setting.ShowGrid);
                PicBx_Cover.BackColor = (Color)SQL.GetSetting(SQL.Setting.BackgroundColour);
                lvManga.Columns[4].Width = (bool)SQL.GetSetting(SQL.Setting.ShowDate) ? Convert.ToInt32(colDate.Tag) : 0;

                coverQueue.LoadCovers = (bool)SQL.GetSetting(SQL.Setting.ShowCovers);
                lvManga.View = coverQueue.LoadCovers ? View.LargeIcon : View.Details;
                msClearCurrentCover.Visible = coverQueue.LoadCovers;
                ResizeLV();
                UpdateLV();

                //Update new DB save location
                if (sOldSavePath != (string)SQL.GetSetting(SQL.Setting.SavePath)) {
                    string sNew = SQL.GetSetting(SQL.Setting.SavePath) + "\\MangaDB.sqlite";
                    sOldSavePath += "\\MangaDB.sqlite";

                    //move current DB
                    if (!File.Exists(sNew) && File.Exists(sNew)) {
                        File.Move(sOldSavePath, sNew);
                    }
                    else if (File.Exists(sNew) && lvManga.Items.Count > 0) {
                        xMessage.ShowInfo("A database already exists at this location. We'll load it and leave your old DB in place.");
                    }

                    //reconnect & repopulate
                    SQL.Disconnect(Recycle: true);
                    if (SQL.Connect()) {
                        SQL.UpdateSetting(SQL.Setting.SavePath, sNew);
                        UpdateLV();

                        //set up CmbBx auto-complete
                        CmbBx_Type.Items.Clear();
                        CmbBx_Type.Items.AddRange(SQL.GetTypes());
                        acTxBx_Tags.KeyWords = SQL.GetTags();
                        acTxBx_Artist.KeyWords = SQL.GetArtists();

                        Text = "Default save location changed";
                    }
                    else {
                        xMessage.ShowError("Could not establish a connection with the database.");
                    }
                }
            }
            fmSet.Dispose();
        }
Exemple #2
0
        /// <summary>
        /// Allow users to alter their settings
        /// </summary>
        private void Mn_Settings_Click(object sender, EventArgs e)
        {
            string sOld = SQL.GetSetting(SQL.Setting.SavePath);
              Form fmSet = new Settings();
              fmSet.ShowDialog();

              if (fmSet.DialogResult == DialogResult.Yes) {
            lvManga.GridLines = SQL.GetSetting(SQL.Setting.ShowGrid) == "1";
            PicBx_Cover.BackColor = Color.FromArgb(
              Int32.Parse(SQL.GetSetting(SQL.Setting.BackgroundColour)));
            lvManga.Columns[4].Width =
              SQL.GetSetting(SQL.Setting.ShowDate) == "1" ? Convert.ToInt32(colDate.Tag) : 0;
            ResizeLV();

            //Update new DB save location
            if (sOld != SQL.GetSetting(SQL.Setting.SavePath)) {
              string sNew = SQL.GetSetting(SQL.Setting.SavePath) + "\\MangaDB.sqlite";
              sOld += "\\MangaDB.sqlite";

              //move current DB
              if (!File.Exists(sNew) && File.Exists(sNew)) {
            File.Move(sOld, sNew);
              }
              else if (File.Exists(sNew) && lvManga.Items.Count > 0) {
            MessageBox.Show("A database already exists at this location. We'll load it and leave your old DB in place.",
              Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
              }

              //reconnect & repopulate
              SQL.Disconnect(Recycle: true);
              if (SQL.Connect()) {
            SQL.UpdateSetting(SQL.Setting.SavePath, sNew);
            UpdateLV();

            //set up CmbBx autocomplete
            CmbBx_Type.Items.Clear();
            CmbBx_Artist.Items.Clear();
            CmbBx_Artist.Items.AddRange(SQL.GetArtists());
            CmbBx_Type.Items.AddRange(SQL.GetTypes());
            acTxBx_Tags.KeyWords = SQL.GetTags();

            Text = "Default save location changed";
              }
              else {
            MessageBox.Show("Could not establish a connection with the database.",
              Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
              }
            }
              }
              fmSet.Dispose();
        }