Skip to content

Commit

Permalink
✅ Upload Version 1.1.0
Browse files Browse the repository at this point in the history
* Added App Configuration (Configuration.json) - You can dynamically customize the [File] menu
* Fixed ShowHome() - Rebuilding the WebView gadget is no longer required
  • Loading branch information
tugich committed May 26, 2024
1 parent 9ee742a commit 1fa08e1
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 215 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ web_modules/
# Optional npm cache directory
.npm

# Optional npm lock file
*-lock.json

# Optional eslint cache
.eslintcache

Expand Down
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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

Version 1.0.0:
Initial Version
20 changes: 20 additions & 0 deletions Configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Menus": [
{
"OpenIn": "browser",
"Url" : "https://www.tugi.ch",
"Title" : "My Website"
},
{
"OpenIn": "process",
"Url" : "ms-quick-assist://",
"Title" : "Start Quick Assist"
},
{
"OpenIn": "process",
"Url" : "https://download.teamviewer.com/download/TeamViewerQS_x64.exe",
"Title" : "Start TeamViewer Quick Assist"
}
],
"Version" : "1.1.0"
}
29 changes: 1 addition & 28 deletions Forms/MainWindow.pbf
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,20 @@ Global MainWindow

Global WebView_Index

Enumeration FormMenu
#MenuItem_StartQuickAssist
#MenuItem_StartTeamViewerQS
#MenuItem_QuitApplication
#MenuItem_Home
EndEnumeration

Declare ResizeGadgetsMainWindow()

Declare QuitApplication(Event)
Declare WebView_Home(Event)
Declare StartTeamViewerQS(Event)
Declare StartQuickAssist(Event)

