Example #1
0
 public void OnApplicationStart(IAutoUpdaterClient client)
 {
     if (userConfigManager.Config.LastUpdateCheckDate == null)
     {
         userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
         userConfigManager.Save();
     }
     if (DateTime.Now - userConfigManager.Config.LastUpdateCheckDate > UpdateCheckInterval)
     {
         PromptToEnableAutomaticUpdates();
         CheckForUpdate(client);
     }
 }
Example #2
0
 public void RenamingProfile(string oldName, string newName)
 {
     if (string.IsNullOrEmpty(oldName))
     {
         return;
     }
     if (userConfigManager.Config.LastBatchSettings != null)
     {
         if (userConfigManager.Config.LastBatchSettings.ProfileDisplayName == oldName)
         {
             userConfigManager.Config.LastBatchSettings.ProfileDisplayName = newName;
             userConfigManager.Save();
         }
     }
 }
Example #3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (batchRunning)
            {
                return;
            }
            if (!ValidateSettings())
            {
                return;
            }

            // Update state
            batchRunning = true;
            cancelBatch  = false;

            // Update UI
            btnStart.Enabled  = false;
            btnCancel.Enabled = true;
            btnCancel.Text    = MiscResources.Cancel;
            EnableDisableSettings(false);

            // Start the batch
            batchThread = threadFactory.CreateThread(DoBatchScan);
            batchThread.Start();

            // Save settings for next time (could also do on form close)
            userConfigManager.Config.LastBatchSettings = BatchSettings;
            userConfigManager.Save();
        }
Example #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var pdfSettings = new PdfSettings
            {
                DefaultFileName = txtDefaultFileName.Text,
                Metadata        =
                {
                    Title    = txtTitle.Text,
                    Author   = txtAuthor.Text,
                    Subject  = txtSubject.Text,
                    Keywords = txtKeywords.Text
                },
                Encryption =
                {
                    EncryptPdf    = cbEncryptPdf.Checked,
                    OwnerPassword = txtOwnerPassword.Text,
                    UserPassword  = txtUserPassword.Text,
                    AllowContentCopyingForAccessibility = cbAllowContentCopyingForAccessibility.Checked,
                    AllowAnnotations          = cbAllowAnnotations.Checked,
                    AllowDocumentAssembly     = cbAllowDocumentAssembly.Checked,
                    AllowContentCopying       = cbAllowContentCopying.Checked,
                    AllowFormFilling          = cbAllowFormFilling.Checked,
                    AllowFullQualityPrinting  = cbAllowFullQualityPrinting.Checked,
                    AllowDocumentModification = cbAllowDocumentModification.Checked,
                    AllowPrinting             = cbAllowPrinting.Checked
                }
            };

            pdfSettingsContainer.PdfSettings     = pdfSettings;
            userConfigManager.Config.PdfSettings = cbRememberSettings.Checked ? pdfSettings : null;
            userConfigManager.Save();

            Close();
        }
Example #5
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (batchRunning)
            {
                return;
            }
            if (!ValidateSettings())
            {
                return;
            }

            // Update state
            batchRunning = true;
            cts          = new CancellationTokenSource();

            // Update UI
            btnStart.Enabled  = false;
            btnCancel.Enabled = true;
            btnCancel.Text    = MiscResources.Cancel;
            EnableDisableSettings(false);

            // Start the batch
            DoBatchScan().AssertNoAwait();

            // Save settings for next time (could also do on form close)
            userConfigManager.Config.LastBatchSettings = BatchSettings;
            userConfigManager.Save();
        }
Example #6
0
        public bool PromptToSaveImage(string defaultPath, out string savePath)
        {
            var(fileName, fileDir) = SplitPath(defaultPath);
            var sd = new SaveFileDialog
            {
                OverwritePrompt = false,
                AddExtension    = true,
                Filter          = MiscResources.FileTypeBmp + @"|*.bmp|" +
                                  MiscResources.FileTypeEmf + @"|*.emf|" +
                                  MiscResources.FileTypeExif + @"|*.exif|" +
                                  MiscResources.FileTypeGif + @"|*.gif|" +
                                  MiscResources.FileTypeJpeg + @"|*.jpg;*.jpeg|" +
                                  MiscResources.FileTypePng + @"|*.png|" +
                                  MiscResources.FileTypeTiff + @"|*.tiff;*.tif",
                FileName         = fileName,
                InitialDirectory = fileDir
            };

            switch ((userConfigManager.Config.LastImageExt ?? "").ToLowerInvariant())
            {
            case "bmp":
                sd.FilterIndex = 1;
                break;

            case "emf":
                sd.FilterIndex = 2;
                break;

            case "exif":
                sd.FilterIndex = 3;
                break;

            case "gif":
                sd.FilterIndex = 4;
                break;

            case "png":
                sd.FilterIndex = 6;
                break;

            case "tif":
            case "tiff":
                sd.FilterIndex = 7;
                break;

            default:     // Jpeg
                sd.FilterIndex = 5;
                break;
            }
            if (sd.ShowDialog() == DialogResult.OK)
            {
                savePath = sd.FileName;
                userConfigManager.Config.LastImageExt = (Path.GetExtension(savePath) ?? "").Replace(".", "");
                userConfigManager.Save();
                return(true);
            }
            savePath = null;
            return(false);
        }
        public void ShowModalProgress(IOperation op)
        {
            Attach(op);

            userConfigManager.Config.BackgroundOperations.Remove(op.GetType().Name);
            userConfigManager.Save();

            if (!op.IsFinished)
            {
                var form = formFactory.Create <FProgress>();
                form.Operation = op;
                form.ShowDialog();
            }

            if (!op.IsFinished)
            {
                ShowBackgroundProgress(op);
            }
        }
