Skip to content

Commit 1fa08e1

Browse files
committed
✅ Upload Version 1.1.0
* Added App Configuration (Configuration.json) - You can dynamically customize the [File] menu * Fixed ShowHome() - Rebuilding the WebView gadget is no longer required
1 parent 9ee742a commit 1fa08e1

File tree

9 files changed

+143
-215
lines changed

9 files changed

+143
-215
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ web_modules/
5151
# Optional npm cache directory
5252
.npm
5353

54+
# Optional npm lock file
55+
*-lock.json
56+
5457
# Optional eslint cache
5558
.eslintcache
5659

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Version 1.1.0:
2+
* Added App Configuration (Configuration.json) - You can dynamically customize the [File] menu
3+
* Fixed ShowHome() - Rebuilding the WebView gadget is no longer required
4+
5+
Version 1.0.0:
6+
Initial Version

Configuration.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"Menus": [
3+
{
4+
"OpenIn": "browser",
5+
"Url" : "https://www.tugi.ch",
6+
"Title" : "My Website"
7+
},
8+
{
9+
"OpenIn": "process",
10+
"Url" : "ms-quick-assist://",
11+
"Title" : "Start Quick Assist"
12+
},
13+
{
14+
"OpenIn": "process",
15+
"Url" : "https://download.teamviewer.com/download/TeamViewerQS_x64.exe",
16+
"Title" : "Start TeamViewer Quick Assist"
17+
}
18+
],
19+
"Version" : "1.1.0"
20+
}

Forms/MainWindow.pbf

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,20 @@ Global MainWindow
1111

1212
Global WebView_Index
1313

14-
Enumeration FormMenu
15-
#MenuItem_StartQuickAssist
16-
#MenuItem_StartTeamViewerQS
17-
#MenuItem_QuitApplication
18-
#MenuItem_Home
19-
EndEnumeration
20-
2114
Declare ResizeGadgetsMainWindow()
2215

23-
Declare QuitApplication(Event)
24-
Declare WebView_Home(Event)
25-
Declare StartTeamViewerQS(Event)
26-
Declare StartQuickAssist(Event)
2716

