public FirstTimeConfigForm() { InitializeComponent(); pbLogo.Image = ImageHelpers.ResizeImage(ShareXResources.Logo, 128, 128); cbRunStartup.Checked = IntegrationHelpers.CheckStartupShortcut(); cbShellContextMenuButton.Checked = IntegrationHelpers.CheckShellContextMenuButton(); cbSendToMenu.Checked = IntegrationHelpers.CheckSendToMenuButton(); #if STEAM cbSteamInApp.Checked = IntegrationHelpers.CheckSteamShowInApp(); #else cbSteamInApp.Visible = false; #endif loaded = true; }
private void UpdateControls() { ready = false; // General ChangeLanguage(Program.Settings.Language); cbShowTray.Checked = Program.Settings.ShowTray; cbSilentRun.Enabled = Program.Settings.ShowTray; cbSilentRun.Checked = Program.Settings.SilentRun; cbTrayIconProgressEnabled.Checked = Program.Settings.TrayIconProgressEnabled; cbTaskbarProgressEnabled.Enabled = TaskbarManager.IsPlatformSupported; cbTaskbarProgressEnabled.Checked = Program.Settings.TaskbarProgressEnabled; cbRememberMainFormPosition.Checked = Program.Settings.RememberMainFormPosition; cbRememberMainFormSize.Checked = Program.Settings.RememberMainFormSize; cbTrayLeftDoubleClickAction.SelectedIndex = (int)Program.Settings.TrayLeftDoubleClickAction; cbTrayLeftClickAction.SelectedIndex = (int)Program.Settings.TrayLeftClickAction; cbTrayMiddleClickAction.SelectedIndex = (int)Program.Settings.TrayMiddleClickAction; cbCheckPreReleaseUpdates.Checked = Program.Settings.CheckPreReleaseUpdates; // Integration cbStartWithWindows.Checked = IntegrationHelpers.CheckStartupShortcut(); cbShellContextMenu.Checked = IntegrationHelpers.CheckShellContextMenuButton(); cbSendToMenu.Checked = IntegrationHelpers.CheckSendToMenuButton(); #if STEAM cbSteamShowInApp.Checked = IntegrationHelpers.CheckSteamShowInApp(); #else gbSteam.Visible = false; #endif // Paths txtPersonalFolderPath.Text = Program.ReadPersonalPathConfig(); UpdatePersonalFolderPathPreview(); cbUseCustomScreenshotsPath.Checked = Program.Settings.UseCustomScreenshotsPath; txtCustomScreenshotsPath.Text = Program.Settings.CustomScreenshotsPath; txtSaveImageSubFolderPattern.Text = Program.Settings.SaveImageSubFolderPattern; // Export / Import cbExportSettings.Checked = Program.Settings.ExportSettings; cbExportHistory.Checked = Program.Settings.ExportHistory; cbExportLogs.Checked = Program.Settings.ExportLogs; UpdateExportButton(); // Proxy cbProxyMethod.SelectedIndex = (int)Program.Settings.ProxySettings.ProxyMethod; txtProxyUsername.Text = Program.Settings.ProxySettings.Username; txtProxyPassword.Text = Program.Settings.ProxySettings.Password; txtProxyHost.Text = Program.Settings.ProxySettings.Host ?? ""; nudProxyPort.SetValue(Program.Settings.ProxySettings.Port); UpdateProxyControls(); // Upload nudUploadLimit.SetValue(Program.Settings.UploadLimit); cbBufferSize.Items.Clear(); for (int i = 0; i < MaxBufferSizePower; i++) { string size = ((long)(Math.Pow(2, i) * 1024)).ToSizeString(Program.Settings.BinaryUnits, 0); cbBufferSize.Items.Add(size); } cbBufferSize.SelectedIndex = Program.Settings.BufferSizePower.Between(0, MaxBufferSizePower); lvClipboardFormats.Items.Clear(); foreach (ClipboardFormat cf in Program.Settings.ClipboardContentFormats) { AddClipboardFormat(cf); } nudRetryUpload.SetValue(Program.Settings.MaxUploadFailRetry); chkUseSecondaryUploaders.Checked = Program.Settings.UseSecondaryUploaders; tlpBackupDestinations.Enabled = Program.Settings.UseSecondaryUploaders; Program.Settings.SecondaryImageUploaders.AddRange(Helpers.GetEnums <ImageDestination>().Where(n => Program.Settings.SecondaryImageUploaders.All(e => e != n))); Program.Settings.SecondaryTextUploaders.AddRange(Helpers.GetEnums <TextDestination>().Where(n => Program.Settings.SecondaryTextUploaders.All(e => e != n))); Program.Settings.SecondaryFileUploaders.AddRange(Helpers.GetEnums <FileDestination>().Where(n => Program.Settings.SecondaryFileUploaders.All(e => e != n))); Program.Settings.SecondaryImageUploaders.Where(n => Helpers.GetEnums <ImageDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryImageUploaders.Remove(x)); Program.Settings.SecondaryTextUploaders.Where(n => Helpers.GetEnums <TextDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryTextUploaders.Remove(x)); Program.Settings.SecondaryFileUploaders.Where(n => Helpers.GetEnums <FileDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryFileUploaders.Remove(x)); lvSecondaryImageUploaders.Items.Clear(); Program.Settings.SecondaryImageUploaders.ForEach <ImageDestination>(x => lvSecondaryImageUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); lvSecondaryTextUploaders.Items.Clear(); Program.Settings.SecondaryTextUploaders.ForEach <TextDestination>(x => lvSecondaryTextUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); lvSecondaryFileUploaders.Items.Clear(); Program.Settings.SecondaryFileUploaders.ForEach <FileDestination>(x => lvSecondaryFileUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); // History cbHistorySaveTasks.Checked = Program.Settings.HistorySaveTasks; cbHistoryCheckURL.Checked = Program.Settings.HistoryCheckURL; cbRecentTasksSave.Checked = Program.Settings.RecentTasksSave; nudRecentTasksMaxCount.SetValue(Program.Settings.RecentTasksMaxCount); cbRecentTasksShowInMainWindow.Checked = Program.Settings.RecentTasksShowInMainWindow; cbRecentTasksShowInTrayMenu.Checked = Program.Settings.RecentTasksShowInTrayMenu; cbRecentTasksTrayMenuMostRecentFirst.Checked = Program.Settings.RecentTasksTrayMenuMostRecentFirst; // Print cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog; cbPrintDontShowWindowsDialog.Checked = !Program.Settings.PrintSettings.ShowPrintDialog; // Advanced pgSettings.SelectedObject = Program.Settings; tttvMain.MainTabControl = tcSettings; ready = true; }
private void LoadSettings() { // General foreach (SupportedLanguage language in Helpers.GetEnums <SupportedLanguage>()) { ToolStripMenuItem tsmi = new ToolStripMenuItem(language.GetLocalizedDescription()); tsmi.Image = GetLanguageIcon(language); tsmi.ImageScaling = ToolStripItemImageScaling.None; SupportedLanguage lang = language; tsmi.Click += (sender, e) => ChangeLanguage(lang); cmsLanguages.Items.Add(tsmi); } ChangeLanguage(Program.Settings.Language); cbShowTray.Checked = Program.Settings.ShowTray; cbSilentRun.Enabled = Program.Settings.ShowTray; cbSilentRun.Checked = Program.Settings.SilentRun; cbTrayIconProgressEnabled.Checked = Program.Settings.TrayIconProgressEnabled; cbTaskbarProgressEnabled.Enabled = TaskbarManager.IsPlatformSupported; cbTaskbarProgressEnabled.Checked = Program.Settings.TaskbarProgressEnabled; cbRememberMainFormPosition.Checked = Program.Settings.RememberMainFormPosition; cbRememberMainFormSize.Checked = Program.Settings.RememberMainFormSize; // Integration cbStartWithWindows.Checked = IntegrationHelpers.CheckStartupShortcut(); cbShellContextMenu.Checked = IntegrationHelpers.CheckShellContextMenuButton(); cbSendToMenu.Checked = IntegrationHelpers.CheckSendToMenuButton(); #if STEAM cbSteamShowInApp.Checked = IntegrationHelpers.CheckSteamShowInApp(); #else gbSteam.Visible = false; #endif // Paths txtPersonalFolderPath.Text = Program.ReadPersonalPathConfig(); UpdatePersonalFolderPathPreview(); cbUseCustomScreenshotsPath.Checked = Program.Settings.UseCustomScreenshotsPath; txtCustomScreenshotsPath.Text = Program.Settings.CustomScreenshotsPath; txtSaveImageSubFolderPattern.Text = Program.Settings.SaveImageSubFolderPattern; CodeMenu.Create <ReplCodeMenuEntry>(txtSaveImageSubFolderPattern, ReplCodeMenuEntry.t, ReplCodeMenuEntry.pn, ReplCodeMenuEntry.i, ReplCodeMenuEntry.width, ReplCodeMenuEntry.height, ReplCodeMenuEntry.n); // Proxy cbProxyMethod.Items.AddRange(Helpers.GetLocalizedEnumDescriptions <ProxyMethod>()); cbProxyMethod.SelectedIndex = (int)Program.Settings.ProxySettings.ProxyMethod; txtProxyUsername.Text = Program.Settings.ProxySettings.Username; txtProxyPassword.Text = Program.Settings.ProxySettings.Password; txtProxyHost.Text = Program.Settings.ProxySettings.Host ?? string.Empty; nudProxyPort.Value = Program.Settings.ProxySettings.Port; UpdateProxyControls(); // Upload nudUploadLimit.Value = Program.Settings.UploadLimit; for (int i = 0; i < MaxBufferSizePower; i++) { string size = ((long)(Math.Pow(2, i) * 1024)).ToSizeString(Program.Settings.BinaryUnits, 0); cbBufferSize.Items.Add(size); } cbBufferSize.SelectedIndex = Program.Settings.BufferSizePower.Between(0, MaxBufferSizePower); foreach (ClipboardFormat cf in Program.Settings.ClipboardContentFormats) { AddClipboardFormat(cf); } nudRetryUpload.Value = Program.Settings.MaxUploadFailRetry; chkUseSecondaryUploaders.Checked = Program.Settings.UseSecondaryUploaders; tlpBackupDestinations.Enabled = Program.Settings.UseSecondaryUploaders; Program.Settings.SecondaryImageUploaders.AddRange(Helpers.GetEnums <ImageDestination>().Where(n => Program.Settings.SecondaryImageUploaders.All(e => e != n))); Program.Settings.SecondaryTextUploaders.AddRange(Helpers.GetEnums <TextDestination>().Where(n => Program.Settings.SecondaryTextUploaders.All(e => e != n))); Program.Settings.SecondaryFileUploaders.AddRange(Helpers.GetEnums <FileDestination>().Where(n => Program.Settings.SecondaryFileUploaders.All(e => e != n))); Program.Settings.SecondaryImageUploaders.Where(n => Helpers.GetEnums <ImageDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryImageUploaders.Remove(x)); Program.Settings.SecondaryTextUploaders.Where(n => Helpers.GetEnums <TextDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryTextUploaders.Remove(x)); Program.Settings.SecondaryFileUploaders.Where(n => Helpers.GetEnums <FileDestination>().All(e => e != n)).ForEach(x => Program.Settings.SecondaryFileUploaders.Remove(x)); Program.Settings.SecondaryImageUploaders.ForEach <ImageDestination>(x => lvSecondaryImageUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); Program.Settings.SecondaryTextUploaders.ForEach <TextDestination>(x => lvSecondaryTextUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); Program.Settings.SecondaryFileUploaders.ForEach <FileDestination>(x => lvSecondaryFileUploaders.Items.Add(new ListViewItem(x.GetLocalizedDescription()) { Tag = x })); // Print cbDontShowPrintSettingDialog.Checked = Program.Settings.DontShowPrintSettingsDialog; cbPrintDontShowWindowsDialog.Checked = !Program.Settings.PrintSettings.ShowPrintDialog; // Advanced pgSettings.SelectedObject = Program.Settings; tttvMain.MainTabControl = tcSettings; }