Procedure OpenMainWindow(x = 0, y = 0, width = 1400, height = 950)
MainWindow = OpenWindow(#PB_Any, x, y, width, height, "Supportcenter", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
SetWindowColor(MainWindow, RGB(255,255,255))
CreateMenu(0, WindowID(MainWindow))
MenuTitle("File")
MenuItem(#MenuItem_StartQuickAssist, "Start Quick Assist")
MenuItem(#MenuItem_StartTeamViewerQS, "Start TeamViewer QuickAssist")
MenuBar()
MenuItem(#MenuItem_QuitApplication, "Quit")
MenuTitle("Browse")
MenuItem(#MenuItem_Home, "Home")
WebView_Index = WebViewGadget(#PB_Any, 0, 0, 1400, 928)
EndProcedure

Procedure ResizeGadgetsMainWindow()
Protected FormWindowWidth, FormWindowHeight
FormWindowWidth = WindowWidth(MainWindow)
FormWindowHeight = WindowHeight(MainWindow)
ResizeGadget(WebView_Index, 0, 0, FormWindowWidth - 0, FormWindowHeight - MenuHeight() - 0)
ResizeGadget(WebView_Index, 0, 0, FormWindowWidth - 0, FormWindowHeight - 22)
EndProcedure

Procedure MainWindow_Events(event)
Expand All @@ -55,14 +36,6 @@ Procedure MainWindow_Events(event)

Case #PB_Event_Menu
Select EventMenu()
Case #MenuItem_StartQuickAssist
StartQuickAssist(EventMenu())
Case #MenuItem_StartTeamViewerQS
StartTeamViewerQS(EventMenu())
Case #MenuItem_QuitApplication
QuitApplication(EventMenu())
Case #MenuItem_Home
WebView_Home(EventMenu())
EndSelect

Case #PB_Event_Gadget
Expand Down
5 changes: 3 additions & 2 deletions Installer/Supportcenter.aip
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<ROW Property="ARPPRODUCTICON" Value="Supportcenter.exe" Type="8"/>
<ROW Property="LIMITUI" MultiBuildValue="DefaultBuild:1"/>
<ROW Property="Manufacturer" Value="My Company"/>
<ROW Property="ProductCode" Value="1033:{1A0EFBF5-E4C3-4235-B837-6A59E1F1C638} " Type="16"/>
<ROW Property="ProductCode" Value="1033:{6AABAFCC-1E9D-43C2-AD20-9DFEAB29B020} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="Supportcenter"/>
<ROW Property="ProductVersion" Value="1.0.0" Options="32"/>
<ROW Property="ProductVersion" Value="1.1.0" Options="32"/>
<ROW Property="REBOOT" MultiBuildValue="DefaultBuild:ReallySuppress"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
<ROW Property="UpgradeCode" Value="{E607F0F5-D6CC-41FA-A36A-CBF9FF3D334D}"/>
Expand Down Expand Up @@ -67,6 +67,7 @@
<ROW File="index.html" Component_="index.html" FileName="INDEX~1.HTM|index.html" Attributes="0" SourcePath="..\Web\src\index.html" SelfReg="false"/>
<ROW File="Supportcenter.ico" Component_="Supportcenter.ico" FileName="SUPPOR~1.ICO|Supportcenter.ico" Attributes="0" SourcePath="..\Supportcenter.ico" SelfReg="false"/>
<ROW File="logo.png" Component_="background.jpg" FileName="logo.png" Attributes="0" SourcePath="..\Web\src\images\logo.png" SelfReg="false"/>
<ROW File="Configuration.json" Component_="Supportcenter.ico" FileName="CONFIG~1.JSO|Configuration.json" Attributes="0" SourcePath="..\Configuration.json" SelfReg="false"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.BootstrOptComponent">
<ROW BootstrOptKey="GlobalOptions" DownloadFolder="[AppDataFolder][|Manufacturer]\[|ProductName]\prerequisites" Options="2"/>
Expand Down
Binary file modified Supportcenter.exe
Binary file not shown.
104 changes: 84 additions & 20 deletions Supportcenter.pb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,28 @@ EnableExplicit
UsePNGImageDecoder()

;------------------------------------------------------------------------------------
;- Variables, Enumerations and Maps
;- Structures
;------------------------------------------------------------------------------------
Structure Menu
OpenIn.s
Url.s
Title.s
EndStructure

Structure Configuration
List Menus.Menu()
EndStructure

;------------------------------------------------------------------------------------
;- Variables, Enumerations, Lists and Maps
;------------------------------------------------------------------------------------
Global Event = #Null, Quit = #False
Global Customization.Configuration
#JSON_Parser = 0

; Files
Global IndexFile.s = "file://" + GetCurrentDirectory() + "Web/src/index.html"
Global TeamViewerQuickSupport.s = "https://download.teamviewer.com/download/TeamViewerQS_x64.exe"
Global ConfigurationFile.s = GetCurrentDirectory() + "Configuration.json"

;------------------------------------------------------------------------------------
;- Forms
Expand All @@ -31,35 +48,81 @@ Procedure ShowMainWindow()
BindEvent(#PB_Event_SizeWindow, @ResizeGadgetsMainWindow(), MainWindow)
EndProcedure

Procedure ShowHome()
SetGadgetText(WebView_Index, IndexFile)
Procedure LoadConfiguration()
If LoadJSON(#JSON_Parser, ConfigurationFile)
;Debug "JSON object data from file:"
;Debug ComposeJSON(#JSON_Parser, #PB_JSON_PrettyPrint)
ExtractJSONStructure(JSONValue(#JSON_Parser), Customization, Configuration)
FreeJSON(#JSON_Parser)
Else
Debug "Can't read the configuration or the file is empty: " + ConfigurationFile
EndIf
EndProcedure

Procedure WebView_Home(EventType)
Debug "Inject JavaScript in WebView..."
FreeGadget(WebView_Index)
WebView_Index = WebViewGadget(#PB_Any, 0, 0, WindowWidth(MainWindow), WindowHeight(MainWindow)-3, #PB_WebView_Debug)
ShowHome()
Procedure WebView_Home()
Debug "WebView: Show Local File: " + IndexFile
If IsGadget(WebView_Index) : SetGadgetText(WebView_Index, IndexFile) : EndIf
EndProcedure

Procedure StartQuickAssist(EventType)
Debug "Starting Microsoft Quick Assist by Protocol..."
RunProgram("ms-quick-assist://")
Procedure Menu_Quit()
End
EndProcedure

Procedure StartTeamViewerQS(EventType)
RunProgram(TeamViewerQuickSupport)
Procedure Menu_EventHandler()
Protected Entry = EventGadget(), i = 1
Protected OpenIn.s, Url.s

ForEach Customization\Menus()
If Entry = i
OpenIn = Customization\Menus()\OpenIn
Url = Customization\Menus()\Url
EndIf

; Counter
i+1
Next

Debug "Open-in ("+OpenIn+") with url: " + Url
Select OpenIn
Case "process":
RunProgram(Url)
Case "browser":
If IsGadget(WebView_Index) : SetGadgetText(WebView_Index, Url) : EndIf
EndSelect

EndProcedure

Procedure QuitApplication(EventType)
End
Procedure BuildMenu()
Protected i = 1

If CreateMenu(0, WindowID(MainWindow))
MenuTitle("File")

ForEach Customization\Menus()
MenuItem(i, Customization\Menus()\Title)
BindMenuEvent(0, i, @Menu_EventHandler())

; Counter
i+1
Next

MenuBar()
MenuItem(98, "&Quit")
BindMenuEvent(0, 98, @Menu_Quit())

MenuTitle("Browse")
MenuItem(99, "Home")
BindMenuEvent(0, 99, @WebView_Home())
EndIf
EndProcedure

;------------------------------------------------------------------------------------
;- Main Loop
;------------------------------------------------------------------------------------
ShowMainWindow()
ShowHome()
LoadConfiguration()
BuildMenu()
WebView_Home()

;------------------------------------------------------------------------------------
;- Event Loop
Expand All @@ -77,9 +140,10 @@ Repeat
EndSelect

Until Quit = #True

; IDE Options = PureBasic 6.10 LTS (Windows - x64)
; CursorPosition = 47
; FirstLine = 22
; Folding = --
; CursorPosition = 89
; FirstLine = 44
; Folding = 1-
; EnableXP
; DPIAware
28 changes: 20 additions & 8 deletions Supportcenter.pbp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,28 @@
<section name="data">
<explorer view="..\..\..\ProgramData\PureBasic\Examples\" pattern="0"/>
<log show="1"/>
<lastopen date="2024-05-19 12:23" user="Tugay" host="TUGI-DESKTOP"/>
<lastopen date="2024-05-26 17:51" user="Tugay" host="TUGI-DESKTOP"/>
</section>
<section name="files">
<file name="Supportcenter.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="1" panelstate="+"/>
<fingerprint md5="2b12b374644c5c0e9c4aa740e1c7fc4f"/>
<fingerprint md5="d4a05038b9b35e4316121ef5ea834d45"/>
</file>
<file name="CHANGES.txt">
<config load="0" scan="0" panel="1" warn="1" lastopen="1" sortindex="2" panelstate="+"/>
<fingerprint md5="f83a8eb648d7a87d659b32452a9d72e0"/>
</file>
<file name="Forms\MainWindow.pbf">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="2" panelstate="++"/>
<fingerprint md5="9ac02c31941997da2d9397264accc6df"/>
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="3" panelstate="++"/>
<fingerprint md5="7cecdeb7ec99f110b03fec23ec4d7d94"/>
</file>
<file name="LICENSE">
<config load="0" scan="0" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
<fingerprint md5="ff827bc1c2042220745ff56c6f4755c6"/>
</file>
<file name="README.md">
<config load="0" scan="0" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
<fingerprint md5="e89b3fd77fa17024fe5795bd0d69dfc1"/>
</file>
</section>
<section name="targets">
Expand All @@ -27,10 +39,10 @@
<options thread="1" xpskin="1" dpiaware="1" debug="1" optimizer="0"/>
<icon enable="1">Supportcenter.ico</icon>
<versioninfo enable="1">
<field0 value="1.0.0.0"/>
<field1 value="1.0.0.0"/>
<field4 value="1.0.0.0"/>
<field5 value="1.0.0.0"/>
<field0 value="1.1.0.0"/>
<field1 value="1.1.0.0"/>
<field4 value="1.1.0.0"/>
<field5 value="1.1.0.0"/>
</versioninfo>
</target>
</section>
Expand Down
Loading

0 comments on commit 1fa08e1

Please sign in to comment.