2817
Procedure OpenMainWindow(x = 0, y = 0, width = 1400, height = 950)
2918
MainWindow = OpenWindow(#PB_Any, x, y, width, height, "Supportcenter", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
3019
SetWindowColor(MainWindow, RGB(255,255,255))
31-
CreateMenu(0, WindowID(MainWindow))
32-
MenuTitle("File")
33-
MenuItem(#MenuItem_StartQuickAssist, "Start Quick Assist")
34-
MenuItem(#MenuItem_StartTeamViewerQS, "Start TeamViewer QuickAssist")
35-
MenuBar()
36-
MenuItem(#MenuItem_QuitApplication, "Quit")
37-
MenuTitle("Browse")
38-
MenuItem(#MenuItem_Home, "Home")
3920
WebView_Index = WebViewGadget(#PB_Any, 0, 0, 1400, 928)
4021
EndProcedure
4122

4223
Procedure ResizeGadgetsMainWindow()
4324
Protected FormWindowWidth, FormWindowHeight
4425
FormWindowWidth = WindowWidth(MainWindow)
4526
FormWindowHeight = WindowHeight(MainWindow)
46-
ResizeGadget(WebView_Index, 0, 0, FormWindowWidth - 0, FormWindowHeight - MenuHeight() - 0)
27+
ResizeGadget(WebView_Index, 0, 0, FormWindowWidth - 0, FormWindowHeight - 22)
4728
EndProcedure
4829

4930
Procedure MainWindow_Events(event)
@@ -55,14 +36,6 @@ Procedure MainWindow_Events(event)
5536

5637
Case #PB_Event_Menu
5738
Select EventMenu()
58-
Case #MenuItem_StartQuickAssist
59-
StartQuickAssist(EventMenu())
60-
Case #MenuItem_StartTeamViewerQS
61-
StartTeamViewerQS(EventMenu())
62-
Case #MenuItem_QuitApplication
63-
QuitApplication(EventMenu())
64-
Case #MenuItem_Home
65-
WebView_Home(EventMenu())
6639
EndSelect
6740

6841
Case #PB_Event_Gadget

Installer/Supportcenter.aip

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
<ROW Property="ARPPRODUCTICON" Value="Supportcenter.exe" Type="8"/>
1212
<ROW Property="LIMITUI" MultiBuildValue="DefaultBuild:1"/>
1313
<ROW Property="Manufacturer" Value="My Company"/>
14-
<ROW Property="ProductCode" Value="1033:{1A0EFBF5-E4C3-4235-B837-6A59E1F1C638} " Type="16"/>
14+
<ROW Property="ProductCode" Value="1033:{6AABAFCC-1E9D-43C2-AD20-9DFEAB29B020} " Type="16"/>
1515
<ROW Property="ProductLanguage" Value="1033"/>
1616
<ROW Property="ProductName" Value="Supportcenter"/>
17-
<ROW Property="ProductVersion" Value="1.0.0" Options="32"/>
17+
<ROW Property="ProductVersion" Value="1.1.0" Options="32"/>
1818
<ROW Property="REBOOT" MultiBuildValue="DefaultBuild:ReallySuppress"/>
1919
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
2020
<ROW Property="UpgradeCode" Value="{E607F0F5-D6CC-41FA-A36A-CBF9FF3D334D}"/>
@@ -67,6 +67,7 @@
6767
<ROW File="index.html" Component_="index.html" FileName="INDEX~1.HTM|index.html" Attributes="0" SourcePath="..\Web\src\index.html" SelfReg="false"/>
6868
<ROW File="Supportcenter.ico" Component_="Supportcenter.ico" FileName="SUPPOR~1.ICO|Supportcenter.ico" Attributes="0" SourcePath="..\Supportcenter.ico" SelfReg="false"/>
6969
<ROW File="logo.png" Component_="background.jpg" FileName="logo.png" Attributes="0" SourcePath="..\Web\src\images\logo.png" SelfReg="false"/>
70+
<ROW File="Configuration.json" Component_="Supportcenter.ico" FileName="CONFIG~1.JSO|Configuration.json" Attributes="0" SourcePath="..\Configuration.json" SelfReg="false"/>
7071
</COMPONENT>
7172
<COMPONENT cid="caphyon.advinst.msicomp.BootstrOptComponent">
7273
<ROW BootstrOptKey="GlobalOptions" DownloadFolder="[AppDataFolder][|Manufacturer]\[|ProductName]\prerequisites" Options="2"/>

Supportcenter.exe

83 KB
Binary file not shown.

Supportcenter.pb

Lines changed: 84 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,28 @@ EnableExplicit
1111
UsePNGImageDecoder()
1212

1313
;------------------------------------------------------------------------------------
14-
;- Variables, Enumerations and Maps
14+
;- Structures
15+
;------------------------------------------------------------------------------------
16+
Structure Menu
17+
OpenIn.s
18+
Url.s
19+
Title.s
20+
EndStructure
21+
22+
Structure Configuration
23+
List Menus.Menu()
24+
EndStructure
25+
26+
;------------------------------------------------------------------------------------
27+
;- Variables, Enumerations, Lists and Maps
1528
;------------------------------------------------------------------------------------
1629
Global Event = #Null, Quit = #False
30+
Global Customization.Configuration
31+
#JSON_Parser = 0
32+
33+
; Files
1734
Global IndexFile.s = "file://" + GetCurrentDirectory() + "Web/src/index.html"
18-
Global TeamViewerQuickSupport.s = "https://download.teamviewer.com/download/TeamViewerQS_x64.exe"
35+
Global ConfigurationFile.s = GetCurrentDirectory() + "Configuration.json"
1936

2037
;------------------------------------------------------------------------------------
2138
;- Forms
@@ -31,35 +48,81 @@ Procedure ShowMainWindow()
3148
BindEvent(#PB_Event_SizeWindow, @ResizeGadgetsMainWindow(), MainWindow)
3249
EndProcedure
3350

34-
Procedure ShowHome()
35-
SetGadgetText(WebView_Index, IndexFile)
51+
Procedure LoadConfiguration()
52+
If LoadJSON(#JSON_Parser, ConfigurationFile)
53+
;Debug "JSON object data from file:"
54+
;Debug ComposeJSON(#JSON_Parser, #PB_JSON_PrettyPrint)
55+
ExtractJSONStructure(JSONValue(#JSON_Parser), Customization, Configuration)
56+
FreeJSON(#JSON_Parser)
57+
Else
58+
Debug "Can't read the configuration or the file is empty: " + ConfigurationFile
59+
EndIf
3660
EndProcedure
3761

38-
Procedure WebView_Home(EventType)
39-
Debug "Inject JavaScript in WebView..."
40-
FreeGadget(WebView_Index)
41-
WebView_Index = WebViewGadget(#PB_Any, 0, 0, WindowWidth(MainWindow), WindowHeight(MainWindow)-3, #PB_WebView_Debug)
42-
ShowHome()
62+
Procedure WebView_Home()
63+
Debug "WebView: Show Local File: " + IndexFile
64+
If IsGadget(WebView_Index) : SetGadgetText(WebView_Index, IndexFile) : EndIf
4365
EndProcedure
4466

45-
Procedure StartQuickAssist(EventType)
46-
Debug "Starting Microsoft Quick Assist by Protocol..."
47-
RunProgram("ms-quick-assist://")
67+
Procedure Menu_Quit()
68+
End
4869
EndProcedure
4970

50-
Procedure StartTeamViewerQS(EventType)
51-
RunProgram(TeamViewerQuickSupport)
71+
Procedure Menu_EventHandler()
72+
Protected Entry = EventGadget(), i = 1
73+
Protected OpenIn.s, Url.s
74+
75+
ForEach Customization\Menus()
76+
If Entry = i
77+
OpenIn = Customization\Menus()\OpenIn
78+
Url = Customization\Menus()\Url
79+
EndIf
80+
81+
; Counter
82+
i+1
83+
Next
84+
85+
Debug "Open-in ("+OpenIn+") with url: " + Url
86+
Select OpenIn
87+
Case "process":
88+
RunProgram(Url)
89+
Case "browser":
90+
If IsGadget(WebView_Index) : SetGadgetText(WebView_Index, Url) : EndIf
91+
EndSelect
92+
5293
EndProcedure
5394

54-
Procedure QuitApplication(EventType)
55-
End
95+
Procedure BuildMenu()
96+
Protected i = 1
97+
98+
If CreateMenu(0, WindowID(MainWindow))
99+
MenuTitle("File")
100+
101+
ForEach Customization\Menus()
102+
MenuItem(i, Customization\Menus()\Title)
103+
BindMenuEvent(0, i, @Menu_EventHandler())
104+
105+
; Counter
106+
i+1
107+
Next
108+
109+
MenuBar()
110+
MenuItem(98, "&Quit")
111+
BindMenuEvent(0, 98, @Menu_Quit())
112+
113+
MenuTitle("Browse")
114+
MenuItem(99, "Home")
115+
BindMenuEvent(0, 99, @WebView_Home())
116+
EndIf
56117
EndProcedure
57118

58119
;------------------------------------------------------------------------------------
59120
;- Main Loop
60121
;------------------------------------------------------------------------------------
61122
ShowMainWindow()
62-
ShowHome()
123+
LoadConfiguration()
124+
BuildMenu()
125+
WebView_Home()
63126

64127
;------------------------------------------------------------------------------------
65128
;- Event Loop
@@ -77,9 +140,10 @@ Repeat
77140
EndSelect
78141

79142
Until Quit = #True
143+
80144
; IDE Options = PureBasic 6.10 LTS (Windows - x64)
81-
; CursorPosition = 47
82-
; FirstLine = 22
83-
; Folding = --
145+
; CursorPosition = 89
146+
; FirstLine = 44
147+
; Folding = 1-
84148
; EnableXP
85149
; DPIAware

Supportcenter.pbp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,28 @@
77
<section name="data">
88
<explorer view="..\..\..\ProgramData\PureBasic\Examples\" pattern="0"/>
99
<log show="1"/>
10-
<lastopen date="2024-05-19 12:23" user="Tugay" host="TUGI-DESKTOP"/>
10+
<lastopen date="2024-05-26 17:51" user="Tugay" host="TUGI-DESKTOP"/>
1111
</section>
1212
<section name="files">
1313
<file name="Supportcenter.pb">
1414
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="1" panelstate="+"/>
15-
<fingerprint md5="2b12b374644c5c0e9c4aa740e1c7fc4f"/>
15+
<fingerprint md5="d4a05038b9b35e4316121ef5ea834d45"/>
16+
</file>
17+
<file name="CHANGES.txt">
18+
<config load="0" scan="0" panel="1" warn="1" lastopen="1" sortindex="2" panelstate="+"/>
19+
<fingerprint md5="f83a8eb648d7a87d659b32452a9d72e0"/>
1620
</file>
1721
<file name="Forms\MainWindow.pbf">
18-
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="2" panelstate="++"/>
19-
<fingerprint md5="9ac02c31941997da2d9397264accc6df"/>
22+
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="3" panelstate="++"/>
23+
<fingerprint md5="7cecdeb7ec99f110b03fec23ec4d7d94"/>
24+
</file>
25+
<file name="LICENSE">
26+
<config load="0" scan="0" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
27+
<fingerprint md5="ff827bc1c2042220745ff56c6f4755c6"/>
28+
</file>
29+
<file name="README.md">
30+
<config load="0" scan="0" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
31+
<fingerprint md5="e89b3fd77fa17024fe5795bd0d69dfc1"/>
2032
</file>
2133
</section>
2234
<section name="targets">
@@ -27,10 +39,10 @@
2739
<options thread="1" xpskin="1" dpiaware="1" debug="1" optimizer="0"/>
2840
<icon enable="1">Supportcenter.ico</icon>
2941
<versioninfo enable="1">
30-
<field0 value="1.0.0.0"/>
31-
<field1 value="1.0.0.0"/>
32-
<field4 value="1.0.0.0"/>
33-
<field5 value="1.0.0.0"/>
42+
<field0 value="1.1.0.0"/>
43+
<field1 value="1.1.0.0"/>
44+
<field4 value="1.1.0.0"/>
45+
<field5 value="1.1.0.0"/>
3446
</versioninfo>
3547
</target>
3648
</section>

0 commit comments

Comments
 (0)