1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-20 20:34:08 +02:00

Refactor Settings tabs (replace IsReady, remove SelectTab with no parameters)

This commit is contained in:
chylex 2017-03-22 13:19:19 +01:00
parent 7548e2e202
commit f091b2526e
8 changed files with 55 additions and 80 deletions

View File

@ -32,10 +32,6 @@ public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler up
hasFinishedLoading = true; hasFinishedLoading = true;
} }
private void SelectTab<T>() where T : BaseTabSettings, new(){
SelectTab(() => new T());
}
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{ private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
BaseTabSettings control; BaseTabSettings control;
@ -44,7 +40,7 @@ private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
} }
else{ else{
control = tabs[typeof(T)] = constructor(); control = tabs[typeof(T)] = constructor();
control.Ready = true; control.OnReady();
tabPanel.ReplaceContent(control); tabPanel.ReplaceContent(control);
} }
} }

View File

@ -9,12 +9,11 @@ protected static UserConfig Config{
} }
} }
public bool Ready { get; set; }
public BaseTabSettings(){ public BaseTabSettings(){
Padding = new Padding(6); Padding = new Padding(6);
} }
public virtual void OnReady(){}
public virtual void OnClosing(){} public virtual void OnClosing(){}
protected static void PromptRestart(){ protected static void PromptRestart(){

View File

@ -54,7 +54,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources." + this.toolTip.SetToolTip(this.btnClearCache, "Clearing cache will free up space taken by downloaded images and other resources." +
""); "");
this.btnClearCache.UseVisualStyleBackColor = true; this.btnClearCache.UseVisualStyleBackColor = true;
this.btnClearCache.Click += new System.EventHandler(this.btnClearCache_Click);
// //
// checkHardwareAcceleration // checkHardwareAcceleration
// //
@ -68,7 +67,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" + this.toolTip.SetToolTip(this.checkHardwareAcceleration, "Uses your graphics card to improve performance.\r\nDisable if you experience issues" +
" with rendering."); " with rendering.");
this.checkHardwareAcceleration.UseVisualStyleBackColor = true; this.checkHardwareAcceleration.UseVisualStyleBackColor = true;
this.checkHardwareAcceleration.CheckedChanged += new System.EventHandler(this.checkHardwareAcceleration_CheckedChanged);
// //
// btnEditCefArgs // btnEditCefArgs
// //
@ -79,7 +77,6 @@ private void InitializeComponent() {
this.btnEditCefArgs.Text = "Edit CEF Arguments"; this.btnEditCefArgs.Text = "Edit CEF Arguments";
this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework."); this.toolTip.SetToolTip(this.btnEditCefArgs, "Set custom command line arguments for Chromium Embedded Framework.");
this.btnEditCefArgs.UseVisualStyleBackColor = true; this.btnEditCefArgs.UseVisualStyleBackColor = true;
this.btnEditCefArgs.Click += new System.EventHandler(this.btnEditCefArgs_Click);
// //
// btnEditCSS // btnEditCSS
// //
@ -90,7 +87,6 @@ private void InitializeComponent() {
this.btnEditCSS.Text = "Edit CSS"; this.btnEditCSS.Text = "Edit CSS";
this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows."); this.toolTip.SetToolTip(this.btnEditCSS, "Set custom CSS for browser and notification windows.");
this.btnEditCSS.UseVisualStyleBackColor = true; this.btnEditCSS.UseVisualStyleBackColor = true;
this.btnEditCSS.Click += new System.EventHandler(this.btnEditCSS_Click);
// //
// btnRestartArgs // btnRestartArgs
// //
@ -101,7 +97,6 @@ private void InitializeComponent() {
this.btnRestartArgs.Text = "Restart with Arguments"; this.btnRestartArgs.Text = "Restart with Arguments";
this.toolTip.SetToolTip(this.btnRestartArgs, "Restarts the program with customizable\r\ncommand line arguments."); this.toolTip.SetToolTip(this.btnRestartArgs, "Restarts the program with customizable\r\ncommand line arguments.");
this.btnRestartArgs.UseVisualStyleBackColor = true; this.btnRestartArgs.UseVisualStyleBackColor = true;
this.btnRestartArgs.Click += new System.EventHandler(this.btnRestartArgs_Click);
// //
// btnRestart // btnRestart
// //
@ -113,7 +108,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.btnRestart, "Restarts the program using the same command\r\nline arguments that were used at lau" + this.toolTip.SetToolTip(this.btnRestart, "Restarts the program using the same command\r\nline arguments that were used at lau" +
"nch."); "nch.");
this.btnRestart.UseVisualStyleBackColor = true; this.btnRestart.UseVisualStyleBackColor = true;
this.btnRestart.Click += new System.EventHandler(this.btnRestart_Click);
// //
// btnOpenAppFolder // btnOpenAppFolder
// //
@ -124,7 +118,6 @@ private void InitializeComponent() {
this.btnOpenAppFolder.Text = "Open Program Folder"; this.btnOpenAppFolder.Text = "Open Program Folder";
this.toolTip.SetToolTip(this.btnOpenAppFolder, "Opens the folder where the app is located."); this.toolTip.SetToolTip(this.btnOpenAppFolder, "Opens the folder where the app is located.");
this.btnOpenAppFolder.UseVisualStyleBackColor = true; this.btnOpenAppFolder.UseVisualStyleBackColor = true;
this.btnOpenAppFolder.Click += new System.EventHandler(this.btnOpenAppFolder_Click);
// //
// btnOpenDataFolder // btnOpenDataFolder
// //
@ -135,7 +128,6 @@ private void InitializeComponent() {
this.btnOpenDataFolder.Text = "Open Data Folder"; this.btnOpenDataFolder.Text = "Open Data Folder";
this.toolTip.SetToolTip(this.btnOpenDataFolder, "Opens the folder where your profile data is located."); this.toolTip.SetToolTip(this.btnOpenDataFolder, "Opens the folder where your profile data is located.");
this.btnOpenDataFolder.UseVisualStyleBackColor = true; this.btnOpenDataFolder.UseVisualStyleBackColor = true;
this.btnOpenDataFolder.Click += new System.EventHandler(this.btnOpenDataFolder_Click);
// //
// btnReset // btnReset
// //
@ -148,7 +140,6 @@ private void InitializeComponent() {
this.btnReset.TabIndex = 17; this.btnReset.TabIndex = 17;
this.btnReset.Text = "Restore Defaults"; this.btnReset.Text = "Restore Defaults";
this.btnReset.UseVisualStyleBackColor = true; this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
// //
// btnImport // btnImport
// //
@ -161,7 +152,6 @@ private void InitializeComponent() {
this.btnImport.TabIndex = 16; this.btnImport.TabIndex = 16;
this.btnImport.Text = "Import Profile"; this.btnImport.Text = "Import Profile";
this.btnImport.UseVisualStyleBackColor = true; this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
// //
// btnExport // btnExport
// //
@ -175,7 +165,6 @@ private void InitializeComponent() {
this.btnExport.TabIndex = 15; this.btnExport.TabIndex = 15;
this.btnExport.Text = "Export Profile"; this.btnExport.Text = "Export Profile";
this.btnExport.UseVisualStyleBackColor = true; this.btnExport.UseVisualStyleBackColor = true;
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
// //
// groupPerformance // groupPerformance
// //

View File

@ -31,9 +31,24 @@ public TabSettingsAdvanced(Action<string> reinjectBrowserCSS, PluginManager plug
})); }));
} }
private void btnClearCache_Click(object sender, EventArgs e){ public override void OnReady(){
if (!Ready)return; btnClearCache.Click += btnClearCache_Click;
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
btnEditCefArgs.Click += btnEditCefArgs_Click;
btnEditCSS.Click += btnEditCSS_Click;
btnExport.Click += btnExport_Click;
btnImport.Click += btnImport_Click;
btnReset.Click += btnReset_Click;
btnOpenAppFolder.Click += btnOpenAppFolder_Click;
btnOpenDataFolder.Click += btnOpenDataFolder_Click;
btnRestart.Click += btnRestart_Click;
btnRestartArgs.Click += btnRestartArgs_Click;
}
private void btnClearCache_Click(object sender, EventArgs e){
btnClearCache.Enabled = false; btnClearCache.Enabled = false;
BrowserCache.SetClearOnExit(); BrowserCache.SetClearOnExit();
@ -41,8 +56,6 @@ private void btnClearCache_Click(object sender, EventArgs e){
} }
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){ private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
bool succeeded = false; bool succeeded = false;
if (checkHardwareAcceleration.Checked){ if (checkHardwareAcceleration.Checked){

View File

@ -53,7 +53,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a toolti" + this.toolTip.SetToolTip(this.checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a toolti" +
"p instead."); "p instead.");
this.checkExpandLinks.UseVisualStyleBackColor = true; this.checkExpandLinks.UseVisualStyleBackColor = true;
this.checkExpandLinks.CheckedChanged += new System.EventHandler(this.checkExpandLinks_CheckedChanged);
// //
// comboBoxTrayType // comboBoxTrayType
// //
@ -64,7 +63,6 @@ private void InitializeComponent() {
this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21); this.comboBoxTrayType.Size = new System.Drawing.Size(171, 21);
this.comboBoxTrayType.TabIndex = 13; this.comboBoxTrayType.TabIndex = 13;
this.toolTip.SetToolTip(this.comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu."); this.toolTip.SetToolTip(this.comboBoxTrayType, "Changes behavior of the Tray icon.\r\nRight-click the icon for an action menu.");
this.comboBoxTrayType.SelectedIndexChanged += new System.EventHandler(this.comboBoxTrayType_SelectedIndexChanged);
// //
// checkTrayHighlight // checkTrayHighlight
// //
@ -78,7 +76,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with po" + this.toolTip.SetToolTip(this.checkTrayHighlight, "Highlights the tray icon if there are new tweets.\r\nOnly works for columns with po" +
"pup or audio notifications.\r\nThe icon resets when the main window is restored."); "pup or audio notifications.\r\nThe icon resets when the main window is restored.");
this.checkTrayHighlight.UseVisualStyleBackColor = true; this.checkTrayHighlight.UseVisualStyleBackColor = true;
this.checkTrayHighlight.CheckedChanged += new System.EventHandler(this.checkTrayHighlight_CheckedChanged);
// //
// checkSpellCheck // checkSpellCheck
// //
@ -90,7 +87,6 @@ private void InitializeComponent() {
this.checkSpellCheck.Text = "Enable Spell Check"; this.checkSpellCheck.Text = "Enable Spell Check";
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly."); this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
this.checkSpellCheck.UseVisualStyleBackColor = true; this.checkSpellCheck.UseVisualStyleBackColor = true;
this.checkSpellCheck.CheckedChanged += new System.EventHandler(this.checkSpellCheck_CheckedChanged);
// //
// checkScreenshotBorder // checkScreenshotBorder
// //
@ -102,7 +98,6 @@ private void InitializeComponent() {
this.checkScreenshotBorder.Text = "Include Border In Screenshots"; this.checkScreenshotBorder.Text = "Include Border In Screenshots";
this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots."); this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots.");
this.checkScreenshotBorder.UseVisualStyleBackColor = true; this.checkScreenshotBorder.UseVisualStyleBackColor = true;
this.checkScreenshotBorder.CheckedChanged += new System.EventHandler(this.checkScreenshotBorder_CheckedChanged);
// //
// groupTray // groupTray
// //
@ -161,7 +156,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" + this.toolTip.SetToolTip(this.checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear aga" +
"in."); "in.");
this.checkUpdateNotifications.UseVisualStyleBackColor = true; this.checkUpdateNotifications.UseVisualStyleBackColor = true;
this.checkUpdateNotifications.CheckedChanged += new System.EventHandler(this.checkUpdateNotifications_CheckedChanged);
// //
// btnCheckUpdates // btnCheckUpdates
// //
@ -172,7 +166,6 @@ private void InitializeComponent() {
this.btnCheckUpdates.Text = "Check Updates Now"; this.btnCheckUpdates.Text = "Check Updates Now";
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed."); this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
this.btnCheckUpdates.UseVisualStyleBackColor = true; this.btnCheckUpdates.UseVisualStyleBackColor = true;
this.btnCheckUpdates.Click += new System.EventHandler(this.btnCheckUpdates_Click);
// //
// TabSettingsGeneral // TabSettingsGeneral
// //

View File

@ -30,46 +30,44 @@ public TabSettingsGeneral(UpdateHandler updates){
checkUpdateNotifications.Checked = Config.EnableUpdateCheck; checkUpdateNotifications.Checked = Config.EnableUpdateCheck;
} }
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){ public override void OnReady(){
if (!Ready)return; checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
checkScreenshotBorder.CheckedChanged += checkScreenshotBorder_CheckedChanged;
comboBoxTrayType.SelectedIndexChanged += comboBoxTrayType_SelectedIndexChanged;
checkTrayHighlight.CheckedChanged += checkTrayHighlight_CheckedChanged;
checkUpdateNotifications.CheckedChanged += checkUpdateNotifications_CheckedChanged;
btnCheckUpdates.Click += btnCheckUpdates_Click;
}
private void checkExpandLinks_CheckedChanged(object sender, EventArgs e){
Config.ExpandLinksOnHover = checkExpandLinks.Checked; Config.ExpandLinksOnHover = checkExpandLinks.Checked;
} }
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){ private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.EnableSpellCheck = checkSpellCheck.Checked; Config.EnableSpellCheck = checkSpellCheck.Checked;
PromptRestart(); PromptRestart();
} }
private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){ private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.ShowScreenshotBorder = checkScreenshotBorder.Checked; Config.ShowScreenshotBorder = checkScreenshotBorder.Checked;
} }
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){ private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
if (!Ready)return;
Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex; Config.TrayBehavior = (TrayIcon.Behavior)comboBoxTrayType.SelectedIndex;
} }
private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){ private void checkTrayHighlight_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.EnableTrayHighlight = checkTrayHighlight.Checked; Config.EnableTrayHighlight = checkTrayHighlight.Checked;
} }
private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){ private void checkUpdateNotifications_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.EnableUpdateCheck = checkUpdateNotifications.Checked; Config.EnableUpdateCheck = checkUpdateNotifications.Checked;
} }
private void btnCheckUpdates_Click(object sender, EventArgs e){ private void btnCheckUpdates_Click(object sender, EventArgs e){
if (!Ready)return;
updateCheckEventId = updates.Check(true); updateCheckEventId = updates.Check(true);
if (updateCheckEventId == -1){ if (updateCheckEventId == -1){

View File

@ -110,7 +110,6 @@ private void InitializeComponent() {
this.comboBoxDisplay.Name = "comboBoxDisplay"; this.comboBoxDisplay.Name = "comboBoxDisplay";
this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21); this.comboBoxDisplay.Size = new System.Drawing.Size(171, 21);
this.comboBoxDisplay.TabIndex = 7; this.comboBoxDisplay.TabIndex = 7;
this.comboBoxDisplay.SelectedValueChanged += new System.EventHandler(this.comboBoxDisplay_SelectedValueChanged);
// //
// labelEdgeDistance // labelEdgeDistance
// //
@ -133,7 +132,6 @@ private void InitializeComponent() {
this.radioLocCustom.Text = "Custom"; this.radioLocCustom.Text = "Custom";
this.toolTip.SetToolTip(this.radioLocCustom, "Drag the notification window to the desired location."); this.toolTip.SetToolTip(this.radioLocCustom, "Drag the notification window to the desired location.");
this.radioLocCustom.UseVisualStyleBackColor = true; this.radioLocCustom.UseVisualStyleBackColor = true;
this.radioLocCustom.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
// //
// radioLocBR // radioLocBR
// //
@ -145,7 +143,6 @@ private void InitializeComponent() {
this.radioLocBR.TabStop = true; this.radioLocBR.TabStop = true;
this.radioLocBR.Text = "Bottom Right"; this.radioLocBR.Text = "Bottom Right";
this.radioLocBR.UseVisualStyleBackColor = true; this.radioLocBR.UseVisualStyleBackColor = true;
this.radioLocBR.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
// //
// radioLocBL // radioLocBL
// //
@ -157,7 +154,6 @@ private void InitializeComponent() {
this.radioLocBL.TabStop = true; this.radioLocBL.TabStop = true;
this.radioLocBL.Text = "Bottom Left"; this.radioLocBL.Text = "Bottom Left";
this.radioLocBL.UseVisualStyleBackColor = true; this.radioLocBL.UseVisualStyleBackColor = true;
this.radioLocBL.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
// //
// radioLocTR // radioLocTR
// //
@ -169,7 +165,6 @@ private void InitializeComponent() {
this.radioLocTR.TabStop = true; this.radioLocTR.TabStop = true;
this.radioLocTR.Text = "Top Right"; this.radioLocTR.Text = "Top Right";
this.radioLocTR.UseVisualStyleBackColor = true; this.radioLocTR.UseVisualStyleBackColor = true;
this.radioLocTR.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
// //
// radioLocTL // radioLocTL
// //
@ -181,7 +176,6 @@ private void InitializeComponent() {
this.radioLocTL.TabStop = true; this.radioLocTL.TabStop = true;
this.radioLocTL.Text = "Top Left"; this.radioLocTL.Text = "Top Left";
this.radioLocTL.UseVisualStyleBackColor = true; this.radioLocTL.UseVisualStyleBackColor = true;
this.radioLocTL.CheckedChanged += new System.EventHandler(this.radioLoc_CheckedChanged);
// //
// trackBarEdgeDistance // trackBarEdgeDistance
// //
@ -197,7 +191,6 @@ private void InitializeComponent() {
this.trackBarEdgeDistance.TabIndex = 5; this.trackBarEdgeDistance.TabIndex = 5;
this.trackBarEdgeDistance.TickFrequency = 4; this.trackBarEdgeDistance.TickFrequency = 4;
this.trackBarEdgeDistance.Value = 8; this.trackBarEdgeDistance.Value = 8;
this.trackBarEdgeDistance.ValueChanged += new System.EventHandler(this.trackBarEdgeDistance_ValueChanged);
// //
// groupNotificationDuration // groupNotificationDuration
// //
@ -243,7 +236,6 @@ private void InitializeComponent() {
this.btnDurationMedium.TabIndex = 2; this.btnDurationMedium.TabIndex = 2;
this.btnDurationMedium.Text = "Medium"; this.btnDurationMedium.Text = "Medium";
this.btnDurationMedium.UseVisualStyleBackColor = true; this.btnDurationMedium.UseVisualStyleBackColor = true;
this.btnDurationMedium.Click += new System.EventHandler(this.btnDurationMedium_Click);
// //
// btnDurationLong // btnDurationLong
// //
@ -259,7 +251,6 @@ private void InitializeComponent() {
this.btnDurationLong.TabIndex = 1; this.btnDurationLong.TabIndex = 1;
this.btnDurationLong.Text = "Long"; this.btnDurationLong.Text = "Long";
this.btnDurationLong.UseVisualStyleBackColor = true; this.btnDurationLong.UseVisualStyleBackColor = true;
this.btnDurationLong.Click += new System.EventHandler(this.btnDurationLong_Click);
// //
// btnDurationShort // btnDurationShort
// //
@ -275,7 +266,6 @@ private void InitializeComponent() {
this.btnDurationShort.TabIndex = 0; this.btnDurationShort.TabIndex = 0;
this.btnDurationShort.Text = "Short"; this.btnDurationShort.Text = "Short";
this.btnDurationShort.UseVisualStyleBackColor = true; this.btnDurationShort.UseVisualStyleBackColor = true;
this.btnDurationShort.Click += new System.EventHandler(this.btnDurationShort_Click);
// //
// labelDurationValue // labelDurationValue
// //
@ -302,7 +292,6 @@ private void InitializeComponent() {
this.trackBarDuration.TabIndex = 12; this.trackBarDuration.TabIndex = 12;
this.trackBarDuration.TickFrequency = 5; this.trackBarDuration.TickFrequency = 5;
this.trackBarDuration.Value = 25; this.trackBarDuration.Value = 25;
this.trackBarDuration.ValueChanged += new System.EventHandler(this.trackBarDuration_ValueChanged);
// //
// groupUserInterface // groupUserInterface
// //
@ -327,7 +316,6 @@ private void InitializeComponent() {
this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " + this.toolTip.SetToolTip(this.checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be " +
"delayed until the cursor moves away to prevent accidental clicks."); "delayed until the cursor moves away to prevent accidental clicks.");
this.checkNonIntrusive.UseVisualStyleBackColor = true; this.checkNonIntrusive.UseVisualStyleBackColor = true;
this.checkNonIntrusive.CheckedChanged += new System.EventHandler(this.checkNonIntrusive_CheckedChanged);
// //
// checkTimerCountDown // checkTimerCountDown
// //
@ -339,7 +327,6 @@ private void InitializeComponent() {
this.checkTimerCountDown.Text = "Timer Counts Down"; this.checkTimerCountDown.Text = "Timer Counts Down";
this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up."); this.toolTip.SetToolTip(this.checkTimerCountDown, "The notification timer counts down instead of up.");
this.checkTimerCountDown.UseVisualStyleBackColor = true; this.checkTimerCountDown.UseVisualStyleBackColor = true;
this.checkTimerCountDown.CheckedChanged += new System.EventHandler(this.checkTimerCountDown_CheckedChanged);
// //
// checkNotificationTimer // checkNotificationTimer
// //
@ -352,7 +339,6 @@ private void InitializeComponent() {
this.checkNotificationTimer.Text = "Display Notification Timer"; this.checkNotificationTimer.Text = "Display Notification Timer";
this.toolTip.SetToolTip(this.checkNotificationTimer, "Shows how much time is left before the current notification disappears."); this.toolTip.SetToolTip(this.checkNotificationTimer, "Shows how much time is left before the current notification disappears.");
this.checkNotificationTimer.UseVisualStyleBackColor = true; this.checkNotificationTimer.UseVisualStyleBackColor = true;
this.checkNotificationTimer.CheckedChanged += new System.EventHandler(this.checkNotificationTimer_CheckedChanged);
// //
// groupCustomSound // groupCustomSound
// //
@ -376,7 +362,6 @@ private void InitializeComponent() {
this.btnResetSound.TabIndex = 2; this.btnResetSound.TabIndex = 2;
this.btnResetSound.Text = "Reset"; this.btnResetSound.Text = "Reset";
this.btnResetSound.UseVisualStyleBackColor = true; this.btnResetSound.UseVisualStyleBackColor = true;
this.btnResetSound.Click += new System.EventHandler(this.btnResetSound_Click);
// //
// btnBrowseSound // btnBrowseSound
// //
@ -388,7 +373,6 @@ private void InitializeComponent() {
this.btnBrowseSound.TabIndex = 1; this.btnBrowseSound.TabIndex = 1;
this.btnBrowseSound.Text = "Browse..."; this.btnBrowseSound.Text = "Browse...";
this.btnBrowseSound.UseVisualStyleBackColor = true; this.btnBrowseSound.UseVisualStyleBackColor = true;
this.btnBrowseSound.Click += new System.EventHandler(this.btnBrowseSound_Click);
// //
// tbCustomSound // tbCustomSound
// //
@ -396,7 +380,6 @@ private void InitializeComponent() {
this.tbCustomSound.Name = "tbCustomSound"; this.tbCustomSound.Name = "tbCustomSound";
this.tbCustomSound.Size = new System.Drawing.Size(170, 20); this.tbCustomSound.Size = new System.Drawing.Size(170, 20);
this.tbCustomSound.TabIndex = 0; this.tbCustomSound.TabIndex = 0;
this.tbCustomSound.TextChanged += new System.EventHandler(this.tbCustomSound_TextChanged);
// //
// TabSettingsNotifications // TabSettingsNotifications
// //

View File

@ -65,6 +65,30 @@ public TabSettingsNotifications(FormNotificationMain notification, bool ignoreAu
Disposed += (sender, args) => this.notification.Dispose(); Disposed += (sender, args) => this.notification.Dispose();
} }
public override void OnReady(){
radioLocTL.CheckedChanged += radioLoc_CheckedChanged;
radioLocTR.CheckedChanged += radioLoc_CheckedChanged;
radioLocBL.CheckedChanged += radioLoc_CheckedChanged;
radioLocBR.CheckedChanged += radioLoc_CheckedChanged;
radioLocCustom.CheckedChanged += radioLoc_CheckedChanged;
trackBarDuration.ValueChanged += trackBarDuration_ValueChanged;
btnDurationShort.Click += btnDurationShort_Click;
btnDurationMedium.Click += btnDurationMedium_Click;
btnDurationLong.Click += btnDurationLong_Click;
checkNotificationTimer.CheckedChanged += checkNotificationTimer_CheckedChanged;
checkTimerCountDown.CheckedChanged += checkTimerCountDown_CheckedChanged;
checkNonIntrusive.CheckedChanged += checkNonIntrusive_CheckedChanged;
comboBoxDisplay.SelectedValueChanged += comboBoxDisplay_SelectedValueChanged;
trackBarEdgeDistance.ValueChanged += trackBarEdgeDistance_ValueChanged;
tbCustomSound.TextChanged += tbCustomSound_TextChanged;
btnBrowseSound.Click += btnBrowseSound_Click;
btnResetSound.Click += btnResetSound_Click;
}
public override void OnClosing(){ public override void OnClosing(){
Config.NotificationSoundPath = tbCustomSound.Text; Config.NotificationSoundPath = tbCustomSound.Text;
} }
@ -94,8 +118,6 @@ private void notification_Activated(object sender, EventArgs e){
} }
private void radioLoc_CheckedChanged(object sender, EventArgs e){ private void radioLoc_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft; if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight; else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft; else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
@ -113,8 +135,6 @@ private void radioLoc_CheckedChanged(object sender, EventArgs e){
} }
private void trackBarDuration_ValueChanged(object sender, EventArgs e){ private void trackBarDuration_ValueChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationDurationValue = trackBarDuration.Value; Config.NotificationDurationValue = trackBarDuration.Value;
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c"; labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
@ -122,54 +142,38 @@ private void trackBarDuration_ValueChanged(object sender, EventArgs e){
} }
private void btnDurationShort_Click(object sender, EventArgs e){ private void btnDurationShort_Click(object sender, EventArgs e){
if (!Ready)return;
trackBarDuration.Value = 15; trackBarDuration.Value = 15;
} }
private void btnDurationMedium_Click(object sender, EventArgs e){ private void btnDurationMedium_Click(object sender, EventArgs e){
if (!Ready)return;
trackBarDuration.Value = 25; trackBarDuration.Value = 25;
} }
private void btnDurationLong_Click(object sender, EventArgs e){ private void btnDurationLong_Click(object sender, EventArgs e){
if (!Ready)return;
trackBarDuration.Value = 35; trackBarDuration.Value = 35;
} }
private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){ private void checkNotificationTimer_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.DisplayNotificationTimer = checkNotificationTimer.Checked; Config.DisplayNotificationTimer = checkNotificationTimer.Checked;
checkTimerCountDown.Enabled = checkNotificationTimer.Checked; checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
notification.ShowNotificationForSettings(true); notification.ShowNotificationForSettings(true);
} }
private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){ private void checkTimerCountDown_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationTimerCountDown = checkTimerCountDown.Checked; Config.NotificationTimerCountDown = checkTimerCountDown.Checked;
notification.ShowNotificationForSettings(true); notification.ShowNotificationForSettings(true);
} }
private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){ private void checkNonIntrusive_CheckedChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked; Config.NotificationNonIntrusiveMode = checkNonIntrusive.Checked;
} }
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){ private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
if (!Ready)return;
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex; Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);
} }
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){ private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
if (!Ready)return;
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px"; labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value; Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);