├── .gitignore
├── AutoBright.sln
├── AutoBright
├── App.config
├── AutoBright.vbproj
├── MonitorHelper.vb
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── Application1.Designer.vb
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Resources1.Designer.vb
│ ├── Settings.Designer.vb
│ ├── Settings.settings
│ └── app.manifest
├── Resources
│ ├── AutoBrightDimming.ico
│ ├── AutoBrightDimming.png
│ ├── AutoBrightDisabled.ico
│ ├── AutoBrightDisabled.png
│ ├── AutoBrightIdle.ico
│ └── AutoBrightIdle.png
├── frmAbout.Designer.vb
├── frmAbout.resx
├── frmAbout.vb
├── frmAdvanced.Designer.vb
├── frmAdvanced.resx
├── frmAdvanced.vb
├── frmFirstRun.Designer.vb
├── frmFirstRun.resx
├── frmFirstRun.vb
├── frmSettings.Designer.vb
├── frmSettings.resx
└── frmSettings.vb
├── Images
├── AutoBrightDimming.ico
├── AutoBrightDimming.png
├── AutoBrightDimming.psd
├── AutoBrightDisabled.ico
├── AutoBrightDisabled.png
├── AutoBrightDisabled.psd
├── AutoBrightIdle.ico
├── AutoBrightIdle.png
└── AutoBrightIdle.psd
├── LICENSE
├── README.md
└── reources.designer
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | # DNX
42 | project.lock.json
43 | artifacts/
44 |
45 | *_i.c
46 | *_p.c
47 | *_i.h
48 | *.ilk
49 | *.meta
50 | *.obj
51 | *.pch
52 | *.pdb
53 | *.pgc
54 | *.pgd
55 | *.rsp
56 | *.sbr
57 | *.tlb
58 | *.tli
59 | *.tlh
60 | *.tmp
61 | *.tmp_proj
62 | *.log
63 | *.vspscc
64 | *.vssscc
65 | .builds
66 | *.pidb
67 | *.svclog
68 | *.scc
69 |
70 | # Chutzpah Test files
71 | _Chutzpah*
72 |
73 | # Visual C++ cache files
74 | ipch/
75 | *.aps
76 | *.ncb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 |
110 | # MightyMoose
111 | *.mm.*
112 | AutoTest.Net/
113 |
114 | # Web workbench (sass)
115 | .sass-cache/
116 |
117 | # Installshield output folder
118 | [Ee]xpress/
119 |
120 | # DocProject is a documentation generator add-in
121 | DocProject/buildhelp/
122 | DocProject/Help/*.HxT
123 | DocProject/Help/*.HxC
124 | DocProject/Help/*.hhc
125 | DocProject/Help/*.hhk
126 | DocProject/Help/*.hhp
127 | DocProject/Help/Html2
128 | DocProject/Help/html
129 |
130 | # Click-Once directory
131 | publish/
132 |
133 | # Publish Web Output
134 | *.[Pp]ublish.xml
135 | *.azurePubxml
136 | ## TODO: Comment the next line if you want to checkin your
137 | ## web deploy settings but do note that will include unencrypted
138 | ## passwords
139 | #*.pubxml
140 |
141 | *.publishproj
142 |
143 | # NuGet Packages
144 | *.nupkg
145 | # The packages folder can be ignored because of Package Restore
146 | **/packages/*
147 | # except build/, which is used as an MSBuild target.
148 | !**/packages/build/
149 | # Uncomment if necessary however generally it will be regenerated when needed
150 | #!**/packages/repositories.config
151 |
152 | # Windows Azure Build Output
153 | csx/
154 | *.build.csdef
155 |
156 | # Windows Store app package directory
157 | AppPackages/
158 |
159 | # Visual Studio cache files
160 | # files ending in .cache can be ignored
161 | *.[Cc]ache
162 | # but keep track of directories ending in .cache
163 | !*.[Cc]ache/
164 |
165 | # Others
166 | ClientBin/
167 | [Ss]tyle[Cc]op.*
168 | ~$*
169 | *~
170 | *.dbmdl
171 | *.dbproj.schemaview
172 | *.pfx
173 | *.publishsettings
174 | node_modules/
175 | orleans.codegen.cs
176 |
177 | # RIA/Silverlight projects
178 | Generated_Code/
179 |
180 | # Backup & report files from converting an old project file
181 | # to a newer Visual Studio version. Backup files are not needed,
182 | # because we have git ;-)
183 | _UpgradeReport_Files/
184 | Backup*/
185 | UpgradeLog*.XML
186 | UpgradeLog*.htm
187 |
188 | # SQL Server files
189 | *.mdf
190 | *.ldf
191 |
192 | # Business Intelligence projects
193 | *.rdl.data
194 | *.bim.layout
195 | *.bim_*.settings
196 |
197 | # Microsoft Fakes
198 | FakesAssemblies/
199 |
200 | # Node.js Tools for Visual Studio
201 | .ntvs_analysis.dat
202 |
203 | # Visual Studio 6 build log
204 | *.plg
205 |
206 | # Visual Studio 6 workspace options file
207 | *.opt
208 |
209 | # LightSwitch generated files
210 | GeneratedArtifacts/
211 | _Pvt_Extensions/
212 | ModelManifest.xml
213 |
--------------------------------------------------------------------------------
/AutoBright.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AutoBright", "AutoBright\AutoBright.vbproj", "{3D5123EE-A0E0-47A5-A21A-27515C637C6E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {3D5123EE-A0E0-47A5-A21A-27515C637C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {3D5123EE-A0E0-47A5-A21A-27515C637C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {3D5123EE-A0E0-47A5-A21A-27515C637C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {3D5123EE-A0E0-47A5-A21A-27515C637C6E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/AutoBright/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 50
15 |
16 |
17 | 10
18 |
19 |
20 | 50
21 |
22 |
23 | 10
24 |
25 |
26 | 50
27 |
28 |
29 | 10
30 |
31 |
32 | 60
33 |
34 |
35 | 0
36 |
37 |
38 | 0
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | True
48 |
49 |
50 |
51 |
52 |
53 | 0
54 |
55 |
56 | False
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/AutoBright/AutoBright.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3D5123EE-A0E0-47A5-A21A-27515C637C6E}
8 | WinExe
9 | AutoBright.My.MyApplication
10 | AutoBright
11 | AutoBright
12 | 512
13 | WindowsForms
14 | v4.5.2
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | true
22 | true
23 | bin\Debug\
24 | AutoBright.xml
25 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | false
31 | true
32 | true
33 | bin\Release\
34 | AutoBright.xml
35 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
36 |
37 |
38 | On
39 |
40 |
41 | Binary
42 |
43 |
44 | Off
45 |
46 |
47 | On
48 |
49 |
50 | Resources\AutoBrightIdle.ico
51 |
52 |
53 | My Project\app.manifest
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | frmAbout.vb
84 |
85 |
86 | Form
87 |
88 |
89 | frmFirstRun.vb
90 |
91 |
92 | Form
93 |
94 |
95 | frmAdvanced.vb
96 |
97 |
98 | Form
99 |
100 |
101 |
102 | True
103 | Application.myapp
104 |
105 |
106 | Form
107 |
108 |
109 | frmSettings.vb
110 | Form
111 |
112 |
113 |
114 | True
115 | Application.myapp
116 |
117 |
118 | True
119 | True
120 | Resources.resx
121 |
122 |
123 | True
124 | True
125 | Resources.resx
126 |
127 |
128 | True
129 | Settings.settings
130 | True
131 |
132 |
133 |
134 |
135 | frmAbout.vb
136 |
137 |
138 | frmSettings.vb
139 |
140 |
141 | frmFirstRun.vb
142 |
143 |
144 | frmAdvanced.vb
145 |
146 |
147 | VbMyResourcesResXFileCodeGenerator
148 | My.Resources
149 | Designer
150 | Resources1.Designer.vb
151 |
152 |
153 |
154 |
155 |
156 | MyApplicationCodeGenerator
157 | Application1.Designer.vb
158 |
159 |
160 | SettingsSingleFileGenerator
161 | My
162 | Settings.Designer.vb
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
192 |
--------------------------------------------------------------------------------
/AutoBright/MonitorHelper.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.InteropServices
2 | Imports System.ComponentModel
3 | Public Class MonitorHelper
4 | Public Shared Function GetPhysicalMonitors() As PHYSICAL_MONITOR()
5 | Dim PhysicalMonitorList As New List(Of PHYSICAL_MONITOR)
6 | For Each Scrn As Screen In Screen.AllScreens
7 | Dim hMonitor As IntPtr = MonitorFromPoint(Scrn.Bounds.Location, MONITOR_DEFAULTTONEAREST)
8 | Dim NumberOfPhysicalMonitors As UInteger
9 | GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, NumberOfPhysicalMonitors)
10 | Dim PhysicalMonitors(CInt(NumberOfPhysicalMonitors) - 1) As PHYSICAL_MONITOR
11 | GetPhysicalMonitorsFromHMONITOR(hMonitor, NumberOfPhysicalMonitors, PhysicalMonitors)
12 | PhysicalMonitorList.AddRange(PhysicalMonitors)
13 | Next
14 | Return PhysicalMonitorList.ToArray
15 | End Function
16 |
17 | Public Shared Function DestroyAllPhysicalMonitors(ByVal PhysicalMonitors As PHYSICAL_MONITOR()) As Boolean
18 | Return DestroyPhysicalMonitors(CUInt(PhysicalMonitors.Length), PhysicalMonitors)
19 | End Function
20 |
21 | Private Shared Function GetPhysicalMonitorCapabilities(physicalMonitor As PHYSICAL_MONITOR) As UInteger
22 | Dim dwMonitorCapabilities As UInteger, dwSupportedColorTemperatures As UInteger
23 | GetMonitorCapabilities(physicalMonitor.hPhysicalMonitor, dwMonitorCapabilities, dwSupportedColorTemperatures)
24 | Return dwMonitorCapabilities
25 | End Function
26 |
27 | Public Shared Function GetBrightnessSupport(physicalMonitor As PHYSICAL_MONITOR) As Boolean
28 | Return (GetPhysicalMonitorCapabilities(physicalMonitor) And MC_CAPS_BRIGHTNESS) = MC_CAPS_BRIGHTNESS
29 | End Function
30 |
31 | Public Shared Function GetPhysicalMonitorBrightness(physicalMonitor As PHYSICAL_MONITOR) As Double
32 | Dim dwMinimumBrightness As UInteger, dwCurrentBrightness As UInteger, dwMaximumBrightness As UInteger
33 | GetMonitorBrightness(physicalMonitor.hPhysicalMonitor, dwMinimumBrightness, dwCurrentBrightness, dwMaximumBrightness)
34 | Return CDbl(dwCurrentBrightness - dwMinimumBrightness) / CDbl(dwMaximumBrightness - dwMinimumBrightness)
35 | End Function
36 |
37 | Public Shared Sub SetPhysicalMonitorBrightness(physicalMonitor As PHYSICAL_MONITOR, brightness As Double)
38 | Dim dwMinimumBrightness As UInteger, dwCurrentBrightness As UInteger, dwMaximumBrightness As UInteger
39 | If Not GetMonitorBrightness(physicalMonitor.hPhysicalMonitor, dwMinimumBrightness, dwCurrentBrightness, dwMaximumBrightness) Then
40 | Throw New Win32Exception(Marshal.GetLastWin32Error())
41 | End If
42 | If Not SetMonitorBrightness(physicalMonitor.hPhysicalMonitor, CUInt(dwMinimumBrightness + (dwMaximumBrightness - dwMinimumBrightness) * brightness)) Then
43 | Throw New Win32Exception(Marshal.GetLastWin32Error())
44 | End If
45 | End Sub
46 |
47 | #Region "Win32Apis"
48 | Private Const MONITOR_DEFAULTTONEAREST As Integer = &H2
49 | Private Const MC_CAPS_BRIGHTNESS As Integer = &H2
50 |
51 |
52 | Private Shared Function MonitorFromPoint(pt As Point, dwFlags As UInteger) As IntPtr
53 | End Function
54 |
55 |
56 | Private Shared Function GetPhysicalMonitorsFromHMONITOR(hMonitor As IntPtr, dwPhysicalMonitorArraySize As UInteger, pPhysicalMonitorArray As PHYSICAL_MONITOR()) As Boolean
57 | End Function
58 |
59 |
60 | Private Shared Function GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor As IntPtr, ByRef pdwNumberOfPhysicalMonitors As UInteger) As Boolean
61 | End Function
62 |
63 |
64 | Private Shared Function DestroyPhysicalMonitors(dwPhysicalMonitorArraySize As UInteger, pPhysicalMonitorArray As PHYSICAL_MONITOR()) As Boolean
65 | End Function
66 |
67 |
68 | Public Structure PHYSICAL_MONITOR
69 | Public hPhysicalMonitor As IntPtr
70 | Public szPhysicalMonitorDescription As String
71 | End Structure
72 |
73 |
74 | Private Shared Function GetMonitorCapabilities(hMonitor As IntPtr, ByRef pdwMonitorCapabilities As UInteger, ByRef pdwSupportedColorTemperatures As UInteger) As Boolean
75 | End Function
76 |
77 |
78 | Private Shared Function GetMonitorBrightness(hMonitor As IntPtr, ByRef pdwMinimumBrightness As UInteger, ByRef pdwCurrentBrightness As UInteger, ByRef pdwMaximumBrightness As UInteger) As Boolean
79 | End Function
80 |
81 |
82 | Private Shared Function SetMonitorBrightness(hMonitor As IntPtr, dwNewBrightness As UInteger) As Boolean
83 | End Function
84 | #End Region
85 |
86 | End Class 'Don't even try to understand this if I were you - handles anything to do with getting or setting brightness. This is BrightnessControl © 2015 Alexander Horn.
--------------------------------------------------------------------------------
/AutoBright/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | ''------------------------------------------------------------------------------
2 | ''
3 | '' This code was generated by a tool.
4 | '' Runtime Version:4.0.30319.42000
5 | ''
6 | '' Changes to this file may cause incorrect behavior and will be lost if
7 | '' the code is regenerated.
8 | ''
9 | ''------------------------------------------------------------------------------
10 |
11 | 'Option Strict On
12 | 'Option Explicit On
13 |
14 |
15 | 'Namespace My
16 |
17 | ' 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' ' or if you encounter build errors in this file, go to the Project Designer
19 | ' ' (go to Project Properties or double-click the My Project node in
20 | ' ' Solution Explorer), and make changes on the Application tab.
21 | ' '
22 | ' Partial Friend Class MyApplication
23 |
24 | ' _
25 | ' Public Sub New()
26 | ' MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | ' Me.IsSingleInstance = false
28 | ' Me.EnableVisualStyles = true
29 | ' Me.SaveMySettingsOnExit = true
30 | ' Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | ' End Sub
32 |
33 | ' _
34 | ' Protected Overrides Sub OnCreateMainForm()
35 | ' Me.MainForm = Global.AutoBright.Settings
36 | ' End Sub
37 |
38 | ' _
39 | ' Protected Overrides Sub OnCreateSplashScreen()
40 | ' Me.SplashScreen = Global.AutoBright.Settings
41 | ' End Sub
42 | ' End Class
43 | 'End Namespace
44 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | appSettings
5 | true
6 | 0
7 | true
8 | 0
9 | false
10 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Application1.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = true
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = false
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.AutoBright.frmSettings
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/AutoBright/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\AutoBrightDimming.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
125 | ..\Resources\AutoBrightDimming.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
126 |
127 |
128 | ..\Resources\AutoBrightDisabled.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
131 | ..\Resources\AutoBrightDisabled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
132 |
133 |
134 | ..\Resources\AutoBrightIdle.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
135 |
136 |
137 | ..\Resources\AutoBrightIdle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
138 |
139 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Resources1.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("AutoBright.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 |
63 | '''
64 | ''' Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
65 | '''
66 | Friend ReadOnly Property AutoBrightDimming() As System.Drawing.Icon
67 | Get
68 | Dim obj As Object = ResourceManager.GetObject("AutoBrightDimming", resourceCulture)
69 | Return CType(obj,System.Drawing.Icon)
70 | End Get
71 | End Property
72 |
73 | '''
74 | ''' Looks up a localized resource of type System.Drawing.Bitmap.
75 | '''
76 | Friend ReadOnly Property AutoBrightDimming1() As System.Drawing.Bitmap
77 | Get
78 | Dim obj As Object = ResourceManager.GetObject("AutoBrightDimming1", resourceCulture)
79 | Return CType(obj,System.Drawing.Bitmap)
80 | End Get
81 | End Property
82 |
83 | '''
84 | ''' Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
85 | '''
86 | Friend ReadOnly Property AutoBrightDisabled() As System.Drawing.Icon
87 | Get
88 | Dim obj As Object = ResourceManager.GetObject("AutoBrightDisabled", resourceCulture)
89 | Return CType(obj,System.Drawing.Icon)
90 | End Get
91 | End Property
92 |
93 | '''
94 | ''' Looks up a localized resource of type System.Drawing.Bitmap.
95 | '''
96 | Friend ReadOnly Property AutoBrightDisabled1() As System.Drawing.Bitmap
97 | Get
98 | Dim obj As Object = ResourceManager.GetObject("AutoBrightDisabled1", resourceCulture)
99 | Return CType(obj,System.Drawing.Bitmap)
100 | End Get
101 | End Property
102 |
103 | '''
104 | ''' Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
105 | '''
106 | Friend ReadOnly Property AutoBrightIdle() As System.Drawing.Icon
107 | Get
108 | Dim obj As Object = ResourceManager.GetObject("AutoBrightIdle", resourceCulture)
109 | Return CType(obj,System.Drawing.Icon)
110 | End Get
111 | End Property
112 |
113 | '''
114 | ''' Looks up a localized resource of type System.Drawing.Bitmap.
115 | '''
116 | Friend ReadOnly Property AutoBrightIdle1() As System.Drawing.Bitmap
117 | Get
118 | Dim obj As Object = ResourceManager.GetObject("AutoBrightIdle1", resourceCulture)
119 | Return CType(obj,System.Drawing.Bitmap)
120 | End Get
121 | End Property
122 | End Module
123 | End Namespace
124 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 |
57 | _
60 | Public Property Screen1Normal() As Integer
61 | Get
62 | Return CType(Me("Screen1Normal"),Integer)
63 | End Get
64 | Set
65 | Me("Screen1Normal") = value
66 | End Set
67 | End Property
68 |
69 | _
72 | Public Property Screen1Dimmed() As Integer
73 | Get
74 | Return CType(Me("Screen1Dimmed"),Integer)
75 | End Get
76 | Set
77 | Me("Screen1Dimmed") = value
78 | End Set
79 | End Property
80 |
81 | _
84 | Public Property Screen2Normal() As Integer
85 | Get
86 | Return CType(Me("Screen2Normal"),Integer)
87 | End Get
88 | Set
89 | Me("Screen2Normal") = value
90 | End Set
91 | End Property
92 |
93 | _
96 | Public Property Screen2Dimmed() As Integer
97 | Get
98 | Return CType(Me("Screen2Dimmed"),Integer)
99 | End Get
100 | Set
101 | Me("Screen2Dimmed") = value
102 | End Set
103 | End Property
104 |
105 | _
108 | Public Property Screen3Normal() As Integer
109 | Get
110 | Return CType(Me("Screen3Normal"),Integer)
111 | End Get
112 | Set
113 | Me("Screen3Normal") = value
114 | End Set
115 | End Property
116 |
117 | _
120 | Public Property Screen3Dimmed() As Integer
121 | Get
122 | Return CType(Me("Screen3Dimmed"),Integer)
123 | End Get
124 | Set
125 | Me("Screen3Dimmed") = value
126 | End Set
127 | End Property
128 |
129 | _
132 | Public Property TransitionTime() As Integer
133 | Get
134 | Return CType(Me("TransitionTime"),Integer)
135 | End Get
136 | Set
137 | Me("TransitionTime") = value
138 | End Set
139 | End Property
140 |
141 | _
144 | Public Property LocationLatitude() As Double
145 | Get
146 | Return CType(Me("LocationLatitude"),Double)
147 | End Get
148 | Set
149 | Me("LocationLatitude") = value
150 | End Set
151 | End Property
152 |
153 | _
156 | Public Property LocationLongitude() As Double
157 | Get
158 | Return CType(Me("LocationLongitude"),Double)
159 | End Get
160 | Set
161 | Me("LocationLongitude") = value
162 | End Set
163 | End Property
164 |
165 | _
167 | Public Property CivilTwilightEndToday() As Date
168 | Get
169 | Return CType(Me("CivilTwilightEndToday"),Date)
170 | End Get
171 | Set
172 | Me("CivilTwilightEndToday") = value
173 | End Set
174 | End Property
175 |
176 | _
178 | Public Property CivilTwilightStartToday() As Date
179 | Get
180 | Return CType(Me("CivilTwilightStartToday"),Date)
181 | End Get
182 | Set
183 | Me("CivilTwilightStartToday") = value
184 | End Set
185 | End Property
186 |
187 | _
190 | Public Property FirstRun() As Boolean
191 | Get
192 | Return CType(Me("FirstRun"),Boolean)
193 | End Get
194 | Set
195 | Me("FirstRun") = value
196 | End Set
197 | End Property
198 |
199 | _
201 | Public Property CivilTwilightEndTomorrow() As Date
202 | Get
203 | Return CType(Me("CivilTwilightEndTomorrow"),Date)
204 | End Get
205 | Set
206 | Me("CivilTwilightEndTomorrow") = value
207 | End Set
208 | End Property
209 |
210 | _
213 | Public Property Offset() As Integer
214 | Get
215 | Return CType(Me("Offset"),Integer)
216 | End Get
217 | Set
218 | Me("Offset") = value
219 | End Set
220 | End Property
221 |
222 | _
225 | Public Property EnableExternalProgram() As Boolean
226 | Get
227 | Return CType(Me("EnableExternalProgram"),Boolean)
228 | End Get
229 | Set
230 | Me("EnableExternalProgram") = value
231 | End Set
232 | End Property
233 |
234 | _
237 | Public Property ExternalProgramPath() As String
238 | Get
239 | Return CType(Me("ExternalProgramPath"),String)
240 | End Get
241 | Set
242 | Me("ExternalProgramPath") = value
243 | End Set
244 | End Property
245 |
246 | _
249 | Public Property ExternalProgramArguments() As String
250 | Get
251 | Return CType(Me("ExternalProgramArguments"),String)
252 | End Get
253 | Set
254 | Me("ExternalProgramArguments") = value
255 | End Set
256 | End Property
257 | End Class
258 | End Namespace
259 |
260 | Namespace My
261 |
262 | _
265 | Friend Module MySettingsProperty
266 |
267 | _
268 | Friend ReadOnly Property Settings() As Global.AutoBright.My.MySettings
269 | Get
270 | Return Global.AutoBright.My.MySettings.Default
271 | End Get
272 | End Property
273 | End Module
274 | End Namespace
275 |
--------------------------------------------------------------------------------
/AutoBright/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 50
7 |
8 |
9 | 10
10 |
11 |
12 | 50
13 |
14 |
15 | 10
16 |
17 |
18 | 50
19 |
20 |
21 | 10
22 |
23 |
24 | 60
25 |
26 |
27 | 0
28 |
29 |
30 | 0
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | True
40 |
41 |
42 |
43 |
44 |
45 | 0
46 |
47 |
48 | False
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/AutoBright/My Project/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
59 |
60 |
61 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/AutoBright/Resources/AutoBrightDimming.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/AutoBright/Resources/AutoBrightDimming.ico
--------------------------------------------------------------------------------
/AutoBright/Resources/AutoBrightDimming.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/AutoBright/Resources/AutoBrightDimming.png
--------------------------------------------------------------------------------
/AutoBright/Resources/AutoBrightDisabled.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/AutoBright/Resources/AutoBrightDisabled.ico
--------------------------------------------------------------------------------
/AutoBright/Resources/AutoBrightDisabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/AutoBright/Resources/AutoBrightDisabled.png
--------------------------------------------------------------------------------
/AutoBright/Resources/AutoBrightIdle.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/AutoBright/Resources/AutoBrightIdle.ico
--------------------------------------------------------------------------------
/AutoBright/Resources/AutoBrightIdle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/AutoBright/Resources/AutoBrightIdle.png
--------------------------------------------------------------------------------
/AutoBright/frmAbout.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class frmAbout
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmAbout))
26 | Me.pBoxLogo = New System.Windows.Forms.PictureBox()
27 | Me.lblChangelog = New System.Windows.Forms.Label()
28 | Me.lblVer = New System.Windows.Forms.Label()
29 | Me.lblTitle = New System.Windows.Forms.Label()
30 | Me.lblSunsetSunrise = New System.Windows.Forms.Label()
31 | Me.lnkLblLocation = New System.Windows.Forms.LinkLabel()
32 | Me.lblBrightnessControl = New System.Windows.Forms.Label()
33 | Me.lnkLblLicense = New System.Windows.Forms.LinkLabel()
34 | CType(Me.pBoxLogo, System.ComponentModel.ISupportInitialize).BeginInit()
35 | Me.SuspendLayout()
36 | '
37 | 'pBoxLogo
38 | '
39 | Me.pBoxLogo.Cursor = System.Windows.Forms.Cursors.Default
40 | Me.pBoxLogo.Image = Global.AutoBright.My.Resources.Resources.AutoBrightIdle1
41 | Me.pBoxLogo.Location = New System.Drawing.Point(262, 11)
42 | Me.pBoxLogo.Name = "pBoxLogo"
43 | Me.pBoxLogo.Size = New System.Drawing.Size(110, 110)
44 | Me.pBoxLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
45 | Me.pBoxLogo.TabIndex = 29
46 | Me.pBoxLogo.TabStop = False
47 | '
48 | 'lblChangelog
49 | '
50 | Me.lblChangelog.AutoSize = True
51 | Me.lblChangelog.Location = New System.Drawing.Point(12, 56)
52 | Me.lblChangelog.MaximumSize = New System.Drawing.Size(250, 0)
53 | Me.lblChangelog.Name = "lblChangelog"
54 | Me.lblChangelog.Size = New System.Drawing.Size(246, 39)
55 | Me.lblChangelog.TabIndex = 28
56 | Me.lblChangelog.Text = "Changelog:" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Fixed reusing of previous times when time fetching fails"
57 | '
58 | 'lblVer
59 | '
60 | Me.lblVer.AutoSize = True
61 | Me.lblVer.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
62 | Me.lblVer.Location = New System.Drawing.Point(12, 34)
63 | Me.lblVer.Name = "lblVer"
64 | Me.lblVer.Size = New System.Drawing.Size(69, 13)
65 | Me.lblVer.TabIndex = 27
66 | Me.lblVer.Text = "Version 2.3.2"
67 | Me.lblVer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
68 | '
69 | 'lblTitle
70 | '
71 | Me.lblTitle.AutoSize = True
72 | Me.lblTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
73 | Me.lblTitle.Location = New System.Drawing.Point(12, 11)
74 | Me.lblTitle.Name = "lblTitle"
75 | Me.lblTitle.Size = New System.Drawing.Size(174, 13)
76 | Me.lblTitle.TabIndex = 26
77 | Me.lblTitle.Text = "AutoBright © James Tattersall 2017"
78 | Me.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
79 | '
80 | 'lblSunsetSunrise
81 | '
82 | Me.lblSunsetSunrise.AutoSize = True
83 | Me.lblSunsetSunrise.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
84 | Me.lblSunsetSunrise.Location = New System.Drawing.Point(12, 177)
85 | Me.lblSunsetSunrise.Name = "lblSunsetSunrise"
86 | Me.lblSunsetSunrise.Size = New System.Drawing.Size(317, 26)
87 | Me.lblSunsetSunrise.TabIndex = 30
88 | Me.lblSunsetSunrise.Text = "Uses sunrise-sunset.org's free API. Many thanks for providing this." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Visit their " &
89 | "website at"
90 | Me.lblSunsetSunrise.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
91 | '
92 | 'lnkLblLocation
93 | '
94 | Me.lnkLblLocation.AutoSize = True
95 | Me.lnkLblLocation.Location = New System.Drawing.Point(108, 190)
96 | Me.lnkLblLocation.Name = "lnkLblLocation"
97 | Me.lnkLblLocation.Size = New System.Drawing.Size(128, 13)
98 | Me.lnkLblLocation.TabIndex = 31
99 | Me.lnkLblLocation.TabStop = True
100 | Me.lnkLblLocation.Text = "http://sunrise-sunset.org/"
101 | '
102 | 'lblBrightnessControl
103 | '
104 | Me.lblBrightnessControl.AutoSize = True
105 | Me.lblBrightnessControl.Location = New System.Drawing.Point(12, 142)
106 | Me.lblBrightnessControl.Name = "lblBrightnessControl"
107 | Me.lblBrightnessControl.Size = New System.Drawing.Size(328, 26)
108 | Me.lblBrightnessControl.TabIndex = 32
109 | Me.lblBrightnessControl.Text = "Uses BrightnessControl © 2015 Alexander Horn. View License terms" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Kindly modified" &
110 | " by IronRazer of the DreamInCode forums."
111 | '
112 | 'lnkLblLicense
113 | '
114 | Me.lnkLblLicense.AutoSize = True
115 | Me.lnkLblLicense.Location = New System.Drawing.Point(336, 142)
116 | Me.lnkLblLicense.Name = "lnkLblLicense"
117 | Me.lnkLblLicense.Size = New System.Drawing.Size(28, 13)
118 | Me.lnkLblLicense.TabIndex = 33
119 | Me.lnkLblLicense.TabStop = True
120 | Me.lnkLblLicense.Text = "here"
121 | '
122 | 'frmAbout
123 | '
124 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
125 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
126 | Me.ClientSize = New System.Drawing.Size(384, 212)
127 | Me.Controls.Add(Me.lnkLblLicense)
128 | Me.Controls.Add(Me.lblBrightnessControl)
129 | Me.Controls.Add(Me.lnkLblLocation)
130 | Me.Controls.Add(Me.lblSunsetSunrise)
131 | Me.Controls.Add(Me.pBoxLogo)
132 | Me.Controls.Add(Me.lblChangelog)
133 | Me.Controls.Add(Me.lblVer)
134 | Me.Controls.Add(Me.lblTitle)
135 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
136 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
137 | Me.MaximizeBox = False
138 | Me.MinimizeBox = False
139 | Me.Name = "frmAbout"
140 | Me.ShowInTaskbar = False
141 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
142 | Me.Text = "About"
143 | Me.TopMost = True
144 | CType(Me.pBoxLogo, System.ComponentModel.ISupportInitialize).EndInit()
145 | Me.ResumeLayout(False)
146 | Me.PerformLayout()
147 |
148 | End Sub
149 |
150 | Friend WithEvents pBoxLogo As PictureBox
151 | Friend WithEvents lblChangelog As Label
152 | Friend WithEvents lblVer As Label
153 | Friend WithEvents lblTitle As Label
154 | Friend WithEvents lblSunsetSunrise As Label
155 | Friend WithEvents lnkLblLocation As LinkLabel
156 | Friend WithEvents lblBrightnessControl As Label
157 | Friend WithEvents lnkLblLicense As LinkLabel
158 | End Class
159 |
--------------------------------------------------------------------------------
/AutoBright/frmAbout.vb:
--------------------------------------------------------------------------------
1 | Public Class frmAbout
2 | Private Sub lnkLblLocation_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles lnkLblLocation.LinkClicked
3 | lnkLblLocation.LinkVisited = True
4 | System.Diagnostics.Process.Start("http://sunrise-sunset.org/")
5 | End Sub
6 |
7 | Private Sub lnkLblLicense_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles lnkLblLicense.LinkClicked
8 | lnkLblLicense.LinkVisited = True
9 | System.Diagnostics.Process.Start("https://github.com/alexhorn/BrightnessControl/blob/master/LICENSE")
10 | End Sub
11 | End Class
--------------------------------------------------------------------------------
/AutoBright/frmAdvanced.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class frmAdvanced
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmAdvanced))
26 | Me.cBoxExternalProgram = New System.Windows.Forms.CheckBox()
27 | Me.gBoxExternalProgram = New System.Windows.Forms.GroupBox()
28 | Me.tBoxPath = New System.Windows.Forms.TextBox()
29 | Me.btnBrowse = New System.Windows.Forms.Button()
30 | Me.lblPath = New System.Windows.Forms.Label()
31 | Me.lblArg = New System.Windows.Forms.Label()
32 | Me.tBoxArg = New System.Windows.Forms.TextBox()
33 | Me.btnTest = New System.Windows.Forms.Button()
34 | Me.dlgOpenProgram = New System.Windows.Forms.OpenFileDialog()
35 | Me.gBoxExternalProgram.SuspendLayout()
36 | Me.SuspendLayout()
37 | '
38 | 'cBoxExternalProgram
39 | '
40 | Me.cBoxExternalProgram.AutoSize = True
41 | Me.cBoxExternalProgram.Location = New System.Drawing.Point(12, 12)
42 | Me.cBoxExternalProgram.Name = "cBoxExternalProgram"
43 | Me.cBoxExternalProgram.Size = New System.Drawing.Size(197, 17)
44 | Me.cBoxExternalProgram.TabIndex = 0
45 | Me.cBoxExternalProgram.Text = "Run external program whilst dimming" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
46 | Me.cBoxExternalProgram.UseVisualStyleBackColor = True
47 | '
48 | 'gBoxExternalProgram
49 | '
50 | Me.gBoxExternalProgram.Controls.Add(Me.btnTest)
51 | Me.gBoxExternalProgram.Controls.Add(Me.tBoxArg)
52 | Me.gBoxExternalProgram.Controls.Add(Me.lblArg)
53 | Me.gBoxExternalProgram.Controls.Add(Me.lblPath)
54 | Me.gBoxExternalProgram.Controls.Add(Me.btnBrowse)
55 | Me.gBoxExternalProgram.Controls.Add(Me.tBoxPath)
56 | Me.gBoxExternalProgram.Enabled = False
57 | Me.gBoxExternalProgram.Location = New System.Drawing.Point(12, 35)
58 | Me.gBoxExternalProgram.Name = "gBoxExternalProgram"
59 | Me.gBoxExternalProgram.Size = New System.Drawing.Size(360, 126)
60 | Me.gBoxExternalProgram.TabIndex = 1
61 | Me.gBoxExternalProgram.TabStop = False
62 | Me.gBoxExternalProgram.Text = "External Program"
63 | '
64 | 'tBoxPath
65 | '
66 | Me.tBoxPath.Location = New System.Drawing.Point(6, 32)
67 | Me.tBoxPath.Name = "tBoxPath"
68 | Me.tBoxPath.Size = New System.Drawing.Size(267, 20)
69 | Me.tBoxPath.TabIndex = 0
70 | '
71 | 'btnBrowse
72 | '
73 | Me.btnBrowse.Location = New System.Drawing.Point(279, 32)
74 | Me.btnBrowse.Name = "btnBrowse"
75 | Me.btnBrowse.Size = New System.Drawing.Size(75, 23)
76 | Me.btnBrowse.TabIndex = 2
77 | Me.btnBrowse.Text = "Browse"
78 | Me.btnBrowse.UseVisualStyleBackColor = True
79 | '
80 | 'lblPath
81 | '
82 | Me.lblPath.AutoSize = True
83 | Me.lblPath.Location = New System.Drawing.Point(6, 16)
84 | Me.lblPath.Name = "lblPath"
85 | Me.lblPath.Size = New System.Drawing.Size(71, 13)
86 | Me.lblPath.TabIndex = 3
87 | Me.lblPath.Text = "Program Path"
88 | '
89 | 'lblArg
90 | '
91 | Me.lblArg.AutoSize = True
92 | Me.lblArg.Location = New System.Drawing.Point(6, 55)
93 | Me.lblArg.Name = "lblArg"
94 | Me.lblArg.Size = New System.Drawing.Size(57, 13)
95 | Me.lblArg.TabIndex = 2
96 | Me.lblArg.Text = "Arguments"
97 | '
98 | 'tBoxArg
99 | '
100 | Me.tBoxArg.Location = New System.Drawing.Point(6, 71)
101 | Me.tBoxArg.Name = "tBoxArg"
102 | Me.tBoxArg.Size = New System.Drawing.Size(348, 20)
103 | Me.tBoxArg.TabIndex = 4
104 | '
105 | 'btnTest
106 | '
107 | Me.btnTest.Location = New System.Drawing.Point(6, 97)
108 | Me.btnTest.Name = "btnTest"
109 | Me.btnTest.Size = New System.Drawing.Size(75, 23)
110 | Me.btnTest.TabIndex = 5
111 | Me.btnTest.Text = "Test"
112 | Me.btnTest.UseVisualStyleBackColor = True
113 | '
114 | 'dlgOpenProgram
115 | '
116 | Me.dlgOpenProgram.DefaultExt = "exe"
117 | Me.dlgOpenProgram.Filter = """Executable Files""|*.exe"
118 | '
119 | 'frmAdvanced
120 | '
121 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
122 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
123 | Me.ClientSize = New System.Drawing.Size(384, 172)
124 | Me.Controls.Add(Me.gBoxExternalProgram)
125 | Me.Controls.Add(Me.cBoxExternalProgram)
126 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
127 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
128 | Me.MaximizeBox = False
129 | Me.MinimizeBox = False
130 | Me.Name = "frmAdvanced"
131 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
132 | Me.Text = "Advanced Options"
133 | Me.gBoxExternalProgram.ResumeLayout(False)
134 | Me.gBoxExternalProgram.PerformLayout()
135 | Me.ResumeLayout(False)
136 | Me.PerformLayout()
137 |
138 | End Sub
139 |
140 | Friend WithEvents cBoxExternalProgram As CheckBox
141 | Friend WithEvents gBoxExternalProgram As GroupBox
142 | Friend WithEvents lblPath As Label
143 | Friend WithEvents btnBrowse As Button
144 | Friend WithEvents tBoxPath As TextBox
145 | Friend WithEvents btnTest As Button
146 | Friend WithEvents tBoxArg As TextBox
147 | Friend WithEvents lblArg As Label
148 | Friend WithEvents dlgOpenProgram As OpenFileDialog
149 | End Class
150 |
--------------------------------------------------------------------------------
/AutoBright/frmAdvanced.vb:
--------------------------------------------------------------------------------
1 | Public Class frmAdvanced
2 | Private Sub frmAdvanced_Load(sender As Object, e As EventArgs) Handles MyBase.Load
3 | gBoxExternalProgram.Enabled = cBoxExternalProgram.CheckState
4 | End Sub
5 |
6 | Private Sub cBoxExternalProgram_CheckedChanged(sender As Object, e As EventArgs) Handles cBoxExternalProgram.CheckedChanged
7 | gBoxExternalProgram.Enabled = cBoxExternalProgram.CheckState
8 | End Sub
9 |
10 | Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
11 | If dlgOpenProgram.ShowDialog() = MsgBoxResult.Ok Then
12 | tBoxPath.Text = dlgOpenProgram.FileName
13 | End If
14 | End Sub
15 |
16 | Private Sub btnTest_Click(sender As Object, e As EventArgs) Handles btnTest.Click
17 | Dim testProcess = New Process
18 | testProcess.StartInfo = New ProcessStartInfo() With {
19 | .WorkingDirectory = IO.Path.GetDirectoryName(tBoxPath.Text),
20 | .FileName = tBoxPath.Text,
21 | .Arguments = tBoxArg.Text}
22 |
23 | testProcess.Start() 'Run process to kill downloader process and any child processes
24 | End Sub
25 | End Class
--------------------------------------------------------------------------------
/AutoBright/frmFirstRun.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class frmFirstRun
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmFirstRun))
26 | Me.lblIntro = New System.Windows.Forms.Label()
27 | Me.btnContinue = New System.Windows.Forms.Button()
28 | Me.SuspendLayout()
29 | '
30 | 'lblIntro
31 | '
32 | Me.lblIntro.AutoSize = True
33 | Me.lblIntro.Location = New System.Drawing.Point(15, 9)
34 | Me.lblIntro.MaximumSize = New System.Drawing.Size(355, 0)
35 | Me.lblIntro.Name = "lblIntro"
36 | Me.lblIntro.Size = New System.Drawing.Size(353, 247)
37 | Me.lblIntro.TabIndex = 0
38 | Me.lblIntro.Text = resources.GetString("lblIntro.Text")
39 | Me.lblIntro.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
40 | '
41 | 'btnContinue
42 | '
43 | Me.btnContinue.Location = New System.Drawing.Point(154, 268)
44 | Me.btnContinue.Name = "btnContinue"
45 | Me.btnContinue.Size = New System.Drawing.Size(75, 23)
46 | Me.btnContinue.TabIndex = 1
47 | Me.btnContinue.Text = "Continue"
48 | Me.btnContinue.UseVisualStyleBackColor = True
49 | '
50 | 'frmFirstRun
51 | '
52 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
53 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
54 | Me.ClientSize = New System.Drawing.Size(384, 302)
55 | Me.ControlBox = False
56 | Me.Controls.Add(Me.btnContinue)
57 | Me.Controls.Add(Me.lblIntro)
58 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
59 | Me.Name = "frmFirstRun"
60 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
61 | Me.Text = "Welcome!"
62 | Me.ResumeLayout(False)
63 | Me.PerformLayout()
64 |
65 | End Sub
66 |
67 | Friend WithEvents lblIntro As Label
68 | Friend WithEvents btnContinue As Button
69 | End Class
70 |
--------------------------------------------------------------------------------
/AutoBright/frmFirstRun.vb:
--------------------------------------------------------------------------------
1 | Public Class frmFirstRun
2 | Private Sub btnContinue_Click(sender As Object, e As EventArgs) Handles btnContinue.Click
3 | Dim Monitors() As MonitorHelper.PHYSICAL_MONITOR = MonitorHelper.GetPhysicalMonitors
4 | If Monitors.Length = 0 Then
5 | Application.Exit()
6 | End If
7 | Select Case Monitors.Length
8 | Case 1
9 | My.Settings.Screen1Normal = MonitorHelper.GetPhysicalMonitorBrightness(Monitors(0)) * 100
10 | Case 2
11 | My.Settings.Screen1Normal = MonitorHelper.GetPhysicalMonitorBrightness(Monitors(0)) * 100
12 | My.Settings.Screen2Normal = MonitorHelper.GetPhysicalMonitorBrightness(Monitors(1)) * 100
13 | Case 3
14 | My.Settings.Screen1Normal = MonitorHelper.GetPhysicalMonitorBrightness(Monitors(0)) * 100
15 | My.Settings.Screen2Normal = MonitorHelper.GetPhysicalMonitorBrightness(Monitors(1)) * 100
16 | My.Settings.Screen3Normal = MonitorHelper.GetPhysicalMonitorBrightness(Monitors(2)) * 100
17 | End Select
18 | My.Settings.FirstRun = False
19 | frmSettings.ScheduleTimer.Enabled = True
20 | My.Settings.Save()
21 | frmSettings.ShowInTaskbar = True
22 | frmSettings.Show()
23 | frmSettings.WindowState = FormWindowState.Normal
24 | Me.Close()
25 | End Sub
26 | End Class
--------------------------------------------------------------------------------
/AutoBright/frmSettings.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class frmSettings
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | Me.components = New System.ComponentModel.Container()
26 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmSettings))
27 | Me.TransitionDownTimer1 = New System.Windows.Forms.Timer(Me.components)
28 | Me.NotificationTrayIcon = New System.Windows.Forms.NotifyIcon(Me.components)
29 | Me.NotificationTrayContext = New System.Windows.Forms.ContextMenuStrip(Me.components)
30 | Me.TitleToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
31 | Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
32 | Me.SettingsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
33 | Me.DisableToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
34 | Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
35 | Me.gBoxScreen1 = New System.Windows.Forms.GroupBox()
36 | Me.lblScreen1DimmedLabel = New System.Windows.Forms.Label()
37 | Me.lblScreen1NormalLabel = New System.Windows.Forms.Label()
38 | Me.btnScreen1Preview = New System.Windows.Forms.Button()
39 | Me.tBoxScreen1Dimmed = New System.Windows.Forms.TextBox()
40 | Me.tBoxScreen1Normal = New System.Windows.Forms.TextBox()
41 | Me.tBarScreen1Dimmed = New System.Windows.Forms.TrackBar()
42 | Me.tBarScreen1Normal = New System.Windows.Forms.TrackBar()
43 | Me.gBoxScreen2 = New System.Windows.Forms.GroupBox()
44 | Me.lblScreen2DimmedLabel = New System.Windows.Forms.Label()
45 | Me.lblScreen2NormalLabel = New System.Windows.Forms.Label()
46 | Me.btnScreen2Preview = New System.Windows.Forms.Button()
47 | Me.tBoxScreen2Dimmed = New System.Windows.Forms.TextBox()
48 | Me.tBoxScreen2Normal = New System.Windows.Forms.TextBox()
49 | Me.tBarScreen2Dimmed = New System.Windows.Forms.TrackBar()
50 | Me.tBarScreen2Normal = New System.Windows.Forms.TrackBar()
51 | Me.gBoxScreen3 = New System.Windows.Forms.GroupBox()
52 | Me.lblScreen3DimmedLabel = New System.Windows.Forms.Label()
53 | Me.lblScreen3NormalLabel = New System.Windows.Forms.Label()
54 | Me.btnScreen3Preview = New System.Windows.Forms.Button()
55 | Me.tBoxScreen3Dimmed = New System.Windows.Forms.TextBox()
56 | Me.tBoxScreen3Normal = New System.Windows.Forms.TextBox()
57 | Me.tBarScreen3Dimmed = New System.Windows.Forms.TrackBar()
58 | Me.tBarScreen3Normal = New System.Windows.Forms.TrackBar()
59 | Me.gBoxOptions = New System.Windows.Forms.GroupBox()
60 | Me.btnAdvanced = New System.Windows.Forms.Button()
61 | Me.tBoxOffset = New System.Windows.Forms.TextBox()
62 | Me.lblOffset = New System.Windows.Forms.Label()
63 | Me.tBoxTransitionTime = New System.Windows.Forms.TextBox()
64 | Me.lblTransitionTime = New System.Windows.Forms.Label()
65 | Me.btnSave = New System.Windows.Forms.Button()
66 | Me.btnClose = New System.Windows.Forms.Button()
67 | Me.PreviewBrightness = New System.ComponentModel.BackgroundWorker()
68 | Me.btnAbout = New System.Windows.Forms.Button()
69 | Me.gBoxLocation = New System.Windows.Forms.GroupBox()
70 | Me.tBoxLongitude = New System.Windows.Forms.TextBox()
71 | Me.lblLongitude = New System.Windows.Forms.Label()
72 | Me.tBoxLatitude = New System.Windows.Forms.TextBox()
73 | Me.lblLatitude = New System.Windows.Forms.Label()
74 | Me.lblLocation = New System.Windows.Forms.Label()
75 | Me.TransitionUpTimer1 = New System.Windows.Forms.Timer(Me.components)
76 | Me.ScheduleTimer = New System.Windows.Forms.Timer(Me.components)
77 | Me.TransitionDownTimer2 = New System.Windows.Forms.Timer(Me.components)
78 | Me.TransitionDownTimer3 = New System.Windows.Forms.Timer(Me.components)
79 | Me.TransitionUpTimer2 = New System.Windows.Forms.Timer(Me.components)
80 | Me.TransitionUpTimer3 = New System.Windows.Forms.Timer(Me.components)
81 | Me.lblEndTime = New System.Windows.Forms.Label()
82 | Me.lblStartTime = New System.Windows.Forms.Label()
83 | Me.gBoxInfo = New System.Windows.Forms.GroupBox()
84 | Me.lblScreen3Brightness = New System.Windows.Forms.Label()
85 | Me.lblScreen2Brightness = New System.Windows.Forms.Label()
86 | Me.lblScreen1Brightness = New System.Windows.Forms.Label()
87 | Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components)
88 | Me.NotificationTrayContext.SuspendLayout()
89 | Me.gBoxScreen1.SuspendLayout()
90 | CType(Me.tBarScreen1Dimmed, System.ComponentModel.ISupportInitialize).BeginInit()
91 | CType(Me.tBarScreen1Normal, System.ComponentModel.ISupportInitialize).BeginInit()
92 | Me.gBoxScreen2.SuspendLayout()
93 | CType(Me.tBarScreen2Dimmed, System.ComponentModel.ISupportInitialize).BeginInit()
94 | CType(Me.tBarScreen2Normal, System.ComponentModel.ISupportInitialize).BeginInit()
95 | Me.gBoxScreen3.SuspendLayout()
96 | CType(Me.tBarScreen3Dimmed, System.ComponentModel.ISupportInitialize).BeginInit()
97 | CType(Me.tBarScreen3Normal, System.ComponentModel.ISupportInitialize).BeginInit()
98 | Me.gBoxOptions.SuspendLayout()
99 | Me.gBoxLocation.SuspendLayout()
100 | Me.gBoxInfo.SuspendLayout()
101 | Me.SuspendLayout()
102 | '
103 | 'TransitionDownTimer1
104 | '
105 | Me.TransitionDownTimer1.Interval = 500
106 | '
107 | 'NotificationTrayIcon
108 | '
109 | Me.NotificationTrayIcon.ContextMenuStrip = Me.NotificationTrayContext
110 | Me.NotificationTrayIcon.Icon = CType(resources.GetObject("NotificationTrayIcon.Icon"), System.Drawing.Icon)
111 | Me.NotificationTrayIcon.Text = "AutoBright - Idle"
112 | Me.NotificationTrayIcon.Visible = True
113 | '
114 | 'NotificationTrayContext
115 | '
116 | Me.NotificationTrayContext.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.TitleToolStripMenuItem, Me.ToolStripSeparator1, Me.SettingsToolStripMenuItem, Me.DisableToolStripMenuItem, Me.ExitToolStripMenuItem})
117 | Me.NotificationTrayContext.Name = "NotificationTrayContect"
118 | Me.NotificationTrayContext.RenderMode = System.Windows.Forms.ToolStripRenderMode.System
119 | Me.NotificationTrayContext.Size = New System.Drawing.Size(153, 120)
120 | '
121 | 'TitleToolStripMenuItem
122 | '
123 | Me.TitleToolStripMenuItem.Image = Global.AutoBright.My.Resources.Resources.AutoBrightIdle1
124 | Me.TitleToolStripMenuItem.Name = "TitleToolStripMenuItem"
125 | Me.TitleToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
126 | Me.TitleToolStripMenuItem.Text = "AutoBright"
127 | '
128 | 'ToolStripSeparator1
129 | '
130 | Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
131 | Me.ToolStripSeparator1.Size = New System.Drawing.Size(149, 6)
132 | '
133 | 'SettingsToolStripMenuItem
134 | '
135 | Me.SettingsToolStripMenuItem.Name = "SettingsToolStripMenuItem"
136 | Me.SettingsToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
137 | Me.SettingsToolStripMenuItem.Text = "Settings"
138 | '
139 | 'DisableToolStripMenuItem
140 | '
141 | Me.DisableToolStripMenuItem.Name = "DisableToolStripMenuItem"
142 | Me.DisableToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
143 | Me.DisableToolStripMenuItem.Text = "Disable"
144 | '
145 | 'ExitToolStripMenuItem
146 | '
147 | Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"
148 | Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
149 | Me.ExitToolStripMenuItem.Text = "Exit"
150 | '
151 | 'gBoxScreen1
152 | '
153 | Me.gBoxScreen1.Controls.Add(Me.lblScreen1DimmedLabel)
154 | Me.gBoxScreen1.Controls.Add(Me.lblScreen1NormalLabel)
155 | Me.gBoxScreen1.Controls.Add(Me.btnScreen1Preview)
156 | Me.gBoxScreen1.Controls.Add(Me.tBoxScreen1Dimmed)
157 | Me.gBoxScreen1.Controls.Add(Me.tBoxScreen1Normal)
158 | Me.gBoxScreen1.Controls.Add(Me.tBarScreen1Dimmed)
159 | Me.gBoxScreen1.Controls.Add(Me.tBarScreen1Normal)
160 | Me.gBoxScreen1.Enabled = False
161 | Me.gBoxScreen1.Location = New System.Drawing.Point(12, 12)
162 | Me.gBoxScreen1.Name = "gBoxScreen1"
163 | Me.gBoxScreen1.Size = New System.Drawing.Size(340, 135)
164 | Me.gBoxScreen1.TabIndex = 22
165 | Me.gBoxScreen1.TabStop = False
166 | Me.gBoxScreen1.Text = "Screen 1"
167 | '
168 | 'lblScreen1DimmedLabel
169 | '
170 | Me.lblScreen1DimmedLabel.AutoSize = True
171 | Me.lblScreen1DimmedLabel.Location = New System.Drawing.Point(6, 72)
172 | Me.lblScreen1DimmedLabel.Name = "lblScreen1DimmedLabel"
173 | Me.lblScreen1DimmedLabel.Size = New System.Drawing.Size(97, 13)
174 | Me.lblScreen1DimmedLabel.TabIndex = 14
175 | Me.lblScreen1DimmedLabel.Text = "Dimmed Brightness"
176 | '
177 | 'lblScreen1NormalLabel
178 | '
179 | Me.lblScreen1NormalLabel.AutoSize = True
180 | Me.lblScreen1NormalLabel.Location = New System.Drawing.Point(6, 21)
181 | Me.lblScreen1NormalLabel.Name = "lblScreen1NormalLabel"
182 | Me.lblScreen1NormalLabel.Size = New System.Drawing.Size(92, 13)
183 | Me.lblScreen1NormalLabel.TabIndex = 13
184 | Me.lblScreen1NormalLabel.Text = "Normal Brightness"
185 | '
186 | 'btnScreen1Preview
187 | '
188 | Me.btnScreen1Preview.Location = New System.Drawing.Point(254, 88)
189 | Me.btnScreen1Preview.Name = "btnScreen1Preview"
190 | Me.btnScreen1Preview.Size = New System.Drawing.Size(75, 20)
191 | Me.btnScreen1Preview.TabIndex = 3
192 | Me.btnScreen1Preview.Text = "Preview"
193 | Me.ToolTip.SetToolTip(Me.btnScreen1Preview, "Preview brightness levels")
194 | Me.btnScreen1Preview.UseVisualStyleBackColor = True
195 | '
196 | 'tBoxScreen1Dimmed
197 | '
198 | Me.tBoxScreen1Dimmed.Location = New System.Drawing.Point(212, 88)
199 | Me.tBoxScreen1Dimmed.Name = "tBoxScreen1Dimmed"
200 | Me.tBoxScreen1Dimmed.ShortcutsEnabled = False
201 | Me.tBoxScreen1Dimmed.Size = New System.Drawing.Size(36, 20)
202 | Me.tBoxScreen1Dimmed.TabIndex = 2
203 | Me.ToolTip.SetToolTip(Me.tBoxScreen1Dimmed, "Manually type a brightness value")
204 | '
205 | 'tBoxScreen1Normal
206 | '
207 | Me.tBoxScreen1Normal.Location = New System.Drawing.Point(212, 37)
208 | Me.tBoxScreen1Normal.Name = "tBoxScreen1Normal"
209 | Me.tBoxScreen1Normal.ShortcutsEnabled = False
210 | Me.tBoxScreen1Normal.Size = New System.Drawing.Size(36, 20)
211 | Me.tBoxScreen1Normal.TabIndex = 1
212 | Me.ToolTip.SetToolTip(Me.tBoxScreen1Normal, "Manually type a brightness value")
213 | '
214 | 'tBarScreen1Dimmed
215 | '
216 | Me.tBarScreen1Dimmed.LargeChange = 10
217 | Me.tBarScreen1Dimmed.Location = New System.Drawing.Point(6, 88)
218 | Me.tBarScreen1Dimmed.Maximum = 100
219 | Me.tBarScreen1Dimmed.Name = "tBarScreen1Dimmed"
220 | Me.tBarScreen1Dimmed.Size = New System.Drawing.Size(200, 45)
221 | Me.tBarScreen1Dimmed.SmallChange = 5
222 | Me.tBarScreen1Dimmed.TabIndex = 9
223 | Me.tBarScreen1Dimmed.TabStop = False
224 | Me.tBarScreen1Dimmed.TickFrequency = 10
225 | Me.ToolTip.SetToolTip(Me.tBarScreen1Dimmed, "Slide to set brightness level")
226 | '
227 | 'tBarScreen1Normal
228 | '
229 | Me.tBarScreen1Normal.LargeChange = 10
230 | Me.tBarScreen1Normal.Location = New System.Drawing.Point(6, 37)
231 | Me.tBarScreen1Normal.Maximum = 100
232 | Me.tBarScreen1Normal.Name = "tBarScreen1Normal"
233 | Me.tBarScreen1Normal.Size = New System.Drawing.Size(200, 45)
234 | Me.tBarScreen1Normal.SmallChange = 5
235 | Me.tBarScreen1Normal.TabIndex = 17
236 | Me.tBarScreen1Normal.TabStop = False
237 | Me.tBarScreen1Normal.TickFrequency = 10
238 | Me.ToolTip.SetToolTip(Me.tBarScreen1Normal, "Slide to set brightness level")
239 | '
240 | 'gBoxScreen2
241 | '
242 | Me.gBoxScreen2.Controls.Add(Me.lblScreen2DimmedLabel)
243 | Me.gBoxScreen2.Controls.Add(Me.lblScreen2NormalLabel)
244 | Me.gBoxScreen2.Controls.Add(Me.btnScreen2Preview)
245 | Me.gBoxScreen2.Controls.Add(Me.tBoxScreen2Dimmed)
246 | Me.gBoxScreen2.Controls.Add(Me.tBoxScreen2Normal)
247 | Me.gBoxScreen2.Controls.Add(Me.tBarScreen2Dimmed)
248 | Me.gBoxScreen2.Controls.Add(Me.tBarScreen2Normal)
249 | Me.gBoxScreen2.Enabled = False
250 | Me.gBoxScreen2.Location = New System.Drawing.Point(12, 153)
251 | Me.gBoxScreen2.Name = "gBoxScreen2"
252 | Me.gBoxScreen2.Size = New System.Drawing.Size(340, 135)
253 | Me.gBoxScreen2.TabIndex = 23
254 | Me.gBoxScreen2.TabStop = False
255 | Me.gBoxScreen2.Text = "Screen 2"
256 | '
257 | 'lblScreen2DimmedLabel
258 | '
259 | Me.lblScreen2DimmedLabel.AutoSize = True
260 | Me.lblScreen2DimmedLabel.Location = New System.Drawing.Point(6, 72)
261 | Me.lblScreen2DimmedLabel.Name = "lblScreen2DimmedLabel"
262 | Me.lblScreen2DimmedLabel.Size = New System.Drawing.Size(97, 13)
263 | Me.lblScreen2DimmedLabel.TabIndex = 21
264 | Me.lblScreen2DimmedLabel.Text = "Dimmed Brightness"
265 | '
266 | 'lblScreen2NormalLabel
267 | '
268 | Me.lblScreen2NormalLabel.AutoSize = True
269 | Me.lblScreen2NormalLabel.Location = New System.Drawing.Point(6, 21)
270 | Me.lblScreen2NormalLabel.Name = "lblScreen2NormalLabel"
271 | Me.lblScreen2NormalLabel.Size = New System.Drawing.Size(92, 13)
272 | Me.lblScreen2NormalLabel.TabIndex = 20
273 | Me.lblScreen2NormalLabel.Text = "Normal Brightness"
274 | '
275 | 'btnScreen2Preview
276 | '
277 | Me.btnScreen2Preview.Location = New System.Drawing.Point(254, 88)
278 | Me.btnScreen2Preview.Name = "btnScreen2Preview"
279 | Me.btnScreen2Preview.Size = New System.Drawing.Size(75, 23)
280 | Me.btnScreen2Preview.TabIndex = 6
281 | Me.btnScreen2Preview.Text = "Preview"
282 | Me.ToolTip.SetToolTip(Me.btnScreen2Preview, "Preview brightness levels")
283 | Me.btnScreen2Preview.UseVisualStyleBackColor = True
284 | '
285 | 'tBoxScreen2Dimmed
286 | '
287 | Me.tBoxScreen2Dimmed.Location = New System.Drawing.Point(212, 88)
288 | Me.tBoxScreen2Dimmed.Name = "tBoxScreen2Dimmed"
289 | Me.tBoxScreen2Dimmed.ShortcutsEnabled = False
290 | Me.tBoxScreen2Dimmed.Size = New System.Drawing.Size(36, 20)
291 | Me.tBoxScreen2Dimmed.TabIndex = 5
292 | Me.ToolTip.SetToolTip(Me.tBoxScreen2Dimmed, "Manually type a brightness value")
293 | '
294 | 'tBoxScreen2Normal
295 | '
296 | Me.tBoxScreen2Normal.Location = New System.Drawing.Point(212, 37)
297 | Me.tBoxScreen2Normal.Name = "tBoxScreen2Normal"
298 | Me.tBoxScreen2Normal.ShortcutsEnabled = False
299 | Me.tBoxScreen2Normal.Size = New System.Drawing.Size(36, 20)
300 | Me.tBoxScreen2Normal.TabIndex = 4
301 | Me.ToolTip.SetToolTip(Me.tBoxScreen2Normal, "Manually type a brightness value")
302 | '
303 | 'tBarScreen2Dimmed
304 | '
305 | Me.tBarScreen2Dimmed.LargeChange = 10
306 | Me.tBarScreen2Dimmed.Location = New System.Drawing.Point(6, 88)
307 | Me.tBarScreen2Dimmed.Maximum = 100
308 | Me.tBarScreen2Dimmed.Name = "tBarScreen2Dimmed"
309 | Me.tBarScreen2Dimmed.Size = New System.Drawing.Size(200, 45)
310 | Me.tBarScreen2Dimmed.SmallChange = 5
311 | Me.tBarScreen2Dimmed.TabIndex = 16
312 | Me.tBarScreen2Dimmed.TabStop = False
313 | Me.tBarScreen2Dimmed.TickFrequency = 10
314 | Me.ToolTip.SetToolTip(Me.tBarScreen2Dimmed, "Slide to set brightness level")
315 | '
316 | 'tBarScreen2Normal
317 | '
318 | Me.tBarScreen2Normal.LargeChange = 10
319 | Me.tBarScreen2Normal.Location = New System.Drawing.Point(6, 37)
320 | Me.tBarScreen2Normal.Maximum = 100
321 | Me.tBarScreen2Normal.Name = "tBarScreen2Normal"
322 | Me.tBarScreen2Normal.Size = New System.Drawing.Size(200, 45)
323 | Me.tBarScreen2Normal.SmallChange = 5
324 | Me.tBarScreen2Normal.TabIndex = 15
325 | Me.tBarScreen2Normal.TabStop = False
326 | Me.tBarScreen2Normal.TickFrequency = 10
327 | Me.ToolTip.SetToolTip(Me.tBarScreen2Normal, "Slide to set brightness level")
328 | '
329 | 'gBoxScreen3
330 | '
331 | Me.gBoxScreen3.Controls.Add(Me.lblScreen3DimmedLabel)
332 | Me.gBoxScreen3.Controls.Add(Me.lblScreen3NormalLabel)
333 | Me.gBoxScreen3.Controls.Add(Me.btnScreen3Preview)
334 | Me.gBoxScreen3.Controls.Add(Me.tBoxScreen3Dimmed)
335 | Me.gBoxScreen3.Controls.Add(Me.tBoxScreen3Normal)
336 | Me.gBoxScreen3.Controls.Add(Me.tBarScreen3Dimmed)
337 | Me.gBoxScreen3.Controls.Add(Me.tBarScreen3Normal)
338 | Me.gBoxScreen3.Enabled = False
339 | Me.gBoxScreen3.Location = New System.Drawing.Point(12, 294)
340 | Me.gBoxScreen3.Name = "gBoxScreen3"
341 | Me.gBoxScreen3.Size = New System.Drawing.Size(340, 135)
342 | Me.gBoxScreen3.TabIndex = 24
343 | Me.gBoxScreen3.TabStop = False
344 | Me.gBoxScreen3.Text = "Screen 3"
345 | '
346 | 'lblScreen3DimmedLabel
347 | '
348 | Me.lblScreen3DimmedLabel.AutoSize = True
349 | Me.lblScreen3DimmedLabel.Location = New System.Drawing.Point(6, 69)
350 | Me.lblScreen3DimmedLabel.Name = "lblScreen3DimmedLabel"
351 | Me.lblScreen3DimmedLabel.Size = New System.Drawing.Size(97, 13)
352 | Me.lblScreen3DimmedLabel.TabIndex = 28
353 | Me.lblScreen3DimmedLabel.Text = "Dimmed Brightness"
354 | '
355 | 'lblScreen3NormalLabel
356 | '
357 | Me.lblScreen3NormalLabel.AutoSize = True
358 | Me.lblScreen3NormalLabel.Location = New System.Drawing.Point(6, 21)
359 | Me.lblScreen3NormalLabel.Name = "lblScreen3NormalLabel"
360 | Me.lblScreen3NormalLabel.Size = New System.Drawing.Size(92, 13)
361 | Me.lblScreen3NormalLabel.TabIndex = 27
362 | Me.lblScreen3NormalLabel.Text = "Normal Brightness"
363 | '
364 | 'btnScreen3Preview
365 | '
366 | Me.btnScreen3Preview.Location = New System.Drawing.Point(254, 88)
367 | Me.btnScreen3Preview.Name = "btnScreen3Preview"
368 | Me.btnScreen3Preview.Size = New System.Drawing.Size(75, 23)
369 | Me.btnScreen3Preview.TabIndex = 9
370 | Me.btnScreen3Preview.Text = "Preview"
371 | Me.ToolTip.SetToolTip(Me.btnScreen3Preview, "Preview brightness levels")
372 | Me.btnScreen3Preview.UseVisualStyleBackColor = True
373 | '
374 | 'tBoxScreen3Dimmed
375 | '
376 | Me.tBoxScreen3Dimmed.Location = New System.Drawing.Point(212, 88)
377 | Me.tBoxScreen3Dimmed.Name = "tBoxScreen3Dimmed"
378 | Me.tBoxScreen3Dimmed.ShortcutsEnabled = False
379 | Me.tBoxScreen3Dimmed.Size = New System.Drawing.Size(36, 20)
380 | Me.tBoxScreen3Dimmed.TabIndex = 8
381 | Me.ToolTip.SetToolTip(Me.tBoxScreen3Dimmed, "Manually type a brightness value")
382 | '
383 | 'tBoxScreen3Normal
384 | '
385 | Me.tBoxScreen3Normal.Location = New System.Drawing.Point(212, 37)
386 | Me.tBoxScreen3Normal.Name = "tBoxScreen3Normal"
387 | Me.tBoxScreen3Normal.ShortcutsEnabled = False
388 | Me.tBoxScreen3Normal.Size = New System.Drawing.Size(36, 20)
389 | Me.tBoxScreen3Normal.TabIndex = 7
390 | Me.ToolTip.SetToolTip(Me.tBoxScreen3Normal, "Manually type a brightness value")
391 | '
392 | 'tBarScreen3Dimmed
393 | '
394 | Me.tBarScreen3Dimmed.LargeChange = 10
395 | Me.tBarScreen3Dimmed.Location = New System.Drawing.Point(6, 88)
396 | Me.tBarScreen3Dimmed.Maximum = 100
397 | Me.tBarScreen3Dimmed.Name = "tBarScreen3Dimmed"
398 | Me.tBarScreen3Dimmed.Size = New System.Drawing.Size(200, 45)
399 | Me.tBarScreen3Dimmed.SmallChange = 5
400 | Me.tBarScreen3Dimmed.TabIndex = 23
401 | Me.tBarScreen3Dimmed.TabStop = False
402 | Me.tBarScreen3Dimmed.TickFrequency = 10
403 | Me.ToolTip.SetToolTip(Me.tBarScreen3Dimmed, "Slide to set brightness level")
404 | '
405 | 'tBarScreen3Normal
406 | '
407 | Me.tBarScreen3Normal.LargeChange = 10
408 | Me.tBarScreen3Normal.Location = New System.Drawing.Point(6, 37)
409 | Me.tBarScreen3Normal.Maximum = 100
410 | Me.tBarScreen3Normal.Name = "tBarScreen3Normal"
411 | Me.tBarScreen3Normal.Size = New System.Drawing.Size(200, 45)
412 | Me.tBarScreen3Normal.SmallChange = 5
413 | Me.tBarScreen3Normal.TabIndex = 22
414 | Me.tBarScreen3Normal.TabStop = False
415 | Me.tBarScreen3Normal.TickFrequency = 10
416 | Me.ToolTip.SetToolTip(Me.tBarScreen3Normal, "Slide to set brightness level")
417 | '
418 | 'gBoxOptions
419 | '
420 | Me.gBoxOptions.Controls.Add(Me.btnAdvanced)
421 | Me.gBoxOptions.Controls.Add(Me.tBoxOffset)
422 | Me.gBoxOptions.Controls.Add(Me.lblOffset)
423 | Me.gBoxOptions.Controls.Add(Me.tBoxTransitionTime)
424 | Me.gBoxOptions.Controls.Add(Me.lblTransitionTime)
425 | Me.gBoxOptions.Location = New System.Drawing.Point(358, 12)
426 | Me.gBoxOptions.Name = "gBoxOptions"
427 | Me.gBoxOptions.Size = New System.Drawing.Size(284, 92)
428 | Me.gBoxOptions.TabIndex = 25
429 | Me.gBoxOptions.TabStop = False
430 | Me.gBoxOptions.Text = "Options"
431 | '
432 | 'btnAdvanced
433 | '
434 | Me.btnAdvanced.Location = New System.Drawing.Point(10, 63)
435 | Me.btnAdvanced.Name = "btnAdvanced"
436 | Me.btnAdvanced.Size = New System.Drawing.Size(75, 23)
437 | Me.btnAdvanced.TabIndex = 13
438 | Me.btnAdvanced.Text = "Advanced"
439 | Me.btnAdvanced.UseVisualStyleBackColor = True
440 | '
441 | 'tBoxOffset
442 | '
443 | Me.tBoxOffset.Location = New System.Drawing.Point(143, 37)
444 | Me.tBoxOffset.Margin = New System.Windows.Forms.Padding(30, 3, 3, 3)
445 | Me.tBoxOffset.Name = "tBoxOffset"
446 | Me.tBoxOffset.Size = New System.Drawing.Size(100, 20)
447 | Me.tBoxOffset.TabIndex = 12
448 | Me.ToolTip.SetToolTip(Me.tBoxOffset, "Amount to offset dimming/undimming by. Negative value will start sooner and end l" &
449 | "ater.")
450 | '
451 | 'lblOffset
452 | '
453 | Me.lblOffset.AutoSize = True
454 | Me.lblOffset.Location = New System.Drawing.Point(140, 21)
455 | Me.lblOffset.Name = "lblOffset"
456 | Me.lblOffset.Size = New System.Drawing.Size(65, 13)
457 | Me.lblOffset.TabIndex = 11
458 | Me.lblOffset.Text = "Offset (mins)"
459 | '
460 | 'tBoxTransitionTime
461 | '
462 | Me.tBoxTransitionTime.Location = New System.Drawing.Point(10, 37)
463 | Me.tBoxTransitionTime.Name = "tBoxTransitionTime"
464 | Me.tBoxTransitionTime.Size = New System.Drawing.Size(100, 20)
465 | Me.tBoxTransitionTime.TabIndex = 10
466 | Me.ToolTip.SetToolTip(Me.tBoxTransitionTime, "Time for change from normal to dimmed")
467 | '
468 | 'lblTransitionTime
469 | '
470 | Me.lblTransitionTime.AutoSize = True
471 | Me.lblTransitionTime.Location = New System.Drawing.Point(7, 21)
472 | Me.lblTransitionTime.Name = "lblTransitionTime"
473 | Me.lblTransitionTime.Size = New System.Drawing.Size(109, 13)
474 | Me.lblTransitionTime.TabIndex = 3
475 | Me.lblTransitionTime.Text = "Transition Time (mins)"
476 | '
477 | 'btnSave
478 | '
479 | Me.btnSave.Location = New System.Drawing.Point(358, 404)
480 | Me.btnSave.Name = "btnSave"
481 | Me.btnSave.Size = New System.Drawing.Size(88, 23)
482 | Me.btnSave.TabIndex = 14
483 | Me.btnSave.Text = "Save"
484 | Me.ToolTip.SetToolTip(Me.btnSave, "Save settings changes")
485 | Me.btnSave.UseVisualStyleBackColor = True
486 | '
487 | 'btnClose
488 | '
489 | Me.btnClose.Location = New System.Drawing.Point(554, 404)
490 | Me.btnClose.Name = "btnClose"
491 | Me.btnClose.Size = New System.Drawing.Size(88, 23)
492 | Me.btnClose.TabIndex = 17
493 | Me.btnClose.Text = "Close"
494 | Me.ToolTip.SetToolTip(Me.btnClose, "Hide window")
495 | Me.btnClose.UseVisualStyleBackColor = True
496 | '
497 | 'PreviewBrightness
498 | '
499 | '
500 | 'btnAbout
501 | '
502 | Me.btnAbout.Location = New System.Drawing.Point(456, 404)
503 | Me.btnAbout.Name = "btnAbout"
504 | Me.btnAbout.Size = New System.Drawing.Size(88, 23)
505 | Me.btnAbout.TabIndex = 16
506 | Me.btnAbout.Text = "About"
507 | Me.ToolTip.SetToolTip(Me.btnAbout, "Show info about application")
508 | Me.btnAbout.UseVisualStyleBackColor = True
509 | '
510 | 'gBoxLocation
511 | '
512 | Me.gBoxLocation.Controls.Add(Me.tBoxLongitude)
513 | Me.gBoxLocation.Controls.Add(Me.lblLongitude)
514 | Me.gBoxLocation.Controls.Add(Me.tBoxLatitude)
515 | Me.gBoxLocation.Controls.Add(Me.lblLatitude)
516 | Me.gBoxLocation.Controls.Add(Me.lblLocation)
517 | Me.gBoxLocation.Location = New System.Drawing.Point(358, 110)
518 | Me.gBoxLocation.Name = "gBoxLocation"
519 | Me.gBoxLocation.Size = New System.Drawing.Size(284, 177)
520 | Me.gBoxLocation.TabIndex = 29
521 | Me.gBoxLocation.TabStop = False
522 | Me.gBoxLocation.Text = "Location"
523 | '
524 | 'tBoxLongitude
525 | '
526 | Me.tBoxLongitude.Location = New System.Drawing.Point(6, 144)
527 | Me.tBoxLongitude.Name = "tBoxLongitude"
528 | Me.tBoxLongitude.ShortcutsEnabled = False
529 | Me.tBoxLongitude.Size = New System.Drawing.Size(272, 20)
530 | Me.tBoxLongitude.TabIndex = 12
531 | Me.ToolTip.SetToolTip(Me.tBoxLongitude, "Longitude for your location")
532 | '
533 | 'lblLongitude
534 | '
535 | Me.lblLongitude.AutoSize = True
536 | Me.lblLongitude.Location = New System.Drawing.Point(6, 128)
537 | Me.lblLongitude.Name = "lblLongitude"
538 | Me.lblLongitude.Size = New System.Drawing.Size(54, 13)
539 | Me.lblLongitude.TabIndex = 3
540 | Me.lblLongitude.Text = "Longitude"
541 | '
542 | 'tBoxLatitude
543 | '
544 | Me.tBoxLatitude.Location = New System.Drawing.Point(6, 105)
545 | Me.tBoxLatitude.Name = "tBoxLatitude"
546 | Me.tBoxLatitude.ShortcutsEnabled = False
547 | Me.tBoxLatitude.Size = New System.Drawing.Size(272, 20)
548 | Me.tBoxLatitude.TabIndex = 11
549 | Me.ToolTip.SetToolTip(Me.tBoxLatitude, "Latitude for your location")
550 | '
551 | 'lblLatitude
552 | '
553 | Me.lblLatitude.AutoSize = True
554 | Me.lblLatitude.Location = New System.Drawing.Point(6, 89)
555 | Me.lblLatitude.Name = "lblLatitude"
556 | Me.lblLatitude.Size = New System.Drawing.Size(45, 13)
557 | Me.lblLatitude.TabIndex = 1
558 | Me.lblLatitude.Text = "Latitude"
559 | '
560 | 'lblLocation
561 | '
562 | Me.lblLocation.AutoSize = True
563 | Me.lblLocation.Location = New System.Drawing.Point(7, 16)
564 | Me.lblLocation.MaximumSize = New System.Drawing.Size(274, 0)
565 | Me.lblLocation.Name = "lblLocation"
566 | Me.lblLocation.Size = New System.Drawing.Size(261, 65)
567 | Me.lblLocation.TabIndex = 0
568 | Me.lblLocation.Text = "In order to get times for your location, latitude and longitude coordinates are n" &
569 | "eeded." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "This data is handled externally by sunrise-sunset.org's API and I am n" &
570 | "ot responsible for any data entered."
571 | '
572 | 'TransitionUpTimer1
573 | '
574 | '
575 | 'ScheduleTimer
576 | '
577 | Me.ScheduleTimer.Interval = 1000
578 | '
579 | 'TransitionDownTimer2
580 | '
581 | Me.TransitionDownTimer2.Interval = 500
582 | '
583 | 'TransitionDownTimer3
584 | '
585 | '
586 | 'TransitionUpTimer2
587 | '
588 | '
589 | 'TransitionUpTimer3
590 | '
591 | '
592 | 'lblEndTime
593 | '
594 | Me.lblEndTime.AutoSize = True
595 | Me.lblEndTime.Location = New System.Drawing.Point(6, 32)
596 | Me.lblEndTime.Name = "lblEndTime"
597 | Me.lblEndTime.Size = New System.Drawing.Size(72, 13)
598 | Me.lblEndTime.TabIndex = 30
599 | Me.lblEndTime.Text = "Dimming End:"
600 | '
601 | 'lblStartTime
602 | '
603 | Me.lblStartTime.AutoSize = True
604 | Me.lblStartTime.Location = New System.Drawing.Point(6, 16)
605 | Me.lblStartTime.Name = "lblStartTime"
606 | Me.lblStartTime.Size = New System.Drawing.Size(75, 13)
607 | Me.lblStartTime.TabIndex = 31
608 | Me.lblStartTime.Text = "Dimming Start:"
609 | '
610 | 'gBoxInfo
611 | '
612 | Me.gBoxInfo.Controls.Add(Me.lblScreen3Brightness)
613 | Me.gBoxInfo.Controls.Add(Me.lblScreen2Brightness)
614 | Me.gBoxInfo.Controls.Add(Me.lblScreen1Brightness)
615 | Me.gBoxInfo.Controls.Add(Me.lblEndTime)
616 | Me.gBoxInfo.Controls.Add(Me.lblStartTime)
617 | Me.gBoxInfo.Location = New System.Drawing.Point(358, 293)
618 | Me.gBoxInfo.Name = "gBoxInfo"
619 | Me.gBoxInfo.Size = New System.Drawing.Size(284, 96)
620 | Me.gBoxInfo.TabIndex = 32
621 | Me.gBoxInfo.TabStop = False
622 | Me.gBoxInfo.Text = "Info"
623 | '
624 | 'lblScreen3Brightness
625 | '
626 | Me.lblScreen3Brightness.AutoSize = True
627 | Me.lblScreen3Brightness.Location = New System.Drawing.Point(6, 80)
628 | Me.lblScreen3Brightness.Name = "lblScreen3Brightness"
629 | Me.lblScreen3Brightness.Size = New System.Drawing.Size(142, 13)
630 | Me.lblScreen3Brightness.TabIndex = 34
631 | Me.lblScreen3Brightness.Text = "Screen 3 Current Brightness:"
632 | '
633 | 'lblScreen2Brightness
634 | '
635 | Me.lblScreen2Brightness.AutoSize = True
636 | Me.lblScreen2Brightness.Location = New System.Drawing.Point(6, 67)
637 | Me.lblScreen2Brightness.Name = "lblScreen2Brightness"
638 | Me.lblScreen2Brightness.Size = New System.Drawing.Size(142, 13)
639 | Me.lblScreen2Brightness.TabIndex = 33
640 | Me.lblScreen2Brightness.Text = "Screen 2 Current Brightness:"
641 | '
642 | 'lblScreen1Brightness
643 | '
644 | Me.lblScreen1Brightness.AutoSize = True
645 | Me.lblScreen1Brightness.Location = New System.Drawing.Point(6, 54)
646 | Me.lblScreen1Brightness.Name = "lblScreen1Brightness"
647 | Me.lblScreen1Brightness.Size = New System.Drawing.Size(142, 13)
648 | Me.lblScreen1Brightness.TabIndex = 32
649 | Me.lblScreen1Brightness.Text = "Screen 1 Current Brightness:"
650 | '
651 | 'frmSettings
652 | '
653 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
654 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
655 | Me.ClientSize = New System.Drawing.Size(654, 440)
656 | Me.Controls.Add(Me.gBoxInfo)
657 | Me.Controls.Add(Me.gBoxLocation)
658 | Me.Controls.Add(Me.btnAbout)
659 | Me.Controls.Add(Me.btnClose)
660 | Me.Controls.Add(Me.btnSave)
661 | Me.Controls.Add(Me.gBoxOptions)
662 | Me.Controls.Add(Me.gBoxScreen3)
663 | Me.Controls.Add(Me.gBoxScreen2)
664 | Me.Controls.Add(Me.gBoxScreen1)
665 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
666 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
667 | Me.MaximizeBox = False
668 | Me.MinimizeBox = False
669 | Me.Name = "frmSettings"
670 | Me.ShowInTaskbar = False
671 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
672 | Me.Text = "AutoBright Settings"
673 | Me.WindowState = System.Windows.Forms.FormWindowState.Minimized
674 | Me.NotificationTrayContext.ResumeLayout(False)
675 | Me.gBoxScreen1.ResumeLayout(False)
676 | Me.gBoxScreen1.PerformLayout()
677 | CType(Me.tBarScreen1Dimmed, System.ComponentModel.ISupportInitialize).EndInit()
678 | CType(Me.tBarScreen1Normal, System.ComponentModel.ISupportInitialize).EndInit()
679 | Me.gBoxScreen2.ResumeLayout(False)
680 | Me.gBoxScreen2.PerformLayout()
681 | CType(Me.tBarScreen2Dimmed, System.ComponentModel.ISupportInitialize).EndInit()
682 | CType(Me.tBarScreen2Normal, System.ComponentModel.ISupportInitialize).EndInit()
683 | Me.gBoxScreen3.ResumeLayout(False)
684 | Me.gBoxScreen3.PerformLayout()
685 | CType(Me.tBarScreen3Dimmed, System.ComponentModel.ISupportInitialize).EndInit()
686 | CType(Me.tBarScreen3Normal, System.ComponentModel.ISupportInitialize).EndInit()
687 | Me.gBoxOptions.ResumeLayout(False)
688 | Me.gBoxOptions.PerformLayout()
689 | Me.gBoxLocation.ResumeLayout(False)
690 | Me.gBoxLocation.PerformLayout()
691 | Me.gBoxInfo.ResumeLayout(False)
692 | Me.gBoxInfo.PerformLayout()
693 | Me.ResumeLayout(False)
694 |
695 | End Sub
696 | Friend WithEvents TransitionDownTimer1 As Timer
697 | Friend WithEvents NotificationTrayIcon As NotifyIcon
698 | Friend WithEvents gBoxScreen1 As GroupBox
699 | Friend WithEvents lblScreen1DimmedLabel As Label
700 | Friend WithEvents lblScreen1NormalLabel As Label
701 | Friend WithEvents btnScreen1Preview As Button
702 | Friend WithEvents tBoxScreen1Dimmed As TextBox
703 | Friend WithEvents tBoxScreen1Normal As TextBox
704 | Friend WithEvents tBarScreen1Dimmed As TrackBar
705 | Friend WithEvents tBarScreen1Normal As TrackBar
706 | Friend WithEvents gBoxScreen2 As GroupBox
707 | Friend WithEvents lblScreen2DimmedLabel As Label
708 | Friend WithEvents lblScreen2NormalLabel As Label
709 | Friend WithEvents btnScreen2Preview As Button
710 | Friend WithEvents tBoxScreen2Dimmed As TextBox
711 | Friend WithEvents tBoxScreen2Normal As TextBox
712 | Friend WithEvents tBarScreen2Dimmed As TrackBar
713 | Friend WithEvents tBarScreen2Normal As TrackBar
714 | Friend WithEvents gBoxScreen3 As GroupBox
715 | Friend WithEvents lblScreen3DimmedLabel As Label
716 | Friend WithEvents lblScreen3NormalLabel As Label
717 | Friend WithEvents btnScreen3Preview As Button
718 | Friend WithEvents tBoxScreen3Dimmed As TextBox
719 | Friend WithEvents tBoxScreen3Normal As TextBox
720 | Friend WithEvents tBarScreen3Dimmed As TrackBar
721 | Friend WithEvents tBarScreen3Normal As TrackBar
722 | Friend WithEvents gBoxOptions As GroupBox
723 | Friend WithEvents btnSave As Button
724 | Friend WithEvents btnClose As Button
725 | Friend WithEvents PreviewBrightness As System.ComponentModel.BackgroundWorker
726 | Friend WithEvents tBoxTransitionTime As TextBox
727 | Friend WithEvents lblTransitionTime As Label
728 | Friend WithEvents NotificationTrayContext As ContextMenuStrip
729 | Friend WithEvents SettingsToolStripMenuItem As ToolStripMenuItem
730 | Friend WithEvents DisableToolStripMenuItem As ToolStripMenuItem
731 | Friend WithEvents ExitToolStripMenuItem As ToolStripMenuItem
732 | Friend WithEvents ToolStripSeparator1 As ToolStripSeparator
733 | Friend WithEvents TitleToolStripMenuItem As ToolStripMenuItem
734 | Friend WithEvents btnAbout As Button
735 | Friend WithEvents gBoxLocation As GroupBox
736 | Friend WithEvents tBoxLatitude As TextBox
737 | Friend WithEvents lblLatitude As Label
738 | Friend WithEvents lblLocation As Label
739 | Friend WithEvents tBoxLongitude As TextBox
740 | Friend WithEvents lblLongitude As Label
741 | Friend WithEvents TransitionUpTimer1 As Timer
742 | Friend WithEvents ScheduleTimer As Timer
743 | Friend WithEvents TransitionDownTimer2 As Timer
744 | Friend WithEvents TransitionDownTimer3 As Timer
745 | Friend WithEvents TransitionUpTimer2 As Timer
746 | Friend WithEvents TransitionUpTimer3 As Timer
747 | Friend WithEvents lblEndTime As Label
748 | Friend WithEvents lblStartTime As Label
749 | Friend WithEvents gBoxInfo As GroupBox
750 | Friend WithEvents lblScreen3Brightness As Label
751 | Friend WithEvents lblScreen2Brightness As Label
752 | Friend WithEvents lblScreen1Brightness As Label
753 | Friend WithEvents tBoxOffset As TextBox
754 | Friend WithEvents lblOffset As Label
755 | Friend WithEvents ToolTip As ToolTip
756 | Friend WithEvents btnAdvanced As Button
757 | End Class
758 |
--------------------------------------------------------------------------------
/AutoBright/frmSettings.vb:
--------------------------------------------------------------------------------
1 | 'AutoBright (C) James Tattersall 2017
2 | 'Utility to automatically change screen brightness using DDC commands according to sunset/sunrise times
3 | Imports System.Net
4 | Imports System.IO
5 | Imports Microsoft.Win32
6 |
7 | Public Class frmSettings
8 | Private PhysicalMonitors() As MonitorHelper.PHYSICAL_MONITOR 'Create a class scoped array to hold the PHYSICAL_MONITOR structures for each Physical Monitor
9 | Dim dimmingDownStart, dimmingDownEnd, dimmingUpStart, dimmingUpEnd As DateTime 'Variables to hold transition start and end times
10 | Dim transitioning As Boolean = False 'Flag for if transition has started
11 | Dim externalProgramRunning As Boolean = isRunning() 'Flag for if background app has been started - saves checking for process every time
12 |
13 | Private Sub Settings_Load(sender As Object, e As EventArgs) Handles MyBase.Load
14 | Visible = False
15 | If Debugger.IsAttached Then
16 | Visible = True
17 | Me.WindowState = FormWindowState.Normal
18 | Me.ShowInTaskbar = True 'Show window automatically if debugger attached
19 | End If
20 |
21 | If My.Settings.FirstRun = True Then
22 | frmFirstRun.ShowDialog() 'Show first run dialog
23 | Else
24 | ScheduleTimer.Enabled = True 'Start scheduling timer
25 | End If
26 |
27 | AddHandler SystemEvents.DisplaySettingsChanged, AddressOf MonitorConfigChanged 'Add handler to handle the monitor configuration change event
28 | PhysicalMonitors = MonitorHelper.GetPhysicalMonitors 'Get all monitors and put into array
29 |
30 | AddHandler tBoxTransitionTime.KeyPress, AddressOf IntegerTBoxHandler
31 | AddHandler tBoxScreen1Normal.KeyPress, AddressOf IntegerTBoxHandler
32 | AddHandler tBoxScreen1Dimmed.KeyPress, AddressOf IntegerTBoxHandler
33 | AddHandler tBoxScreen2Normal.KeyPress, AddressOf IntegerTBoxHandler
34 | AddHandler tBoxScreen2Dimmed.KeyPress, AddressOf IntegerTBoxHandler
35 | AddHandler tBoxScreen3Normal.KeyPress, AddressOf IntegerTBoxHandler
36 | AddHandler tBoxScreen3Dimmed.KeyPress, AddressOf IntegerTBoxHandler 'Add handlers for integer only textboxes
37 |
38 | AddHandler tBoxOffset.KeyPress, AddressOf NegIntegerTBoxHandler 'Add handler for negative integer text box
39 |
40 | AddHandler tBoxLatitude.KeyPress, AddressOf DecimalTBoxHandler
41 | AddHandler tBoxLongitude.KeyPress, AddressOf DecimalTBoxHandler 'Add handlers for decimal only textboxes
42 |
43 | GetTimes() 'Fetch and process sunset/sunrise times
44 | UpdateSettings() 'Update all settings visible in window
45 | SetInitialMonitorLabelValue() 'Set values of labels to show current brightness
46 |
47 | End Sub
48 |
49 | #Region "Time fetching"
50 | Private Sub GetTimes()
51 | Debug.WriteLine("INFO: Fetching times")
52 | Dim todayRequest As WebRequest = WebRequest.Create("http://api.sunrise-sunset.org/json?lat=" & My.Settings.LocationLatitude & "&lng=" & My.Settings.LocationLongitude & "&formatted=0")
53 | Dim tomorrowRequest As WebRequest = WebRequest.Create("http://api.sunrise-sunset.org/json?lat=" & My.Settings.LocationLatitude & "&lng=" & My.Settings.LocationLongitude & "&formatted=0&date=tomorrow")
54 | Try 'Try getting times
55 | Dim todayTimesJSON As String = New StreamReader(todayRequest.GetResponse.GetResponseStream()).ReadLine
56 | Dim tomorrowTimesJSON As String = New StreamReader(tomorrowRequest.GetResponse.GetResponseStream()).ReadLine
57 | My.Settings.CivilTwilightEndToday = DateTime.Parse(Mid(todayTimesJSON, 172, 25)) 'Extract civil twilight end time for today and convert to DateTime
58 | My.Settings.CivilTwilightEndTomorrow = DateTime.Parse(Mid(tomorrowTimesJSON, 172, 25)) 'Extract civil twilight start time for tomorrow and convert to DateTime
59 | My.Settings.CivilTwilightStartToday = DateTime.Parse(Mid(todayTimesJSON, 221, 25)) 'Extract civil twilight end time and convert to DateTime
60 | My.Settings.Save()
61 |
62 | lblEndTime.ForeColor = Color.Black
63 | lblStartTime.ForeColor = Color.Black
64 | 'Reset colours
65 | Catch ex As Exception 'If fails, use last saved times
66 | Debug.WriteLine("ERROR: Time fetching failed, using stored times instead")
67 | Dim difference As Integer = DateDiff(DateInterval.Day, My.Settings.CivilTwilightEndToday, Date.Now) 'Get difference in days between last saved and present
68 |
69 | NotificationTrayIcon.BalloonTipIcon = ToolTipIcon.Error
70 | NotificationTrayIcon.BalloonTipTitle = "AutoBright - Time Fetch Failed"
71 | NotificationTrayIcon.BalloonTipText = "Fetching of sunrise/sunset times failed. Using times from " & difference & " day(s) ago (" & My.Settings.CivilTwilightStartToday.Date & ") instead."
72 | NotificationTrayIcon.ShowBalloonTip(7000)
73 | 'Display balloon notification alert
74 |
75 | My.Settings.CivilTwilightEndToday = My.Settings.CivilTwilightEndToday.AddDays(difference)
76 | My.Settings.CivilTwilightStartToday = My.Settings.CivilTwilightStartToday.AddDays(difference)
77 | My.Settings.CivilTwilightEndTomorrow = My.Settings.CivilTwilightEndTomorrow.AddDays(difference)
78 | 'Add difference in days to bring date to present
79 |
80 | NotificationTrayIcon.BalloonTipIcon = ToolTipIcon.None
81 | NotificationTrayIcon.BalloonTipTitle = ""
82 | NotificationTrayIcon.BalloonTipText = ""
83 | 'Reset balloon notification settings
84 |
85 | lblEndTime.ForeColor = Color.Red
86 | lblStartTime.ForeColor = Color.Red
87 | 'Change font colour in settings window
88 | Finally
89 | dimmingDownStart = My.Settings.CivilTwilightStartToday.AddMinutes(-1 * My.Settings.TransitionTime + My.Settings.Offset)
90 | dimmingDownEnd = dimmingDownStart.AddMinutes(My.Settings.TransitionTime) 'Calculate times for start and end of day->night transition
91 |
92 | dimmingUpStart = My.Settings.CivilTwilightEndTomorrow.AddMinutes(-1 * My.Settings.TransitionTime + -1 * My.Settings.Offset)
93 | dimmingUpEnd = dimmingUpStart.AddMinutes(My.Settings.TransitionTime) 'Calculate times for start and end of night->day transition
94 |
95 | Debug.WriteLine("INFO: dimmingDownStart = " & dimmingDownStart.ToString)
96 | Debug.WriteLine("INFO: dimmingDownEnd = " & dimmingDownEnd.ToString)
97 | Debug.WriteLine("INFO: dimmingUpStart = " & dimmingUpStart.ToString)
98 | Debug.WriteLine("INFO: dimmingUpEnd = " & dimmingUpEnd.ToString)
99 |
100 | lblStartTime.Text = "Dimming Start: " & dimmingDownStart.ToString
101 | lblEndTime.Text = "Dimming End: " & dimmingUpEnd.ToString
102 | 'Set start and end times in settings window
103 | End Try
104 | End Sub
105 | #End Region
106 |
107 | #Region "Brightness set/get"
108 | Private Sub SetBrightness(ByVal brightness As Integer, ByVal screen As Integer)
109 | Debug.WriteLine("INFO: Brightness set: " & screen & "," & brightness)
110 | If brightness >= 0 And brightness <= 100 And PhysicalMonitors.Length > 0 Then
111 | Try
112 | MonitorHelper.SetPhysicalMonitorBrightness(PhysicalMonitors(screen - 1), brightness / 100) 'Set the monitor brightness, using the array of physical monitors to refer to each monitor
113 | Catch e As Exception
114 | Debug.WriteLine("BRIGHTNESS SET ERROR: " & e.Message)
115 | DisableTimers() 'Disable all timers
116 | MonitorHelper.DestroyAllPhysicalMonitors(PhysicalMonitors)
117 | PhysicalMonitors = MonitorHelper.GetPhysicalMonitors 'Refetch all monitors
118 | ScheduleTimer.Enabled = True 'Re-enable scheduler
119 | Finally
120 | If InvokeRequired Then
121 | Invoke(New MethodInvoker(Sub() SetMonitorLabelValue(screen))) 'Invoke brightness labal update to run on main thread
122 | Else
123 | SetMonitorLabelValue(screen) 'Set brightness label
124 | End If
125 | End Try
126 | End If
127 | End Sub
128 |
129 | Private Function GetBrightness(ByVal screen As Integer)
130 | Try
131 | Return MonitorHelper.GetPhysicalMonitorBrightness(PhysicalMonitors(screen - 1)) * 100 'Return brightness of specified monitor
132 | Catch e As Exception
133 | Debug.WriteLine("BRIGHTNESS GET ERROR: " & e.Message)
134 | DisableTimers() 'Disable all timers
135 | MonitorHelper.DestroyAllPhysicalMonitors(PhysicalMonitors)
136 | PhysicalMonitors = MonitorHelper.GetPhysicalMonitors 'Refetch all monitors
137 | ScheduleTimer.Enabled = True 'Re-enable scheduler
138 | End Try
139 | End Function
140 |
141 | Private Sub PreviewBrightness_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles PreviewBrightness.DoWork
142 | Dim args() As Integer = DirectCast(e.Argument, Array) 'Fetch array of arguments - only one object can be passed as a parameter
143 | DisablePreview() 'Disable preview buttons to prevent exception from BackgroundWorker trying to run more than once at a time
144 | SetBrightness(args(0), args(2)) 'Set dimmed brightness
145 | Threading.Thread.Sleep(5000) 'Wait
146 | SetBrightness(args(1), args(2)) 'Go back to normal brightness
147 | EnablePreview() 'Re-enable preview buttons
148 | End Sub
149 | #End Region
150 |
151 | #Region "Monitor Config Changing"
152 | Private Sub MonitorConfigChanged()
153 | Debug.WriteLine("INFO: Monitor config change detected")
154 | DisableTimers()
155 | MonitorHelper.DestroyAllPhysicalMonitors(PhysicalMonitors)
156 | PhysicalMonitors = MonitorHelper.GetPhysicalMonitors 'Re-fetch monitors
157 | If PhysicalMonitors.Length > 0 Then 'If at least one monitor is found
158 | ScheduleTimer.Enabled = True 'Re-enable scheduler
159 | UpdateSettings() 'Update displayed settings accordingly
160 | SetInitialMonitorLabelValue() 'Re-set values shown in interface
161 | Else
162 | MsgBox("Error: No monitors detected. Click 'OK' to re-detect monitors. If this error persists, your monitor(s) may not be supported.", MsgBoxStyle.Critical, "AutoBright Error")
163 | MonitorConfigChanged()
164 | End If
165 | End Sub
166 | #End Region
167 |
168 | #Region "Transitions and scheduling"
169 | Private Sub ScheduleTimer_Tick(sender As Object, e As EventArgs) Handles ScheduleTimer.Tick
170 | 'Debug.WriteLine("INFO: Scheduler tick")
171 | If Date.Now >= My.Settings.CivilTwilightEndToday And Date.Now < dimmingDownStart Then 'Daytime
172 | 'Debug.WriteLine("STATE: Daytime")
173 | If My.Settings.EnableExternalProgram = True Then 'Kill background app if option enabled and if it is running
174 | If externalProgramRunning = True Then
175 | If isRunning() = True Then
176 | EndExternalProgram()
177 | externalProgramRunning = False
178 | End If
179 | End If
180 | End If
181 |
182 | Select Case PhysicalMonitors.Length
183 | Case 1
184 | If GetBrightness(1) <> My.Settings.Screen1Normal Then
185 | SetBrightness(My.Settings.Screen1Normal, 1)
186 | End If
187 | Case 2
188 | If GetBrightness(1) <> My.Settings.Screen1Normal Or GetBrightness(2) <> My.Settings.Screen2Normal Then
189 | SetBrightness(My.Settings.Screen1Normal, 1)
190 | SetBrightness(My.Settings.Screen2Normal, 2)
191 | End If
192 | Case 3
193 | If GetBrightness(1) <> My.Settings.Screen1Normal Or GetBrightness(2) <> My.Settings.Screen2Normal Or GetBrightness(3) <> My.Settings.Screen3Normal Then
194 | SetBrightness(My.Settings.Screen1Normal, 1)
195 | SetBrightness(My.Settings.Screen2Normal, 2)
196 | SetBrightness(My.Settings.Screen3Normal, 3)
197 | End If
198 | End Select
199 | NotificationTrayIcon.Icon = My.Resources.AutoBrightIdle
200 | NotificationTrayIcon.Text = "AutoBright - Idle"
201 | ElseIf Date.Now >= dimmingDownEnd And Date.Now < dimmingUpStart Then 'Nightime
202 | 'Debug.WriteLine("STATE: Nightime")
203 | If My.Settings.EnableExternalProgram = True Then 'Start background app if option enabled
204 | If externalProgramRunning = False Then
205 | If Not isRunning() = True Then
206 | StartExternalProgram()
207 | externalProgramRunning = True
208 | End If
209 | End If
210 | End If
211 |
212 | Select Case PhysicalMonitors.Length
213 | Case 1
214 | If GetBrightness(1) <> My.Settings.Screen1Dimmed Then
215 | SetBrightness(My.Settings.Screen1Dimmed, 1)
216 | End If
217 | Case 2
218 | If GetBrightness(1) <> My.Settings.Screen1Dimmed Or GetBrightness(2) <> My.Settings.Screen2Dimmed Then
219 | SetBrightness(My.Settings.Screen1Dimmed, 1)
220 | SetBrightness(My.Settings.Screen2Dimmed, 2)
221 | End If
222 | Case 3
223 | If GetBrightness(1) <> My.Settings.Screen1Dimmed Or GetBrightness(2) <> My.Settings.Screen2Dimmed Or GetBrightness(3) <> My.Settings.Screen3Dimmed Then
224 | SetBrightness(My.Settings.Screen1Dimmed, 1)
225 | SetBrightness(My.Settings.Screen2Dimmed, 2)
226 | SetBrightness(My.Settings.Screen3Dimmed, 3)
227 | End If
228 | End Select
229 | NotificationTrayIcon.Icon = My.Resources.AutoBrightDimming
230 | NotificationTrayIcon.Text = "AutoBright - Dimming"
231 | ElseIf Date.Now >= dimmingUpStart And Date.Now < dimmingUpEnd And transitioning = False Then 'Transition from night to day
232 | 'Debug.WriteLine("STATE: Night->Day")
233 | Select Case PhysicalMonitors.Length
234 | Case 1
235 | If DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) > 0 Then 'No idea why I put these conditions in, but I presume it was to fix a bug, so I'll leave them alone - to prevent timer rate being 0?
236 | TransitionUpTimer1.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) * 1000) / (My.Settings.Screen1Normal - My.Settings.Screen1Dimmed)) 'Set rate of timers so that every time they tick, they decrement the brightness by 1
237 | End If
238 |
239 | TransitionUpTimer1.Enabled = True
240 | Case 2
241 | If DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) > 0 Then
242 | TransitionUpTimer1.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) * 1000) / (My.Settings.Screen1Normal - My.Settings.Screen1Dimmed))
243 | TransitionUpTimer2.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) * 1000) / (My.Settings.Screen2Normal - My.Settings.Screen2Dimmed))
244 | End If
245 |
246 | TransitionUpTimer1.Enabled = True
247 | TransitionUpTimer2.Enabled = True
248 | Case 3
249 | If DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) > 0 Then
250 | TransitionUpTimer1.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) * 1000) / (My.Settings.Screen1Normal - My.Settings.Screen1Dimmed))
251 | TransitionUpTimer2.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) * 1000) / (My.Settings.Screen2Normal - My.Settings.Screen2Dimmed))
252 | TransitionUpTimer3.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingUpEnd) * 1000) / (My.Settings.Screen3Normal - My.Settings.Screen3Dimmed))
253 | End If
254 |
255 | TransitionUpTimer1.Enabled = True
256 | TransitionUpTimer2.Enabled = True
257 | TransitionUpTimer3.Enabled = True
258 | End Select
259 | transitioning = True
260 | NotificationTrayIcon.Icon = My.Resources.AutoBrightDimming
261 | NotificationTrayIcon.Text = "AutoBright - Dimming"
262 | ElseIf Date.Now >= dimmingDownStart And Date.Now < dimmingDownEnd And transitioning = False Then 'Transition from day to night
263 | 'Debug.WriteLine("STATE: Day->Night")
264 | Select Case PhysicalMonitors.Length
265 | Case 1
266 | If DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) > 0 Then
267 | TransitionDownTimer1.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) * 1000) / (My.Settings.Screen1Normal - My.Settings.Screen1Dimmed))
268 | End If
269 |
270 | TransitionDownTimer1.Enabled = True
271 | Case 2
272 | If DateDiff(DateInterval.Second, Date.Now, My.Settings.CivilTwilightStartToday) > 0 Then
273 | TransitionDownTimer1.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) * 1000) / (My.Settings.Screen1Normal - My.Settings.Screen1Dimmed))
274 | TransitionDownTimer2.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) * 1000) / (My.Settings.Screen2Normal - My.Settings.Screen2Dimmed))
275 | End If
276 |
277 | TransitionDownTimer1.Enabled = True
278 | TransitionDownTimer2.Enabled = True
279 | Case 3
280 | If DateDiff(DateInterval.Second, Date.Now, My.Settings.CivilTwilightStartToday) > 0 Then
281 | TransitionDownTimer1.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) * 1000) / (My.Settings.Screen1Normal - My.Settings.Screen1Dimmed))
282 | TransitionDownTimer2.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) * 1000) / (My.Settings.Screen2Normal - My.Settings.Screen2Dimmed))
283 | TransitionDownTimer3.Interval = Math.Floor((DateDiff(DateInterval.Second, Date.Now, dimmingDownEnd) * 1000) / (My.Settings.Screen3Normal - My.Settings.Screen3Dimmed))
284 | End If
285 |
286 | TransitionDownTimer1.Enabled = True
287 | TransitionDownTimer2.Enabled = True
288 | TransitionDownTimer3.Enabled = True
289 | End Select
290 | transitioning = True
291 | NotificationTrayIcon.Icon = My.Resources.AutoBrightDimming
292 | NotificationTrayIcon.Text = "AutoBright - Dimming"
293 | End If
294 | End Sub
295 |
296 | Private Sub TransitionUpTimer1_Tick(sender As Object, e As EventArgs) Handles TransitionUpTimer1.Tick 'Monitor 1 night to day
297 | If GetBrightness(1) < My.Settings.Screen1Normal Then
298 | SetBrightness(GetBrightness(1) + 1, 1) 'Increase brightness by 1
299 |
300 | ElseIf GetBrightness(1) = My.Settings.Screen1Normal Then 'When finished
301 | GetTimes()
302 | UpdateSettings()
303 | 'Refresh times and update settings
304 | transitioning = False 'Flag as no longer transitioning
305 | TransitionUpTimer1.Enabled = False 'Disable this timer
306 | End If
307 | End Sub
308 |
309 | Private Sub TransitionUpTimer2_Tick(sender As Object, e As EventArgs) Handles TransitionUpTimer2.Tick 'Monitor 2 night to day
310 | If GetBrightness(2) < My.Settings.Screen2Normal Then
311 | SetBrightness(GetBrightness(2) + 1, 2)
312 |
313 | ElseIf GetBrightness(2) = My.Settings.Screen2Normal Then
314 | GetTimes()
315 | UpdateSettings()
316 | transitioning = False
317 | TransitionUpTimer2.Enabled = False
318 | End If
319 | End Sub
320 |
321 | Private Sub TransitionUpTimer3_Tick(sender As Object, e As EventArgs) Handles TransitionUpTimer3.Tick 'Monitor 3 night to day
322 | If GetBrightness(3) < My.Settings.Screen3Normal Then
323 | SetBrightness(GetBrightness(3) + 1, 3)
324 |
325 | ElseIf GetBrightness(3) = My.Settings.Screen3Normal Then
326 | GetTimes()
327 | UpdateSettings()
328 | transitioning = False
329 | TransitionUpTimer3.Enabled = False
330 | End If
331 | End Sub
332 |
333 | Private Sub TransitionDownTimer1_Tick(sender As Object, e As EventArgs) Handles TransitionDownTimer1.Tick 'Monitor 1 day to night
334 | If GetBrightness(1) > My.Settings.Screen1Dimmed Then
335 | SetBrightness(GetBrightness(1) - 1, 1) 'Decrease brightness by 1
336 |
337 | ElseIf GetBrightness(1) = My.Settings.Screen1Dimmed Then
338 | transitioning = False
339 | TransitionDownTimer1.Enabled = False
340 | End If
341 | End Sub
342 |
343 | Private Sub TransitionDownTimer2_Tick(sender As Object, e As EventArgs) Handles TransitionDownTimer2.Tick 'Monitor 2 day to night
344 | If GetBrightness(2) > My.Settings.Screen2Dimmed Then
345 | SetBrightness(GetBrightness(2) - 1, 2)
346 |
347 | ElseIf GetBrightness(2) = My.Settings.Screen2Dimmed Then
348 | transitioning = False
349 | TransitionDownTimer2.Enabled = False
350 | End If
351 | End Sub
352 |
353 | Private Sub TransitionDownTimer3_Tick(sender As Object, e As EventArgs) Handles TransitionDownTimer3.Tick 'Monitor 3 day to night
354 | If GetBrightness(3) > My.Settings.Screen3Dimmed Then
355 | SetBrightness(GetBrightness(3) - 1, 3)
356 |
357 | ElseIf GetBrightness(3) = My.Settings.Screen3Dimmed Then
358 | transitioning = False
359 | TransitionDownTimer3.Enabled = False
360 | End If
361 | End Sub
362 |
363 | Private Sub DisableTimers()
364 | Debug.WriteLine("INFO: All timers disabled")
365 | ScheduleTimer.Enabled = False
366 | TransitionDownTimer1.Enabled = False
367 | TransitionDownTimer2.Enabled = False
368 | TransitionDownTimer3.Enabled = False
369 | TransitionUpTimer1.Enabled = False
370 | TransitionUpTimer2.Enabled = False
371 | TransitionUpTimer3.Enabled = False
372 | End Sub
373 |
374 | #End Region
375 |
376 | #Region "Screen 1 Controls"
377 | Private Sub tBarScreen1Normal_ValueChanged(sender As Object, e As EventArgs) Handles tBarScreen1Normal.ValueChanged
378 | If sender.Enabled = True Then
379 | tBoxScreen1Normal.Text = tBarScreen1Normal.Value
380 | 'Update text box
381 | End If
382 | End Sub
383 |
384 | Private Sub tBoxScreen1Normal_TextChanged(sender As Object, e As EventArgs) Handles tBoxScreen1Normal.TextChanged
385 | If CheckValues(tBoxScreen1Normal) And CheckValues(tBoxScreen1Normal) Then
386 | tBarScreen1Normal.Value = tBoxScreen1Normal.Text
387 | 'Update text box
388 | End If
389 | End Sub
390 |
391 | Private Sub tBarScreen1Dimmed_ValueChanged(sender As Object, e As EventArgs) Handles tBarScreen1Dimmed.ValueChanged
392 | If sender.Enabled = True Then
393 | tBoxScreen1Dimmed.Text = tBarScreen1Dimmed.Value
394 | 'Update text box
395 | End If
396 | End Sub
397 |
398 | Private Sub tBoxScreen1Dimmed_TextChanged(sender As Object, e As EventArgs) Handles tBoxScreen1Dimmed.TextChanged
399 | If CheckValues(tBoxScreen1Dimmed) And CheckValues(tBoxScreen1Dimmed) Then
400 | tBarScreen1Dimmed.Value = tBoxScreen1Dimmed.Text
401 | 'Update text box
402 | End If
403 | End Sub
404 |
405 | Private Sub btnScreen1Preview_Click(sender As Object, e As EventArgs) Handles btnScreen1Preview.Click
406 | Dim args As Integer() = {My.Settings.Screen1Dimmed, My.Settings.Screen1Normal, 1} 'Define array of arguments - BackgroundWorkers only accept one object as a parameter
407 | PreviewBrightness.RunWorkerAsync(args) 'Start background worker
408 | End Sub
409 | #End Region
410 |
411 | #Region "Screen 2 Controls"
412 | Private Sub tBarScreen2Normal_ValueChanged(sender As Object, e As EventArgs) Handles tBarScreen2Normal.ValueChanged
413 | If sender.Enabled = True Then
414 | tBoxScreen2Normal.Text = tBarScreen2Normal.Value
415 | 'Update text box
416 | End If
417 | End Sub
418 |
419 | Private Sub tBoxScreen2Normal_TextChanged(sender As Object, e As EventArgs) Handles tBoxScreen2Normal.TextChanged
420 | If CheckValues(tBoxScreen2Normal) And CheckValues(tBoxScreen2Normal) Then
421 | tBarScreen2Normal.Value = tBoxScreen2Normal.Text
422 | 'Update text box
423 | End If
424 | End Sub
425 |
426 | Private Sub tBarScreen2Dimmed_ValueChanged(sender As Object, e As EventArgs) Handles tBarScreen2Dimmed.ValueChanged
427 | If sender.Enabled = True Then
428 | tBoxScreen2Dimmed.Text = tBarScreen2Dimmed.Value
429 | 'Update text box
430 | End If
431 | End Sub
432 |
433 | Private Sub tBoxScreen2Dimmed_TextChanged(sender As Object, e As EventArgs) Handles tBoxScreen2Dimmed.TextChanged
434 | If CheckValues(tBoxScreen2Dimmed) And CheckValues(tBoxScreen2Dimmed) Then
435 | tBarScreen2Dimmed.Value = tBoxScreen2Dimmed.Text
436 | 'Update text box
437 | End If
438 | End Sub
439 |
440 | Private Sub btnScreen2Preview_Click(sender As Object, e As EventArgs) Handles btnScreen2Preview.Click
441 | Dim args As Integer() = {My.Settings.Screen2Dimmed, My.Settings.Screen2Normal, 2} 'Define array of arguments - BackgroundWorkers only accept one object as a parameter
442 | PreviewBrightness.RunWorkerAsync(args) 'Start background worker
443 | End Sub
444 | #End Region
445 |
446 | #Region "Screen 3 Controls"
447 | Private Sub tBarScreen3Normal_ValueChanged(sender As Object, e As EventArgs) Handles tBarScreen3Normal.ValueChanged
448 | If sender.Enabled = True Then
449 | tBoxScreen3Normal.Text = tBarScreen3Normal.Value
450 | My.Settings.Screen3Normal = tBarScreen3Normal.Value
451 | 'Update text box and saved setting
452 | End If
453 | End Sub
454 |
455 | Private Sub tBoxScreen3Normal_TextChanged(sender As Object, e As EventArgs) Handles tBoxScreen3Normal.TextChanged
456 | If CheckValues(tBoxScreen3Normal) And CheckValues(tBoxScreen3Normal) Then
457 | tBarScreen3Normal.Value = tBoxScreen3Normal.Text
458 | End If
459 | End Sub
460 |
461 | Private Sub tBarScreen3Dimmed_ValueChanged(sender As Object, e As EventArgs) Handles tBarScreen3Dimmed.ValueChanged
462 | If sender.Enabled = True Then
463 | tBoxScreen3Dimmed.Text = tBarScreen3Dimmed.Value
464 | 'Update text box
465 | End If
466 | End Sub
467 |
468 | Private Sub tBoxScreen3Dimmed_TextChanged(sender As Object, e As EventArgs) Handles tBoxScreen3Dimmed.TextChanged
469 | If CheckValues(tBoxScreen3Dimmed) And CheckValues(tBoxScreen3Dimmed) Then
470 | tBarScreen3Dimmed.Value = tBoxScreen3Dimmed.Text
471 | End If
472 | End Sub
473 |
474 | Private Sub btnScreen3Preview_Click(sender As Object, e As EventArgs) Handles btnScreen3Preview.Click
475 | Dim args As Integer() = {My.Settings.Screen3Dimmed, My.Settings.Screen3Normal, 3} 'Define array of arguments - BackgroundWorkers only accept one object as a parameter
476 | PreviewBrightness.RunWorkerAsync(args) 'Start background worker
477 | End Sub
478 | #End Region
479 |
480 | #Region "Preview enable/disable"
481 | Private Sub DisablePreview()
482 | gBoxScreen1.Invoke(New MethodInvoker(Sub() gBoxScreen1.Enabled = False))
483 | gBoxScreen2.Invoke(New MethodInvoker(Sub() gBoxScreen2.Enabled = False))
484 | gBoxScreen3.Invoke(New MethodInvoker(Sub() gBoxScreen3.Enabled = False))
485 | Invoke(New MethodInvoker(Sub() ScheduleTimer.Enabled = False))
486 | Debug.WriteLine("INFO: Controls and ScheduleTimer disabled")
487 | End Sub
488 |
489 | Private Sub EnablePreview()
490 | Select Case PhysicalMonitors.Length
491 | Case 1
492 | gBoxScreen1.Invoke(New MethodInvoker(Sub() gBoxScreen1.Enabled = True))
493 | Case 2
494 | gBoxScreen1.Invoke(New MethodInvoker(Sub() gBoxScreen1.Enabled = True))
495 | gBoxScreen2.Invoke(New MethodInvoker(Sub() gBoxScreen2.Enabled = True))
496 | Case 3
497 | gBoxScreen1.Invoke(New MethodInvoker(Sub() gBoxScreen1.Enabled = True))
498 | gBoxScreen2.Invoke(New MethodInvoker(Sub() gBoxScreen2.Enabled = True))
499 | gBoxScreen3.Invoke(New MethodInvoker(Sub() gBoxScreen3.Enabled = True))
500 | End Select
501 | Invoke(New MethodInvoker(Sub() ScheduleTimer.Enabled = True))
502 | Debug.WriteLine("INFO: Controls and ScheduleTimer enabled")
503 | End Sub
504 | #End Region
505 |
506 | #Region "Other UI"
507 | Private Sub UpdateSettings()
508 | Debug.WriteLine("INFO: Updating settings")
509 | #Region "Update screen details"
510 | Select Case PhysicalMonitors.Length
511 | Case 0
512 | DisableTimers()
513 | MsgBox("Error: No supported monitors detected. Sorry, but your monitor(s) may not be supported. Try enabling DDC/CI in your monitor's settings, if there is an option.", 16)
514 | Application.Exit()
515 | 'Disable all transitions, display error message, and exit if no monitors are found
516 | Case 1
517 | gBoxScreen1.Enabled = True
518 | gBoxScreen2.Enabled = False
519 | gBoxScreen3.Enabled = False
520 |
521 | tBoxScreen1Normal.Text = My.Settings.Screen1Normal
522 | tBoxScreen1Dimmed.Text = My.Settings.Screen1Dimmed
523 |
524 | tBoxScreen2Normal.Clear()
525 | tBarScreen2Normal.Value = 0
526 | tBoxScreen2Dimmed.Clear()
527 | tBarScreen2Dimmed.Value = 0
528 |
529 | tBoxScreen3Normal.Clear()
530 | tBarScreen3Normal.Value = 0
531 | tBoxScreen3Dimmed.Clear()
532 | tBarScreen3Dimmed.Value = 0
533 | 'Only enable screen 1 group if 1 screen detected, disable and clear others
534 |
535 | gBoxScreen1.Text = "Screen 1 - " & PhysicalMonitors(0).szPhysicalMonitorDescription.ToString
536 | gBoxScreen2.Text = "Screen 2"
537 | gBoxScreen3.Text = "Screen 3"
538 | 'Set names of monitor
539 | Case 2
540 | gBoxScreen1.Enabled = True
541 | gBoxScreen2.Enabled = True
542 | gBoxScreen3.Enabled = False
543 |
544 | tBoxScreen1Normal.Text = My.Settings.Screen1Normal
545 | tBoxScreen1Dimmed.Text = My.Settings.Screen1Dimmed
546 |
547 | tBoxScreen2Normal.Text = My.Settings.Screen2Normal
548 | tBoxScreen2Dimmed.Text = My.Settings.Screen2Dimmed
549 |
550 | tBoxScreen3Normal.Clear()
551 | tBarScreen3Normal.Value = 0
552 | tBoxScreen3Dimmed.Clear()
553 | tBarScreen3Dimmed.Value = 0
554 | 'Enable screen 1 and 2 groups if 2 screens detected, disable and clear others
555 |
556 | gBoxScreen1.Text = "Screen 1 - " & PhysicalMonitors(0).szPhysicalMonitorDescription.ToString
557 | gBoxScreen2.Text = "Screen 2 - " & PhysicalMonitors(1).szPhysicalMonitorDescription.ToString
558 | gBoxScreen3.Text = "Screen 3"
559 | 'Set names of monitors
560 | Case 3
561 | gBoxScreen1.Enabled = True
562 | gBoxScreen2.Enabled = True
563 | gBoxScreen3.Enabled = True
564 |
565 | tBoxScreen1Normal.Text = My.Settings.Screen1Normal
566 | tBoxScreen1Dimmed.Text = My.Settings.Screen1Dimmed
567 |
568 | tBoxScreen2Normal.Text = My.Settings.Screen2Normal
569 | tBoxScreen2Dimmed.Text = My.Settings.Screen2Dimmed
570 |
571 | tBoxScreen3Normal.Text = My.Settings.Screen3Normal
572 | tBoxScreen3Dimmed.Text = My.Settings.Screen3Dimmed
573 | 'Enable screen 1, 2 and 3 groups if 3 screens detected
574 |
575 | gBoxScreen1.Text = "Screen 1 - " & PhysicalMonitors(0).szPhysicalMonitorDescription.ToString
576 | gBoxScreen2.Text = "Screen 2 - " & PhysicalMonitors(1).szPhysicalMonitorDescription.ToString
577 | gBoxScreen3.Text = "Screen 3 - " & PhysicalMonitors(2).szPhysicalMonitorDescription.ToString
578 | 'Set names of monitors
579 | End Select
580 | #End Region
581 | tBoxTransitionTime.Text = My.Settings.TransitionTime
582 | tBoxOffset.Text = My.Settings.Offset
583 | tBoxLatitude.Text = My.Settings.LocationLatitude
584 | tBoxLongitude.Text = My.Settings.LocationLongitude
585 | frmAdvanced.cBoxExternalProgram.Checked = My.Settings.EnableExternalProgram
586 | frmAdvanced.gBoxExternalProgram.Enabled = My.Settings.EnableExternalProgram
587 | frmAdvanced.tBoxPath.Text = My.Settings.ExternalProgramPath
588 | frmAdvanced.tBoxArg.Text = My.Settings.ExternalProgramArguments
589 | End Sub
590 |
591 | Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
592 | My.Settings.TransitionTime = tBoxTransitionTime.Text
593 | My.Settings.Offset = tBoxOffset.Text
594 | My.Settings.EnableExternalProgram = frmAdvanced.cBoxExternalProgram.CheckState
595 | My.Settings.ExternalProgramPath = frmAdvanced.tBoxPath.Text
596 | My.Settings.ExternalProgramArguments = frmAdvanced.tBoxArg.Text
597 | My.Settings.LocationLatitude = Convert.ToDouble(tBoxLatitude.Text)
598 | My.Settings.LocationLongitude = Convert.ToDouble(tBoxLongitude.Text) 'Save transition time and location
599 | Select Case PhysicalMonitors.Length
600 | Case 1
601 | If Not CheckValues(tBoxScreen1Normal) Or Not CheckValues(tBoxScreen1Dimmed) Then
602 | MsgBox("Error: Invalid brightness entered. Please enter an integer between 0 and 100.", MsgBoxStyle.Critical, "AutoBright Error")
603 | Exit Sub
604 | End If
605 | If Int(tBoxScreen1Dimmed.Text) >= Int(tBoxScreen1Normal.Text) Then 'Prevent saving of invalid settings and display error message
606 | MsgBox("Error: Dimmed brightness cannot be greater than or equal to normal brightness.", MsgBoxStyle.Critical, "AutoBright Error")
607 | Else
608 | My.Settings.Screen1Normal = tBoxScreen1Normal.Text
609 | My.Settings.Screen1Dimmed = tBoxScreen1Dimmed.Text
610 | My.Settings.Save()
611 | GetTimes()
612 | UpdateSettings()
613 | End If
614 | Case 2
615 | If Not CheckValues(tBoxScreen1Normal) Or Not CheckValues(tBoxScreen1Dimmed) Or Not CheckValues(tBoxScreen2Normal) Or Not CheckValues(tBoxScreen2Dimmed) Then
616 | MsgBox("Error: Invalid brightness entered. Please enter an integer between 0 and 100.", MsgBoxStyle.Critical, "AutoBright Error")
617 | Exit Sub
618 | End If
619 | If Int(tBoxScreen1Dimmed.Text) >= Int(tBoxScreen1Normal.Text) Or Int(tBoxScreen2Dimmed.Text) >= Int(tBoxScreen2Normal.Text) Then 'Prevent saving of invalid settings and display error message
620 | MsgBox("Error: Dimmed brightness cannot be greater than or equal to normal brightness.", MsgBoxStyle.Critical, "AutoBright Error")
621 | Else
622 | My.Settings.Screen1Normal = tBoxScreen1Normal.Text
623 | My.Settings.Screen1Dimmed = tBoxScreen1Dimmed.Text
624 | My.Settings.Screen2Normal = tBoxScreen2Normal.Text
625 | My.Settings.Screen2Dimmed = tBoxScreen2Dimmed.Text
626 | My.Settings.Save()
627 | GetTimes()
628 | UpdateSettings()
629 | End If
630 | Case 3
631 | If Not CheckValues(tBoxScreen1Normal) Or Not CheckValues(tBoxScreen1Dimmed) Or Not CheckValues(tBoxScreen2Normal) Or Not CheckValues(tBoxScreen2Dimmed) Or Not CheckValues(tBoxScreen3Normal) Or Not CheckValues(tBoxScreen3Dimmed) Then
632 | MsgBox("Error: Invalid brightness entered. Please enter an integer between 0 and 100.", MsgBoxStyle.Critical, "AutoBright Error")
633 | Exit Sub
634 | End If
635 | If Int(tBoxScreen1Dimmed.Text) >= Int(tBoxScreen1Normal.Text) Or Int(tBoxScreen2Dimmed.Text) >= Int(tBoxScreen2Normal.Text) Or Int(tBoxScreen3Dimmed.Text) >= Int(tBoxScreen3Normal.Text) Then 'Prevent saving of invalid settings and display error message
636 | MsgBox("Error: Dimmed brightness cannot be greater than or equal to normal brightness.", MsgBoxStyle.Critical, "AutoBright Error")
637 | Else
638 | My.Settings.Screen1Normal = tBoxScreen1Normal.Text
639 | My.Settings.Screen1Dimmed = tBoxScreen1Dimmed.Text
640 | My.Settings.Screen2Normal = tBoxScreen2Normal.Text
641 | My.Settings.Screen2Dimmed = tBoxScreen2Dimmed.Text
642 | My.Settings.Screen3Normal = tBoxScreen3Normal.Text
643 | My.Settings.Screen3Dimmed = tBoxScreen3Dimmed.Text
644 | My.Settings.Save()
645 | GetTimes()
646 | UpdateSettings()
647 | End If
648 | End Select
649 | Debug.WriteLine("INFO: Settings saved")
650 | End Sub
651 |
652 | Private Sub btnAdvanced_Click(sender As Object, e As EventArgs) Handles btnAdvanced.Click
653 | frmAdvanced.ShowDialog()
654 | End Sub
655 |
656 | Private Function CheckValues(tBox As TextBox)
657 | If Not String.IsNullOrEmpty(tBox.Text) Then
658 | If tBox.Text >= 0 And tBox.Text <= 100 Then
659 | Return True 'Return true if number valid
660 | End If
661 | End If
662 | Return False 'Else return false
663 | End Function
664 |
665 | Private Sub SetMonitorLabelValue(screen As Integer) 'Sets the label value in user interface when brightness is changed
666 | Select Case screen
667 | Case 1
668 | lblScreen1Brightness.Text = "Screen 1 Current Brightness: " & GetBrightness(1) & "%"
669 | Case 2
670 | lblScreen2Brightness.Text = "Screen 2 Current Brightness: " & GetBrightness(2) & "%"
671 | Case 3
672 | lblScreen3Brightness.Text = "Screen 3 Current Brightness: " & GetBrightness(3) & "%"
673 | End Select
674 | End Sub
675 |
676 | Private Sub SetInitialMonitorLabelValue()
677 | Select Case PhysicalMonitors.Length
678 | Case 1
679 | lblScreen1Brightness.Enabled = True
680 | lblScreen2Brightness.Enabled = False
681 | lblScreen3Brightness.Enabled = False
682 | SetMonitorLabelValue(1)
683 | Case 2
684 | lblScreen1Brightness.Enabled = True
685 | lblScreen2Brightness.Enabled = True
686 | lblScreen3Brightness.Enabled = False
687 | SetMonitorLabelValue(1)
688 | SetMonitorLabelValue(2)
689 | Case 3
690 | lblScreen1Brightness.Enabled = True
691 | lblScreen2Brightness.Enabled = True
692 | lblScreen3Brightness.Enabled = True
693 | SetMonitorLabelValue(1)
694 | SetMonitorLabelValue(2)
695 | SetMonitorLabelValue(3) 'Enable and set values for appropriate labels
696 | End Select
697 | End Sub
698 |
699 | Private Sub IntegerTBoxHandler(sender As Object, e As KeyPressEventArgs)
700 | If (Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 8 Then
701 | My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep)
702 | e.Handled = True
703 | End If
704 | 'Only allow numbers to be entered - 48-57 are numbers, 8 is backspace
705 | End Sub
706 |
707 | Private Sub NegIntegerTBoxHandler(sender As Object, e As KeyPressEventArgs)
708 | If (Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 45 Then
709 | My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep)
710 | e.Handled = True
711 | End If
712 | 'Only allow numbers to be entered - 48-57 are numbers, 8 is backspace, 45 is minus
713 | End Sub
714 |
715 | Private Sub DecimalTBoxHandler(sender As Object, e As KeyPressEventArgs)
716 | If (Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57) And Asc(e.KeyChar) <> 8 And Asc(e.KeyChar) <> 46 And Asc(e.KeyChar) <> 45 Or (sender.Text.Contains(".") And Asc(e.KeyChar) = 46) Or (sender.Text.Contains("-") And Asc(e.KeyChar) = 45) Then
717 | My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep)
718 | e.Handled = True
719 | End If
720 | 'Only allow decimals (with one decimal point) to be entered - 48-57 are numbers, 8 is backspace, 46 is decimal point, 45 is minus
721 | End Sub
722 |
723 | Private Sub btnAbout_Click(sender As Object, e As EventArgs) Handles btnAbout.Click
724 | frmAbout.ShowDialog()
725 | End Sub
726 |
727 | Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
728 | UpdateSettings()
729 | Me.WindowState = FormWindowState.Minimized
730 | Me.Visible = False
731 | Me.ShowInTaskbar = False
732 | NotificationTrayIcon.Visible = True
733 | End Sub
734 |
735 | #End Region
736 |
737 | #Region "Notification Tray and closing"
738 | Private Sub NotificationTrayIcon_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles NotificationTrayIcon.MouseDoubleClick
739 | Me.Show()
740 | Me.WindowState = FormWindowState.Normal
741 | Me.ShowInTaskbar = True 'Show window on double click of icon
742 | End Sub
743 |
744 | Private Sub Settings_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing
745 | If e.CloseReason = CloseReason.UserClosing Then
746 | UpdateSettings() 'Reset any changes made by user
747 | Me.WindowState = FormWindowState.Minimized
748 | Me.Visible = False
749 | Me.ShowInTaskbar = False
750 | NotificationTrayIcon.Visible = True
751 | e.Cancel = True
752 | 'Minimize to tray if invoked by user through UI
753 | ElseIf e.CloseReason = CloseReason.ApplicationExitCall Or e.CloseReason = CloseReason.None Or e.CloseReason = CloseReason.TaskManagerClosing Or e.CloseReason = CloseReason.WindowsShutDown Then
754 | Select Case PhysicalMonitors.Length
755 | Case 1
756 | SetBrightness(My.Settings.Screen1Normal, 1)
757 | Case 2
758 | SetBrightness(My.Settings.Screen1Normal, 1)
759 | SetBrightness(My.Settings.Screen2Normal, 2)
760 | Case 3
761 | SetBrightness(My.Settings.Screen1Normal, 1)
762 | SetBrightness(My.Settings.Screen2Normal, 2)
763 | SetBrightness(My.Settings.Screen3Normal, 3)
764 | End Select
765 | 'Reset brightness if actually closing
766 | MonitorHelper.DestroyAllPhysicalMonitors(PhysicalMonitors) 'when the form is closing you must destroy the PHYSICAL_MONITOR structures in the unmanaged memory
767 | EndExternalProgram()
768 | End If
769 | End Sub
770 |
771 | Private Sub SettingsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SettingsToolStripMenuItem.Click
772 | Me.Show()
773 | Me.WindowState = FormWindowState.Normal
774 | Me.ShowInTaskbar = True
775 | End Sub
776 |
777 | Private Sub DisableToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DisableToolStripMenuItem.Click
778 | DisableToolStripMenuItem.Checked = Not DisableToolStripMenuItem.Checked
779 | If DisableToolStripMenuItem.Checked = True Then
780 | DisableTimers()
781 | EndExternalProgram()
782 | Select Case PhysicalMonitors.Length
783 | Case 1
784 | SetBrightness(My.Settings.Screen1Normal, 1)
785 | Case 2
786 | SetBrightness(My.Settings.Screen1Normal, 1)
787 | SetBrightness(My.Settings.Screen2Normal, 2)
788 | Case 3
789 | SetBrightness(My.Settings.Screen1Normal, 1)
790 | SetBrightness(My.Settings.Screen2Normal, 2)
791 | SetBrightness(My.Settings.Screen3Normal, 3)
792 | End Select
793 | NotificationTrayIcon.Icon = My.Resources.AutoBrightDisabled
794 | NotificationTrayIcon.Text = "AutoBright - Disabled"
795 | ElseIf DisableToolStripMenuItem.Checked = False Then
796 | ScheduleTimer.Enabled = True
797 | NotificationTrayIcon.Icon = My.Resources.AutoBrightIdle
798 | NotificationTrayIcon.Text = "AutoBright - Idle"
799 | End If
800 | Debug.WriteLine("INFO: Autobright Enabled: " & (Not DisableToolStripMenuItem.Checked).ToString)
801 | End Sub
802 |
803 | Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
804 | Select Case PhysicalMonitors.Length
805 | Case 1
806 | SetBrightness(My.Settings.Screen1Normal, 1)
807 | Case 2
808 | SetBrightness(My.Settings.Screen1Normal, 1)
809 | SetBrightness(My.Settings.Screen2Normal, 2)
810 | Case 3
811 | SetBrightness(My.Settings.Screen1Normal, 1)
812 | SetBrightness(My.Settings.Screen2Normal, 2)
813 | SetBrightness(My.Settings.Screen3Normal, 3)
814 | End Select
815 | MonitorHelper.DestroyAllPhysicalMonitors(PhysicalMonitors) 'when the form is closing you must destroy the PHYSICAL_MONITOR structures in the unmanaged memory
816 | EndExternalProgram()
817 | Application.Exit()
818 | End Sub
819 | #End Region
820 |
821 | #Region "External program"
822 | Private Function isRunning()
823 | If Process.GetProcessesByName(Path.GetFileNameWithoutExtension(My.Settings.ExternalProgramPath)).Count > 0 Then
824 | Debug.WriteLine("INFO: External program currently running")
825 | Return True
826 | Else
827 | Debug.WriteLine("INFO: External program currently not running")
828 | Return False
829 | End If
830 | End Function
831 |
832 | Private Sub StartExternalProgram()
833 | Debug.WriteLine("INFO: Starting external program")
834 | externalProgramRunning = True
835 | Dim externalProgram = New Process
836 | externalProgram.StartInfo = New ProcessStartInfo() With {
837 | .WorkingDirectory = IO.Path.GetDirectoryName(My.Settings.ExternalProgramPath),
838 | .FileName = My.Settings.ExternalProgramPath,
839 | .Arguments = My.Settings.ExternalProgramArguments}
840 |
841 | externalProgram.Start() 'Run process to kill downloader process and any child processes
842 | End Sub
843 |
844 | Private Sub EndExternalProgram()
845 | Debug.WriteLine("INFO: Killing background process")
846 | externalProgramRunning = False
847 | Dim processKiller = New Process
848 | processKiller.StartInfo = New ProcessStartInfo() With {
849 | .WorkingDirectory = "C:\Windows\system32",
850 | .FileName = "C:\Windows\System32\taskkill.exe",
851 | .Arguments = "/f /im " & Path.GetFileName(My.Settings.ExternalProgramPath),
852 | .CreateNoWindow = True,
853 | .UseShellExecute = False}
854 |
855 | processKiller.Start() 'Run process to kill downloader process and any child processes
856 | End Sub
857 | #End Region
858 |
859 | End Class
860 |
861 |
--------------------------------------------------------------------------------
/Images/AutoBrightDimming.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightDimming.ico
--------------------------------------------------------------------------------
/Images/AutoBrightDimming.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightDimming.png
--------------------------------------------------------------------------------
/Images/AutoBrightDimming.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightDimming.psd
--------------------------------------------------------------------------------
/Images/AutoBrightDisabled.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightDisabled.ico
--------------------------------------------------------------------------------
/Images/AutoBrightDisabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightDisabled.png
--------------------------------------------------------------------------------
/Images/AutoBrightDisabled.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightDisabled.psd
--------------------------------------------------------------------------------
/Images/AutoBrightIdle.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightIdle.ico
--------------------------------------------------------------------------------
/Images/AutoBrightIdle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightIdle.png
--------------------------------------------------------------------------------
/Images/AutoBrightIdle.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jamerst/AutoBright/6b284acf0d982680d764b8fc1465082cd34a9199/Images/AutoBrightIdle.psd
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 jamerst
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AutoBright
[](https://github.com/jamerst/AutoBright/releases) [](https://github.com/jamerst/AutoBright/releases) [](https://github.com/jamerst/AutoBright/issues)
2 |
3 | ### Scheduled DDC/CI display dimming for Windows
4 |
5 | ## Features
6 | - Live scheduling based on civil twilight times at a given location
7 | - Support for up to 3 displays (easily expandable)
8 | - ~~Terrible code~~ *Who said that?!*
9 | - External program integration
10 |
11 | ## Limitations
12 | - Monitors must support DDC/CI properly. Some can be a bit odd, or just not support it at all.
13 | - Monitor support for DDC/CI cannot be checked as there is a bug in the Windows API that returns false results for checking support. *Thanks Microsoft*
14 | - Brightness settings are not tied to specific monitors, the settings are tied to the current monitor number recognized by the system.
15 |
16 | ## Download
17 | Downloads can be found [here](https://github.com/jamerst/AutoBright/releases)
18 |
19 | ## Attributions
20 | - DDC/CI control provided by [BrightnessControl](https://github.com/alexhorn/BrightnessControl).
21 | - Scheduling times provided by [sunrise-sunset.org](https://sunrise-sunset.org/)'s free API.
22 | - Special thanks to IronRazer of the DreamInCode forums for assistance with the implementation of BrightnessControl.
23 |
--------------------------------------------------------------------------------
/reources.designer:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("AutoBright.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 |
63 | '''
64 | ''' Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
65 | '''
66 | Friend ReadOnly Property AutoBrightDimming() As System.Drawing.Icon
67 | Get
68 | Dim obj As Object = ResourceManager.GetObject("AutoBrightDimming", resourceCulture)
69 | Return CType(obj,System.Drawing.Icon)
70 | End Get
71 | End Property
72 |
73 | '''
74 | ''' Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
75 | '''
76 | Friend ReadOnly Property AutoBrightDisabled() As System.Drawing.Icon
77 | Get
78 | Dim obj As Object = ResourceManager.GetObject("AutoBrightDisabled", resourceCulture)
79 | Return CType(obj,System.Drawing.Icon)
80 | End Get
81 | End Property
82 |
83 | '''
84 | ''' Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
85 | '''
86 | Friend ReadOnly Property AutoBrightIdle() As System.Drawing.Icon
87 | Get
88 | Dim obj As Object = ResourceManager.GetObject("AutoBrightIdle", resourceCulture)
89 | Return CType(obj,System.Drawing.Icon)
90 | End Get
91 | End Property
92 |
93 | '''
94 | ''' Looks up a localized resource of type System.Drawing.Bitmap.
95 | '''
96 | Friend ReadOnly Property AutoBrightIdle1() As System.Drawing.Bitmap
97 | Get
98 | Dim obj As Object = ResourceManager.GetObject("AutoBrightIdle1", resourceCulture)
99 | Return CType(obj,System.Drawing.Bitmap)
100 | End Get
101 | End Property
102 | End Module
103 | End Namespace
104 |
--------------------------------------------------------------------------------