11using Amethyst . Utils ;
2+ using Amethyst . ViewModels ;
23using Avalonia . Controls ;
34using Avalonia . Controls . Primitives ;
45using Avalonia . Media ;
@@ -44,6 +45,8 @@ public static readonly ManualResetEvent
4445 public static RaisedEvent RequestJointSettingsRefreshEvent ;
4546 public static RaisedEvent RequestReloadRemoteDevicesEvent ;
4647
48+ public static EventHandler < bool > OnAllowNavigationChanged ;
49+
4750 public static void RequestInterfaceReload ( bool all = true )
4851 {
4952 if ( ! General . GeneralTabSetupFinished )
@@ -72,36 +75,39 @@ public static class Main
7275 // Vector of std.pair holding the Navigation Tag and the relative Navigation Page.
7376 public static List < ( string Tag , Type Page ) > Pages ;
7477
78+ public static MainViewModel Context ;
79+
80+ // Info bars
81+ public static NoticeViewModel PluginsUpdatePendingInfoBar => Context . Notices [ NoticeType . PluginsUpdatePending ] ;
82+ public static NoticeViewModel PluginsInstallInfoBar => Context . Notices [ NoticeType . PluginsInstall ] ;
83+ public static NoticeViewModel PluginsUninstallInfoBar => Context . Notices [ NoticeType . PluginsUninstall ] ;
84+ public static NoticeViewModel NoticeInfoBar => Context . Notices [ NoticeType . NoticeInfo ] ;
85+ public static NoticeViewModel ReloadInfoBar => Context . Notices [ NoticeType . Reload ] ;
86+ public static NoticeViewModel UpdateDownloadingInfoBar => Context . Notices [ NoticeType . UpdateDownloading ] ;
87+ public static NoticeViewModel UpdateInfoBar => Context . Notices [ NoticeType . Update ] ;
88+
7589 // Main Window
7690 public static Mutex ApplicationMultiInstanceMutex ;
7791 public static bool MainWindowLoaded = false ;
7892
7993 public static Window Window ;
8094
8195 public static Grid
82- InterfaceBlockerGrid , NavigationBlockerGrid , MainGrid ;
96+ InterfaceBlockerGrid , MainGrid ;
8397
8498 public static NavigationView MainNavigationView ;
8599 public static Frame MainContentFrame ;
86- public static TextBlock AppTitleLabel ;
87100
88101 public static SolidColorBrush
89- AttentionBrush , NeutralBrush ;
90-
91- public static ProgressBar PluginsUpdatePendingProgressBar ;
92-
93- public static InfoBar
94- PluginsUpdatePendingInfoBar ,
95- PluginsInstallInfoBar ,
96- PluginsUninstallInfoBar ,
97- PluginsUpdateInfoBar ;
102+ AttentionBrush , NeutralBrush ,
103+ CriticalBrush , PrimaryBrush ;
98104
99105 public static Flyout EulaFlyout ;
100106 public static TextBlock EulaHeader ;
101107 public static MarkdownScrollViewer EulaText ;
102108
103109 public static bool EulaFlyoutResult ;
104- public static SemaphoreSlim EulaFlyoutClosed = new ( 0 ) ;
110+ public static readonly SemaphoreSlim EulaFlyoutClosed = new ( 0 ) ;
105111 public static INotificationManager NotificationManager ; // TODO
106112
107113 public static TopLevel TopLevel
@@ -139,7 +145,7 @@ public static void NavigateToPage(string navItemTag,
139145 Interfacing . CurrentPageClass = page . FullName ; // Cache the current page tag
140146
141147 ReloadNavigationIcons ( ) ;
142-
148+
143149 MainContentFrame . Navigate ( page , null , transitionInfo ) ;
144150 }
145151
@@ -262,22 +268,14 @@ public static class General
262268 // General Page
263269 public static bool GeneralTabSetupFinished = false ;
264270 public static ToggleButton ToggleTrackersButton ;
265- public static ToggleSplitButton SkeletonToggleButton ;
266- public static CheckBox ForceRenderCheckBox ;
267271 public static MenuFlyoutItem OffsetsButton ;
268-
269- public static Button
270- CalibrationButton , ServiceSettingsButton ;
272+ public static Button CalibrationButton ;
271273
272274 public static TextBlock
273275 DeviceNameLabel ,
274276 DeviceStatusLabel ,
275277 ErrorWhatText ,
276278 TrackingDeviceErrorLabel ,
277- ServerStatusLabel ,
278- ServerErrorLabel ,
279- ServerErrorWhatText ,
280- ForceRenderText ,
281279 ToggleTrackersButtonText ;
282280
283281 public static Grid
@@ -286,9 +284,6 @@ public static Grid
286284 public static Border
287285 ErrorWhatGrid ;
288286
289- public static Border
290- ServerErrorWhatGrid ;
291-
292287 public static ToggleButton
293288 ToggleFreezeButton ;
294289
@@ -395,10 +390,11 @@ public static void ReloadSelectedDeviceSync(bool manual, bool reconnect = false)
395390 }
396391 }
397392
398- public static async Task ReloadSelectedDevice ( bool manual , bool reconnect = false )
393+ public static Task ReloadSelectedDevice ( bool manual , bool reconnect = false )
399394 {
400395 // Reload the device
401396 ReloadSelectedDeviceSync ( manual , reconnect ) ;
397+ return Task . CompletedTask ;
402398 }
403399 }
404400
@@ -408,8 +404,6 @@ public static class MainPage
408404 {
409405 public static TeachingTip
410406 InitializerTeachingTip , EndingTeachingTip ;
411-
412- public static InfoBar ReloadInfoBar ;
413407 }
414408
415409 public static class GeneralPage
0 commit comments