コード例 #1
0
        private void FolderPath_TextChanged(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.BackupChatLogAutomatically)
            {
                BackupSettings.ResetSettings();

                StatusLabel.Text = string.Format(Strings.BackupStatus, Strings.Disabled);
                MessageBox.Show(Strings.BackupTurnedOff, Strings.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
        private void AutomaticBackupSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(FolderPath.Text) || !Directory.Exists(FolderPath.Text + "client_resources\\"))
            {
                MessageBox.Show(Strings.InvalidFolderPathBackup, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (Properties.Settings.Default.BackupChatLogAutomatically)
            {
                if (MessageBox.Show(Strings.BackupWillBeOff, Strings.Warning, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                {
                    return;
                }

                StatusLabel.Text = string.Format(Strings.BackupStatus, Strings.Disabled);
            }
            else
            {
                MessageBox.Show(Strings.SettingsAfterClose, Strings.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            BackupHandler.AbortAll();
            SaveSettings();

            if (backupSettings == null)
            {
                backupSettings             = new BackupSettings();
                backupSettings.FormClosed += (s, args) =>
                {
                    BackupHandler.Initialize();
                    StatusLabel.Text = string.Format(Strings.BackupStatus, Properties.Settings.Default.BackupChatLogAutomatically ? Strings.Enabled : Strings.Disabled);
                };
            }
            else
            {
                backupSettings.LoadSettings();

                backupSettings.WindowState = FormWindowState.Normal;
                backupSettings.BringToFront();
            }

            backupSettings.ShowDialog();
        }