Skip to content

Commit a8c22db

Browse files
author
Antoine Aflalo
committed
Refactoring of Tooltip device to use property
See #88
1 parent 8ac21a7 commit a8c22db

File tree

7 files changed

+17
-39
lines changed

7 files changed

+17
-39
lines changed

SoundSwitch/Framework/TooltipInfoManager/TooltipInfoManager.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public TooltipInfoManager(NotifyIcon icon)
1919
_icon.BalloonTipShown += IconOnBalloonTipShown;
2020
_icon.BalloonTipClosed += IconOnBalloonTipClosed;
2121
}
22-
22+
/// <summary>
23+
/// Currently active tooltip info
24+
/// </summary>
2325
public static TooltipInfoTypeEnum CurrentTooltipInfo
2426
{
2527
get { return AppConfigs.Configuration.TooltipInfo; }

SoundSwitch/Framework/TooltipInfoManager/TootipInfo/ITooltipInfo.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ namespace SoundSwitch.Framework.TooltipInfoManager.TootipInfo
44
{
55
public interface ITooltipInfo
66
{
7+
78
/// <summary>
8-
/// The text to display for this tooltip
9+
/// Type of the Tooltip Info
910
/// </summary>
10-
/// <returns></returns>
11-
string TextToDisplay();
12-
11+
TooltipInfoTypeEnum TypeEnum { get; }
1312
/// <summary>
14-
/// Type of the Tooltip info
13+
/// The text to display for this tooltip
1514
/// </summary>
1615
/// <returns></returns>
17-
TooltipInfoTypeEnum Type();
16+
string TextToDisplay();
1817
}
1918
}

SoundSwitch/Framework/TooltipInfoManager/TootipInfo/TooltipInfoBoth.cs

+2-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ namespace SoundSwitch.Framework.TooltipInfoManager.TootipInfo
44
{
55
public class TooltipInfoBoth : ITooltipInfo
66
{
7+
public TooltipInfoTypeEnum TypeEnum { get; } = TooltipInfoTypeEnum.Both;
8+
79
/// <summary>
810
/// The text to display for this tooltip
911
/// </summary>
@@ -20,15 +22,6 @@ public string TextToDisplay()
2022
recordingToDisplay);
2123
}
2224

23-
/// <summary>
24-
/// Type of the Tooltip info
25-
/// </summary>
26-
/// <returns></returns>
27-
public TooltipInfoTypeEnum Type()
28-
{
29-
return TooltipInfoTypeEnum.Both;
30-
}
31-
3225
public override string ToString()
3326
{
3427
return TooltipInfo.both;

SoundSwitch/Framework/TooltipInfoManager/TootipInfo/TooltipInfoNone.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ namespace SoundSwitch.Framework.TooltipInfoManager.TootipInfo
44
{
55
public class TooltipInfoNone : ITooltipInfo
66
{
7+
public TooltipInfoTypeEnum TypeEnum { get; } = TooltipInfoTypeEnum.None;
8+
79
public string TextToDisplay()
810
{
911
return null;
1012
}
1113

12-
public TooltipInfoTypeEnum Type()
13-
{
14-
return TooltipInfoTypeEnum.None;
15-
}
1614

1715
public override string ToString()
1816
{

SoundSwitch/Framework/TooltipInfoManager/TootipInfo/TooltipInfoPlayback.cs

+2-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace SoundSwitch.Framework.TooltipInfoManager.TootipInfo
77
{
88
public class TooltipInfoPlayback : ITooltipInfo
99
{
10+
public TooltipInfoTypeEnum TypeEnum { get; } = TooltipInfoTypeEnum.Playback;
11+
1012
/// <summary>
1113
/// The text to display for this tooltip
1214
/// </summary>
@@ -19,15 +21,6 @@ public string TextToDisplay()
1921
return playbackDefaultDevice == null ? null : string.Format(TooltipInfo.currentlyActive, playbackDefaultDevice);
2022
}
2123

22-
/// <summary>
23-
/// Type of the Tooltip info
24-
/// </summary>
25-
/// <returns></returns>
26-
public TooltipInfoTypeEnum Type()
27-
{
28-
return TooltipInfoTypeEnum.Playback;
29-
}
30-
3124
public override string ToString()
3225
{
3326
return TooltipInfo.playback;

SoundSwitch/Framework/TooltipInfoManager/TootipInfo/TooltipInfoRecording.cs

+2-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace SoundSwitch.Framework.TooltipInfoManager.TootipInfo
77
{
88
public class TooltipInfoRecording : ITooltipInfo
99
{
10+
public TooltipInfoTypeEnum TypeEnum { get; } =TooltipInfoTypeEnum.Recording;
11+
1012
/// <summary>
1113
/// The text to display for this tooltip
1214
/// </summary>
@@ -19,15 +21,6 @@ public string TextToDisplay()
1921
return recordingDevice == null ? null : string.Format(TooltipInfo.currentlyActive, recordingDevice);
2022
}
2123

22-
/// <summary>
23-
/// Type of the Tooltip info
24-
/// </summary>
25-
/// <returns></returns>
26-
public TooltipInfoTypeEnum Type()
27-
{
28-
return TooltipInfoTypeEnum.Recording;
29-
}
30-
3124
public override string ToString()
3225
{
3326
return TooltipInfo.recording;

SoundSwitch/UI/Forms/Settings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private void tooltipInfoComboBox_SelectedValueChanged(object sender, EventArgs e
224224
return;
225225

226226
var tooltip = (ITooltipInfo) value;
227-
TooltipInfoManager.CurrentTooltipInfo = tooltip.Type();
227+
TooltipInfoManager.CurrentTooltipInfo = tooltip.TypeEnum;
228228
}
229229

230230
private void selectSoundButton_Click(object sender, EventArgs e)

0 commit comments

Comments
 (0)