Example #8
0
 protected override void SaveToken(OauthToken token, bool refresh)
 {
     userConfigManager.Config.EmailSetup = userConfigManager.Config.EmailSetup ?? new EmailSetup();
     userConfigManager.Config.EmailSetup.OutlookWebToken = token;
     if (!refresh)
     {
         userConfigManager.Config.EmailSetup.OutlookWebUser = GetEmailAddress();
         userConfigManager.Config.EmailSetup.ProviderType   = EmailProviderType.OutlookWeb;
     }
     userConfigManager.Save();
 }
Example #9
0
 private void DoUpdateCheck()
 {
     if (cbCheckForUpdates.Checked)
     {
         updateChecker.CheckForUpdates().ContinueWith(task =>
         {
             if (task.IsFaulted)
             {
                 Log.ErrorException("Error checking for updates", task.Exception);
             }
             else
             {
                 userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
                 userConfigManager.Save();
             }
             update = task.Result;
             hasCheckedForUpdates = true;
             SafeInvoke(UpdateControls);
         });
     }
 }
Example #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var emailSettings = new EmailSettings
            {
                AttachmentName = txtAttachmentName.Text
            };

            emailSettingsContainer.EmailSettings   = emailSettings;
            userConfigManager.Config.EmailSettings = cbRememberSettings.Checked ? emailSettings : null;
            userConfigManager.Save();

            Close();
        }
Example #11
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var imageSettings = new ImageSettings
            {
                DefaultFileName = txtDefaultFileName.Text,
                JpegQuality     = tbJpegQuality.Value
            };

            imageSettingsContainer.ImageSettings   = imageSettings;
            userConfigManager.Config.ImageSettings = cbRememberSettings.Checked ? imageSettings : null;
            userConfigManager.Save();

            Close();
        }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            var imageSettings = new ImageSettings
            {
                DefaultFileName = txtDefaultFilePath.Text,
                SkipSavePrompt  = cbSkipSavePrompt.Checked,
                Quality         = tbJpegQuality.Value,
                TiffCompression = (TiffCompression)cmbTiffCompr.SelectedIndex,
                SinglePageTiff  = cbSinglePageTiff.Checked
            };

            imageSettingsContainer.ImageSettings   = imageSettings;
            userConfigManager.Config.ImageSettings = cbRememberSettings.Checked ? imageSettings : null;
            userConfigManager.Save();

            Close();
        }
Example #13
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var pdfSettings = new PdfSettings
            {
                DefaultFileName = txtDefaultFilePath.Text,
                SkipSavePrompt  = cbSkipSavePrompt.Checked,
                SinglePagePdf   = cbSinglePagePdf.Checked,
                ShowFolder      = cbShowFolder.Checked,
                Metadata        =
                {
                    Title    = txtTitle.Text,
                    Author   = txtAuthor.Text,
                    Subject  = txtSubject.Text,
                    Keywords = txtKeywords.Text
                },
                Encryption =
                {
                    EncryptPdf                          = cbEncryptPdf.Checked,
                    OwnerPassword                       = txtOwnerPassword.Text,
                    UserPassword                        = txtUserPassword.Text,
                    AllowPrinting                       = clbPerms.GetItemChecked(0),
                    AllowFullQualityPrinting            = clbPerms.GetItemChecked(1),
                    AllowDocumentModification           = clbPerms.GetItemChecked(2),
                    AllowDocumentAssembly               = clbPerms.GetItemChecked(3),
                    AllowContentCopying                 = clbPerms.GetItemChecked(4),
                    AllowContentCopyingForAccessibility = clbPerms.GetItemChecked(5),
                    AllowAnnotations                    = clbPerms.GetItemChecked(6),
                    AllowFormFilling                    = clbPerms.GetItemChecked(7)
                },
                Compat = (PdfCompat)cmbCompat.SelectedIndex
            };

            pdfSettingsContainer.PdfSettings     = pdfSettings;
            userConfigManager.Config.PdfSettings = cbRememberSettings.Checked ? pdfSettings : null;
            userConfigManager.Save();

            Close();
        }